diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / src / learner / learner - inl . hpp <nl> ppp b / src / learner / learner - inl . hpp <nl> class BoostLearner { <nl> this - > SetParam ( n . c_str ( ) , val ) ; <nl> } <nl> if ( ! strcmp ( name , " silent " ) ) silent = atoi ( val ) ; <nl> - if ( ! strcmp ( name , " prob_buffer_row " ) ) prob_buffer_row = static_cast < float > ( atof ( val ) ) ; <nl> + if ( ! strcmp ( name , " prob_buffer_row " ) ) { <nl> + prob_buffer_row = static_cast < float > ( atof ( val ) ) ; <nl> + this - > SetParam ( " updater " , " grow_colmaker , refresh , prune " ) ; <nl> + } <nl> if ( ! strcmp ( name , " eval_metric " ) ) evaluator_ . AddEval ( val ) ; <nl> if ( ! strcmp ( " seed " , name ) ) random : : Seed ( atoi ( val ) ) ; <nl> if ( ! strcmp ( name , " num_class " ) ) this - > SetParam ( " num_output_group " , val ) ; <nl> class BoostLearner { <nl> utils : : Assert ( gbm_ = = NULL , " GBM and obj should be NULL " ) ; <nl> obj_ = CreateObjFunction ( name_obj_ . c_str ( ) ) ; <nl> gbm_ = gbm : : CreateGradBooster ( name_gbm_ . c_str ( ) ) ; <nl> + <nl> for ( size_t i = 0 ; i < cfg_ . size ( ) ; + + i ) { <nl> obj_ - > SetParam ( cfg_ [ i ] . first . c_str ( ) , cfg_ [ i ] . second . c_str ( ) ) ; <nl> gbm_ - > SetParam ( cfg_ [ i ] . first . c_str ( ) , cfg_ [ i ] . second . c_str ( ) ) ; <nl>
ok
dmlc/xgboost
0e8846a42f3602455d3142566d39ed720f9e16df
2014-09-10T20:51:34Z
mmm a / docs / command - line . md <nl> ppp b / docs / command - line . md <nl> A series of tags form an AND expression wheras a comma - separated sequence forms <nl> < pre > [ one ] [ two ] , [ three ] < / pre > <nl> This matches all tests tagged ` [ one ] ` and ` [ two ] ` , as well as all tests tagged ` [ three ] ` <nl> <nl> + Test names containing special characters , such as ` , ` or ` [ ` can specify them on the command line using ` \ ` . <nl> + ` \ ` also escapes itself . <nl> <nl> < a id = " choosing - a - reporter - to - use " > < / a > <nl> # # Choosing a reporter to use <nl> mmm a / docs / release - notes . md <nl> ppp b / docs / release - notes . md <nl> <nl> * Blue shell colour <nl> * Missing argument to ` CATCH_CHECK_THROWS ` <nl> * Don ' t encode extended ASCII in XML <nl> - * use std : : shuffle on more compilers ( fixes deprecation warning / error ) <nl> + * use ` std : : shuffle ` on more compilers ( fixes deprecation warning / error ) <nl> * Use ` __COUNTER__ ` more consistently ( where available ) <nl> <nl> # # # Other : <nl>
Added note on escaping names on command line to docs
catchorg/Catch2
e6aa1f4e4ec1a5429789e0a9a85d168d4acbf2b8
2017-01-11T17:14:28Z
mmm a / shell / browser / ui / file_dialog_gtk . cc <nl> ppp b / shell / browser / ui / file_dialog_gtk . cc <nl> class FileChooserDialog { <nl> if ( ! settings . button_label . empty ( ) ) <nl> confirm_text = settings . button_label . c_str ( ) ; <nl> else if ( action = = GTK_FILE_CHOOSER_ACTION_SAVE ) <nl> - confirm_text = gtk_util : : kOpenLabel ; <nl> - else if ( action = = GTK_FILE_CHOOSER_ACTION_OPEN ) <nl> confirm_text = gtk_util : : kSaveLabel ; <nl> + else if ( action = = GTK_FILE_CHOOSER_ACTION_OPEN ) <nl> + confirm_text = gtk_util : : kOpenLabel ; <nl> <nl> dialog_ = gtk_file_chooser_dialog_new ( <nl> settings . title . c_str ( ) , nullptr , action , gtk_util : : kCancelLabel , <nl>
fix : swapped labels on open / save gtkdialog ( )
electron/electron
f0b0614dd79f741b5018c3187a438c24571c722e
2019-10-31T14:55:39Z
mmm a / tensorflow / compiler / xla / service / gpu / nvptx_compiler . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / nvptx_compiler . cc <nl> namespace { <nl> <nl> namespace tracing = tensorflow : : tracing ; <nl> <nl> + static std : : vector < std : : string > CandidateCudaRoots ( <nl> + const HloModuleConfig & config ) { <nl> + return tensorflow : : CandidateCudaRoots ( <nl> + config . debug_options ( ) . xla_gpu_cuda_data_dir ( ) ) ; <nl> + } <nl> + <nl> void PrintCantFindCudaMessage ( absl : : string_view msg , <nl> const HloModuleConfig & hlo_module_config ) { <nl> LOG ( WARNING ) < < msg ; <nl> LOG ( WARNING ) < < " Searched in the following directories : " ; <nl> <nl> - for ( const auto & dir : <nl> - GetCudaRootCandidates ( PtxCompilationOptions ( hlo_module_config ) ) ) { <nl> + for ( const auto & dir : CandidateCudaRoots ( hlo_module_config ) ) { <nl> LOG ( WARNING ) < < " " < < dir ; <nl> } <nl> LOG ( WARNING ) <nl> void PrintCantFindCudaMessage ( absl : : string_view msg , <nl> <nl> / / Returns the directory containing nvvm libdevice files . <nl> string GetLibdeviceDir ( const HloModuleConfig & hlo_module_config ) { <nl> - const auto & candidate_dirs = <nl> - GetCudaRootCandidates ( PtxCompilationOptions ( hlo_module_config ) ) ; <nl> - for ( const string & cuda_root : candidate_dirs ) { <nl> + for ( const string & cuda_root : CandidateCudaRoots ( hlo_module_config ) ) { <nl> string libdevice_dir = <nl> tensorflow : : io : : JoinPath ( cuda_root , " nvvm " , " libdevice " ) ; <nl> VLOG ( 2 ) < < " Looking for libdevice at " < < libdevice_dir ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / stream_executor_util . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / stream_executor_util . cc <nl> void WarnIfBadPtxasVersion ( const string & ptxas_path ) { <nl> } <nl> } <nl> <nl> - / / Returns a vector of potential locations of the CUDA root directory . <nl> - / / Searches through tensorflow CUDA locations AND through the CUDA location <nl> - / / specified in HLO configuration . <nl> - std : : vector < string > GetCudaRootCandidates ( <nl> - PtxCompilationOptions compile_ptx_options ) { <nl> - std : : vector < string > potential_cuda_roots = tensorflow : : CandidateCudaRoots ( ) ; <nl> - <nl> - / / " . " is our last resort , even though it probably won ' t work . <nl> - potential_cuda_roots . push_back ( " . " ) ; <nl> - <nl> - / / CUDA location explicitly specified by user via - - xla_gpu_cuda_data_dir has <nl> - / / highest priority . <nl> - string xla_gpu_cuda_data_dir = compile_ptx_options . xla_gpu_cuda_data_dir ; <nl> - if ( ! xla_gpu_cuda_data_dir . empty ( ) ) { <nl> - potential_cuda_roots . insert ( potential_cuda_roots . begin ( ) , <nl> - xla_gpu_cuda_data_dir ) ; <nl> - } <nl> - return potential_cuda_roots ; <nl> - } <nl> - <nl> StatusOr < absl : : Span < const uint8 > > CompilePtxOrGetCached ( <nl> se : : StreamExecutor * executor , absl : : string_view ptx , <nl> PtxCompilationOptions compilation_options ) { <nl> StatusOr < std : : vector < uint8 > > CompilePtx ( <nl> " Compile PTX " , tensorflow : : profiler : : TraceMeLevel : : kInfo ) ; <nl> auto env = tensorflow : : Env : : Default ( ) ; <nl> string ptxas_path ; <nl> - for ( const string & cuda_root : GetCudaRootCandidates ( compile_ptx_options ) ) { <nl> + for ( const string & cuda_root : tensorflow : : CandidateCudaRoots ( <nl> + / * preferred_location = * / compile_ptx_options . xla_gpu_cuda_data_dir ) ) { <nl> ptxas_path = tensorflow : : io : : JoinPath ( cuda_root , " bin " , " ptxas " ) ; <nl> VLOG ( 2 ) < < " Looking for ptxas at " < < ptxas_path ; <nl> if ( env - > FileExists ( ptxas_path ) . ok ( ) ) { <nl> mmm a / tensorflow / compiler / xla / service / gpu / stream_executor_util . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / stream_executor_util . h <nl> StatusOr < absl : : Span < const uint8 > > CompilePtxOrGetCached ( <nl> se : : StreamExecutor * executor , absl : : string_view ptx , <nl> PtxCompilationOptions compilation_options ) ; <nl> <nl> - / / Returns a vector of potential locations of the CUDA root directory . <nl> - / / Searches through tensorflow CUDA locations AND through the CUDA location <nl> - / / specified in compile_ptx_options ( can be constructed from HloModuleConfig ) . <nl> - std : : vector < string > GetCudaRootCandidates ( <nl> - PtxCompilationOptions compile_ptx_options ) ; <nl> - <nl> } / / namespace gpu <nl> } / / namespace xla <nl> <nl> mmm a / tensorflow / core / platform / cuda_libdevice_path . h <nl> ppp b / tensorflow / core / platform / cuda_libdevice_path . h <nl> namespace tensorflow { <nl> / / the CUDA SDK , which contains sub - folders such as bin , lib64 , and nvvm . <nl> std : : vector < string > CandidateCudaRoots ( ) ; <nl> <nl> + / / A convenient wrapper for CandidateCudaRoots , which allows supplying a <nl> + / / preferred location ( inserted first in the output vector ) , and a flag whether <nl> + / / the current working directory should be searched ( inserted last ) . <nl> + inline std : : vector < string > CandidateCudaRoots ( <nl> + string preferred_location , bool use_working_directory = true ) { <nl> + std : : vector < string > candidates = CandidateCudaRoots ( ) ; <nl> + if ( ! preferred_location . empty ( ) ) { <nl> + candidates . insert ( candidates . begin ( ) , preferred_location ) ; <nl> + } <nl> + <nl> + / / " . " is our last resort , even though it probably won ' t work . <nl> + candidates . push_back ( " . " ) ; <nl> + <nl> + return candidates ; <nl> + } <nl> + <nl> } / / namespace tensorflow <nl> <nl> # endif / / TENSORFLOW_CORE_PLATFORM_CUDA_LIBDEVICE_PATH_H_ <nl>
Remove XLA : : GetCudaRootCandidates , extend tensorflow : : CandidateCudaRoots
tensorflow/tensorflow
cd134aa61d1dfa1277b1a7c5cff299dd89bcc8ab
2019-05-15T00:59:01Z
mmm a / src / runtime / base / runtime_option . cpp <nl> ppp b / src / runtime / base / runtime_option . cpp <nl> bool RuntimeOption : : ServerThreadRoundRobin = false ; <nl> int RuntimeOption : : ServerThreadDropCacheTimeoutSeconds = 0 ; <nl> bool RuntimeOption : : ServerThreadJobLIFO = false ; <nl> int RuntimeOption : : PageletServerThreadCount = 0 ; <nl> + bool RuntimeOption : : PageletServerThreadRoundRobin = false ; <nl> + int RuntimeOption : : PageletServerThreadDropCacheTimeoutSeconds = 0 ; <nl> int RuntimeOption : : FiberCount = 1 ; <nl> int RuntimeOption : : RequestTimeoutSeconds = 0 ; <nl> int64 RuntimeOption : : RequestMemoryMaxBytes = - 1 ; <nl> void RuntimeOption : : Load ( Hdf & config , StringVec * overwrites / * = NULL * / ) { <nl> xbox [ " ProcessMessageFunc " ] . get ( " xbox_process_message " ) ; <nl> } <nl> { <nl> - PageletServerThreadCount = config [ " PageletServer . ThreadCount " ] . getInt32 ( 0 ) ; <nl> + Hdf pagelet = config [ " PageletServer " ] ; <nl> + PageletServerThreadCount = pagelet [ " ThreadCount " ] . getInt32 ( 0 ) ; <nl> + PageletServerThreadRoundRobin = pagelet [ " ThreadRoundRobin " ] . getBool ( ) ; <nl> + PageletServerThreadDropCacheTimeoutSeconds = <nl> + pagelet [ " ThreadDropCacheTimeoutSeconds " ] . getInt32 ( 0 ) ; <nl> + } <nl> + { <nl> FiberCount = config [ " Fiber . ThreadCount " ] . getInt32 ( Process : : GetCPUCount ( ) ) ; <nl> } <nl> { <nl> mmm a / src / runtime / base / runtime_option . h <nl> ppp b / src / runtime / base / runtime_option . h <nl> class RuntimeOption { <nl> static int ServerThreadDropCacheTimeoutSeconds ; <nl> static bool ServerThreadJobLIFO ; <nl> static int PageletServerThreadCount ; <nl> + static bool PageletServerThreadRoundRobin ; <nl> + static int PageletServerThreadDropCacheTimeoutSeconds ; <nl> static int FiberCount ; <nl> static int RequestTimeoutSeconds ; <nl> static int64 RequestMemoryMaxBytes ; <nl> mmm a / src / runtime / base / server / pagelet_server . cpp <nl> ppp b / src / runtime / base / server / pagelet_server . cpp <nl> void PageletServer : : Restart ( ) { <nl> if ( RuntimeOption : : PageletServerThreadCount > 0 ) { <nl> s_dispatcher = new JobQueueDispatcher < PageletTransport * , PageletWorker > <nl> ( RuntimeOption : : PageletServerThreadCount , <nl> - RuntimeOption : : ServerThreadRoundRobin , <nl> - RuntimeOption : : ServerThreadDropCacheTimeoutSeconds , <nl> + RuntimeOption : : PageletServerThreadRoundRobin , <nl> + RuntimeOption : : PageletServerThreadDropCacheTimeoutSeconds , <nl> NULL ) ; <nl> Logger : : Info ( " pagelet server started " ) ; <nl> s_dispatcher - > start ( ) ; <nl>
[ Pagelet ] Make pagelet thread flushing behavior a separate config
facebook/hhvm
9a15a87bd90bac4b8f8366200f4ffb1a687d41fd
2010-12-22T18:44:04Z
mmm a / lib / SILGen / SILGenExpr . cpp <nl> ppp b / lib / SILGen / SILGenExpr . cpp <nl> RValue RValueEmitter : : visitArrayExpr ( ArrayExpr * E , SGFContext C ) { <nl> emitBeginVarargs ( SGF , loc , elementType , arrayTy , <nl> E - > getNumElements ( ) , { } ) ; <nl> <nl> + / / Cleanups for any elements that have been initialized so far . <nl> + SmallVector < CleanupHandle , 8 > cleanups ; <nl> + <nl> for ( unsigned index : range ( E - > getNumElements ( ) ) ) { <nl> auto destAddr = varargsInfo . getBaseAddress ( ) ; <nl> if ( index ! = 0 ) { <nl> RValue RValueEmitter : : visitArrayExpr ( ArrayExpr * E , SGFContext C ) { <nl> destAddr = SGF . B . createIndexAddr ( loc , destAddr , indexValue ) ; <nl> } <nl> auto & destTL = varargsInfo . getBaseTypeLowering ( ) ; <nl> - / / Use an invalid cleanup here because we ' re relying on the cleanup for <nl> - / / the Array constructed inside emitBeginVarargs to destroy these values . <nl> - TemporaryInitialization init ( destAddr , CleanupHandle : : invalid ( ) ) ; <nl> + / / Create a dormant cleanup for the value in case we exit before the <nl> + / / full array has been constructed . <nl> + <nl> + CleanupHandle destCleanup = CleanupHandle : : invalid ( ) ; <nl> + if ( ! destTL . isTrivial ( ) ) { <nl> + destCleanup = SGF . enterDestroyCleanup ( destAddr ) ; <nl> + SGF . Cleanups . setCleanupState ( destCleanup , CleanupState : : Dormant ) ; <nl> + cleanups . push_back ( destCleanup ) ; <nl> + } <nl> + <nl> + TemporaryInitialization init ( destAddr , destCleanup ) ; <nl> + <nl> ArgumentSource ( E - > getElements ( ) [ index ] ) <nl> . forwardInto ( SGF , varargsInfo . getBaseAbstractionPattern ( ) , & init , <nl> destTL ) ; <nl> } <nl> <nl> + / / Kill the per - element cleanups . The array will take ownership of them . <nl> + for ( auto destCleanup : cleanups ) <nl> + SGF . Cleanups . setCleanupState ( destCleanup , CleanupState : : Dead ) ; <nl> + <nl> RValue arg ( SGF , loc , arrayTy , <nl> emitEndVarargs ( SGF , loc , std : : move ( varargsInfo ) ) ) ; <nl> <nl> mmm a / test / Interpreter / arrays . swift <nl> ppp b / test / Interpreter / arrays . swift <nl> test ( ) <nl> let mdaPerf = [ [ 1 ] , [ 2 ] , [ 3 ] , [ 4 ] , [ 5 ] , [ 6 ] , [ 7 ] , [ 8 ] , [ 9 ] , [ 10 ] , [ 11 ] , [ 12 ] ] <nl> print ( mdaPerf ) <nl> / / CHECK : { { \ [ } } [ 1 ] , [ 2 ] , [ 3 ] , [ 4 ] , [ 5 ] , [ 6 ] , [ 7 ] , [ 8 ] , [ 9 ] , [ 10 ] , [ 11 ] , [ 12 ] ] <nl> + <nl> + class Deinitable { <nl> + deinit { <nl> + print ( " deinit called " ) <nl> + } <nl> + } <nl> + <nl> + enum E : Error { <nl> + case error <nl> + } <nl> + <nl> + func throwingFunc ( ) throws - > Deinitable { <nl> + throw E . error <nl> + } <nl> + <nl> + do { <nl> + let array = try [ Deinitable ( ) , throwingFunc ( ) ] <nl> + } catch { <nl> + / / CHECK : deinit called <nl> + / / CHECK : error thrown <nl> + print ( " error thrown " ) <nl> + } <nl> \ No newline at end of file <nl> mmm a / test / SILGen / literals . swift <nl> ppp b / test / SILGen / literals . swift <nl> func makeBasic < T : FooProtocol > ( ) - > T { return T ( ) } <nl> / / CHECK : return [ [ ARR ] ] <nl> <nl> / / CHECK : bb2 ( [ [ ERR : % . * ] ] : @ owned $ Error ) : <nl> + / / CHECK : destroy_addr [ [ POINTER ] ] : $ * T <nl> / / CHECK : [ [ DEALLOC : % . * ] ] = function_ref @ $ ss29_deallocateUninitializedArrayyySayxGnlF <nl> / / CHECK : [ [ TMP : % . * ] ] = apply [ [ DEALLOC ] ] < T > ( [ [ ARR ] ] ) <nl> / / CHECK : throw [ [ ERR ] ] : $ Error <nl>
SILGen : Clean up partially - initialized array elements when lowering ArrayExpr
apple/swift
11d4fc0fbb53387d272f56837f027f600b0d524d
2019-03-28T03:21:08Z
mmm a / README . md <nl> ppp b / README . md <nl> <nl> - [ ! [ Electron Logo ] ( http : / / electron . atom . io / images / electron - logo - word - lg . png ) ] ( http : / / electron . atom . io / ) <nl> + [ ! [ Electron Logo ] ( http : / / electron . atom . io / images / electron - logo . svg ) ] ( http : / / electron . atom . io / ) <nl> <nl> [ ! [ Build Status ] ( https : / / travis - ci . org / atom / electron . svg ? branch = master ) ] ( https : / / travis - ci . org / atom / electron ) <nl> [ ! [ devDependency Status ] ( https : / / david - dm . org / atom / electron / dev - status . svg ) ] ( https : / / david - dm . org / atom / electron # info = devDependencies ) <nl>
Merge pull request from mnquintana / patch - 1
electron/electron
d826e1e5fba5d7c325bc3feaee47feae1d7e8cf8
2015-04-28T15:57:35Z
mmm a / doc / api . rst <nl> ppp b / doc / api . rst <nl> The { fmt } library API consists of the following parts : <nl> facilities and a lightweight subset of formatting functions <nl> * : ref : ` fmt / format . h < format - api > ` : the full format API providing compile - time <nl> format string checks , output iterator and user - defined type support <nl> - * : ref : ` fmt / time . h < time - api > ` : date and time formatting <nl> + * : ref : ` fmt / chrono . h < chrono - api > ` : date and time formatting <nl> * : ref : ` fmt / ostream . h < ostream - api > ` : ` ` std : : ostream ` ` support <nl> * : ref : ` fmt / printf . h < printf - api > ` : ` ` printf ` ` formatting <nl> <nl> custom argument formatter class : : <nl> . . doxygenclass : : fmt : : arg_formatter <nl> : members : <nl> <nl> - . . _time - api : <nl> + . . _chrono - api : <nl> <nl> Date and time formatting <nl> = = = = = = = = = = = = = = = = = = = = = = = = <nl> The library supports ` strftime <nl> < http : / / en . cppreference . com / w / cpp / chrono / c / strftime > ` _ - like date and time <nl> formatting : : <nl> <nl> - # include < fmt / time . h > <nl> + # include < fmt / chrono . h > <nl> <nl> std : : time_t t = std : : time ( nullptr ) ; <nl> / / Prints " The date is 2016 - 04 - 29 . " ( with the current date ) <nl>
doc fix : time - > chrono
fmtlib/fmt
f569c1ba28d30dd3070a59140e1c99452d97503c
2019-04-12T21:51:32Z
mmm a / Marlin / ultralcd_implementation_hitachi_HD44780 . h <nl> ppp b / Marlin / ultralcd_implementation_hitachi_HD44780 . h <nl> unsigned lcd_print ( char c ) { return charset_mapper ( c ) ; } <nl> } <nl> } <nl> <nl> - inline void logo_lines ( const char * extra ) { <nl> + static void logo_lines ( const char * extra ) { <nl> int indent = ( LCD_WIDTH - 8 - lcd_strlen_P ( extra ) ) / 2 ; <nl> lcd . setCursor ( indent , 0 ) ; lcd . print ( ' \ x00 ' ) ; lcd_printPGM ( PSTR ( " mmmmmm " ) ) ; lcd . print ( ' \ x01 ' ) ; <nl> lcd . setCursor ( indent , 1 ) ; lcd_printPGM ( PSTR ( " | Marlin | " ) ) ; lcd_printPGM ( extra ) ; <nl> unsigned lcd_print ( char c ) { return charset_mapper ( c ) ; } <nl> <nl> # define LCD_EXTRA_SPACE ( LCD_WIDTH - 8 ) <nl> <nl> + # define CENTER_OR_SCROLL ( STRING , DELAY ) \ <nl> + lcd_erase_line ( 3 ) ; \ <nl> + if ( strlen ( STRING ) < = LCD_WIDTH ) { \ <nl> + lcd . setCursor ( ( LCD_WIDTH - lcd_strlen_P ( PSTR ( STRING ) ) ) / 2 , 3 ) ; \ <nl> + lcd_printPGM ( PSTR ( STRING ) ) ; \ <nl> + delay ( DELAY ) ; \ <nl> + } \ <nl> + else { \ <nl> + lcd_scroll ( 0 , 3 , PSTR ( STRING ) , LCD_WIDTH , DELAY ) ; \ <nl> + } <nl> + <nl> # ifdef STRING_SPLASH_LINE1 <nl> - / / Combine into a single splash screen if possible <nl> + / / <nl> + / / Show the Marlin logo with splash line 1 <nl> + / / <nl> if ( LCD_EXTRA_SPACE > = strlen ( STRING_SPLASH_LINE1 ) + 1 ) { <nl> + / / <nl> + / / Show the Marlin logo , splash line1 , and splash line 2 <nl> + / / <nl> logo_lines ( PSTR ( " " STRING_SPLASH_LINE1 ) ) ; <nl> # ifdef STRING_SPLASH_LINE2 <nl> - lcd_erase_line ( 3 ) ; <nl> - lcd_scroll ( 0 , 3 , PSTR ( STRING_SPLASH_LINE2 ) , LCD_WIDTH , 2000 ) ; <nl> + CENTER_OR_SCROLL ( STRING_SPLASH_LINE2 , 2000 ) ; <nl> # else <nl> delay ( 2000 ) ; <nl> # endif <nl> } <nl> else { <nl> + / / <nl> + / / Show the Marlin logo with splash line 1 <nl> + / / After a delay show splash line 2 , if it exists <nl> + / / <nl> + # ifdef STRING_SPLASH_LINE2 <nl> + # define _SPLASH_WAIT_1 1500 <nl> + # else <nl> + # define _SPLASH_WAIT_1 2000 <nl> + # endif <nl> logo_lines ( PSTR ( " " ) ) ; <nl> - lcd_erase_line ( 3 ) ; <nl> - lcd_scroll ( 0 , 3 , PSTR ( STRING_SPLASH_LINE1 ) , LCD_WIDTH , 1500 ) ; <nl> + CENTER_OR_SCROLL ( STRING_SPLASH_LINE1 , _SPLASH_WAIT_1 ) ; <nl> # ifdef STRING_SPLASH_LINE2 <nl> - lcd_erase_line ( 3 ) ; <nl> - lcd_scroll ( 0 , 3 , PSTR ( STRING_SPLASH_LINE2 ) , LCD_WIDTH , 1500 ) ; <nl> + CENTER_OR_SCROLL ( STRING_SPLASH_LINE2 , 1500 ) ; <nl> # endif <nl> } <nl> # elif defined ( STRING_SPLASH_LINE2 ) <nl> - / / Combine into a single splash screen if possible <nl> + / / <nl> + / / Show splash line 2 only , alongside the logo if possible <nl> + / / <nl> if ( LCD_EXTRA_SPACE > = strlen ( STRING_SPLASH_LINE2 ) + 1 ) { <nl> logo_lines ( PSTR ( " " STRING_SPLASH_LINE2 ) ) ; <nl> delay ( 2000 ) ; <nl> } <nl> else { <nl> logo_lines ( PSTR ( " " ) ) ; <nl> - lcd_erase_line ( 3 ) ; <nl> - lcd_scroll ( 0 , 3 , PSTR ( STRING_SPLASH_LINE2 ) , LCD_WIDTH , 2000 ) ; <nl> + CENTER_OR_SCROLL ( STRING_SPLASH_LINE2 , 2000 ) ; <nl> } <nl> # else <nl> + / / <nl> + / / Show only the Marlin logo <nl> + / / <nl> logo_lines ( PSTR ( " " ) ) ; <nl> delay ( 2000 ) ; <nl> # endif <nl>
Merge pull request from thinkyhead / rc_better_bootscreen
MarlinFirmware/Marlin
09c6323b68567bccd44ee0a89a8f3084cc0efca9
2016-04-18T00:20:13Z
mmm a / bindings / c / test / unit / unit_tests . cpp <nl> ppp b / bindings / c / test / unit / unit_tests . cpp <nl> TEST_CASE ( " fdb_transaction_get_range reverse " ) { <nl> CHECK ( result . more ) ; <nl> } <nl> <nl> - / / Read data in reverse order , keeping in mind that out_count might be <nl> - / / smaller than requested . <nl> + / / Read data in reverse order . <nl> auto it = data . rbegin ( ) ; <nl> - std : : advance ( it , data . size ( ) - result . kvs . size ( ) ) ; <nl> - for ( auto results_it = result . kvs . begin ( ) ; it ! = data . rend ( ) ; + + it ) { <nl> + for ( auto results_it = result . kvs . begin ( ) ; results_it ! = result . kvs . end ( ) ; + + results_it , + + it ) { <nl> std : : string data_key = it - > first ; <nl> std : : string data_value = it - > second ; <nl> <nl> - auto [ key , value ] = * results_it + + ; <nl> + auto [ key , value ] = * results_it ; <nl> <nl> CHECK ( data_key . compare ( key ) = = 0 ) ; <nl> CHECK ( data [ data_key ] . compare ( value ) = = 0 ) ; <nl>
Fix reverse iteration issue
apple/foundationdb
8b2ec93ab2dfa1b5966d86c5183bf28317556e2a
2020-10-13T17:42:55Z
mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> char * ftostr52 ( const float & x ) { <nl> if ( max_software_endstops & & current_position [ Z_AXIS ] > Z_MAX_POS ) current_position [ Z_AXIS ] = Z_MAX_POS ; <nl> encoderPosition = 0 ; <nl> line_to_current ( ) ; <nl> - lcdDrawUpdate = 1 ; <nl> + lcdDrawUpdate = 2 ; <nl> } <nl> if ( lcdDrawUpdate ) lcd_implementation_drawedit ( PSTR ( " Z " ) , ftostr43 ( current_position [ Z_AXIS ] ) ) ; <nl> static bool debounce_click = false ; <nl> char * ftostr52 ( const float & x ) { <nl> current_position [ X_AXIS ] = mbl . get_x ( ix ) ; <nl> current_position [ Y_AXIS ] = mbl . get_y ( iy ) ; <nl> line_to_current ( ) ; <nl> - lcdDrawUpdate = 1 ; <nl> + lcdDrawUpdate = 2 ; <nl> } <nl> } <nl> } else { <nl> char * ftostr52 ( const float & x ) { <nl> } <nl> <nl> static void _lcd_level_bed_homing ( ) { <nl> + if ( lcdDrawUpdate ) lcd_implementation_drawedit ( PSTR ( " XYZ " ) , " Homing " ) ; <nl> if ( axis_known_position [ X_AXIS ] & & <nl> axis_known_position [ Y_AXIS ] & & <nl> axis_known_position [ Z_AXIS ] ) { <nl> char * ftostr52 ( const float & x ) { <nl> _lcd_level_bed_position = 0 ; <nl> lcd_goto_menu ( _lcd_level_bed ) ; <nl> } <nl> + lcdDrawUpdate = 2 ; <nl> } <nl> <nl> static void lcd_level_bed ( ) { <nl> char * ftostr52 ( const float & x ) { <nl> axis_known_position [ Z_AXIS ] = false ; <nl> mbl . reset ( ) ; <nl> enquecommands_P ( PSTR ( " G28 " ) ) ; <nl> + lcdDrawUpdate = 2 ; <nl> lcd_goto_menu ( _lcd_level_bed_homing ) ; <nl> } <nl> <nl>
Manual bed leveling menu fixes .
MarlinFirmware/Marlin
a37c7ff16d239794e6e53cc30f79f98d4b3cab41
2015-04-12T14:56:17Z
mmm a / xbmc / cores / AudioEngine / Engines / CoreAudio / CoreAudioAEStream . cpp <nl> ppp b / xbmc / cores / AudioEngine / Engines / CoreAudio / CoreAudioAEStream . cpp <nl> unsigned int CCoreAudioAEStream : : GetSpace ( ) <nl> if ( ! m_valid | | m_draining ) <nl> return 0 ; <nl> <nl> - return m_Buffer - > GetWriteSize ( ) ; <nl> + return m_Buffer - > GetWriteSize ( ) / m_OutputBytesPerSample * m_StreamBytesPerSample ; <nl> } <nl> <nl> double CCoreAudioAEStream : : GetDelay ( ) <nl>
[ AE / CA ] - fix implementation of AEStream : : GetSpace . This is the real fix for the paplayer problem where the next stream was started by accident when paused for a while ( visible on dvdplayercodecs ) . Thx to jm for hammering on it and thx to gimli for the fix : )
xbmc/xbmc
d646c6fec436a1be0b3a82d734d1aa965a07a45f
2012-12-11T22:03:06Z
mmm a / lib / SILGen / SILGenExpr . cpp <nl> ppp b / lib / SILGen / SILGenExpr . cpp <nl> RValue RValueEmitter : : visitIfExpr ( IfExpr * E , SGFContext C ) { <nl> SGF . getLoweredType ( E - > getType ( ) ) ) ; <nl> <nl> cond . enterTrue ( SGF ) ; <nl> - SGF . emitProfilerIncrement ( E ) ; <nl> + SGF . emitProfilerIncrement ( E - > getThenExpr ( ) ) ; <nl> SILValue trueValue ; <nl> { <nl> auto TE = E - > getThenExpr ( ) ; <nl> RValue RValueEmitter : : visitIfExpr ( IfExpr * E , SGFContext C ) { <nl> / * hasFalse * / true , <nl> / * invertCondition * / false ) ; <nl> cond . enterTrue ( SGF ) ; <nl> - SGF . emitProfilerIncrement ( E ) ; <nl> + SGF . emitProfilerIncrement ( E - > getThenExpr ( ) ) ; <nl> { <nl> auto TE = E - > getThenExpr ( ) ; <nl> FullExpr trueScope ( SGF . Cleanups , CleanupLocation ( TE ) ) ; <nl> mmm a / lib / SILGen / SILGenProfiling . cpp <nl> ppp b / lib / SILGen / SILGenProfiling . cpp <nl> struct MapRegionCounters : public ASTWalker { <nl> } <nl> <nl> std : : pair < bool , Expr * > walkToExprPre ( Expr * E ) override { <nl> - switch ( E - > getKind ( ) ) { <nl> - default : <nl> - break ; <nl> - case ExprKind : : AutoClosure : <nl> - case ExprKind : : Closure : <nl> - case ExprKind : : If : <nl> + if ( auto * IE = dyn_cast < IfExpr > ( E ) ) <nl> + CounterMap [ IE - > getThenExpr ( ) ] = NextCounter + + ; <nl> + else if ( isa < AutoClosureExpr > ( E ) | | isa < ClosureExpr > ( E ) ) <nl> CounterMap [ E ] = NextCounter + + ; <nl> - break ; <nl> - } <nl> return { true , E } ; <nl> } <nl> } ; <nl> struct CoverageMapping : public ASTWalker { <nl> if ( ! RegionStack . empty ( ) ) <nl> extendRegion ( E ) ; <nl> <nl> - switch ( E - > getKind ( ) ) { <nl> - default : <nl> - break ; <nl> - case ExprKind : : AutoClosure : <nl> + if ( isa < AutoClosureExpr > ( E ) ) { <nl> / / Autoclosures look strange if there isn ' t a region , since it looks like <nl> / / control flow starts partway through an expression . For now we skip <nl> / / these so we don ' t get odd behaviour in default arguments and the like , <nl> / / but in the future we should consider creating appropriate regions for <nl> / / those expressions . <nl> - if ( RegionStack . empty ( ) ) <nl> - break ; <nl> - SWIFT_FALLTHROUGH ; <nl> - case ExprKind : : Closure : <nl> + if ( ! RegionStack . empty ( ) ) <nl> + assignCounter ( E ) ; <nl> + } else if ( isa < ClosureExpr > ( E ) ) { <nl> assignCounter ( E ) ; <nl> - break ; <nl> + } else if ( auto * IE = dyn_cast < IfExpr > ( E ) ) { <nl> + CounterExpr & ThenCounter = assignCounter ( IE - > getThenExpr ( ) ) ; <nl> + assignCounter ( IE - > getElseExpr ( ) , <nl> + CounterExpr : : Sub ( getCurrentCounter ( ) , ThenCounter ) ) ; <nl> } <nl> <nl> if ( hasCounter ( E ) ) <nl> new file mode 100644 <nl> index 000000000000 . . 1ac82209af32 <nl> mmm / dev / null <nl> ppp b / test / SILGen / coverage_ternary . swift <nl> <nl> + / / RUN : % target - swift - frontend - profile - generate - profile - coverage - mapping - emit - sorted - sil - emit - sil - module - name coverage_ternary % s | FileCheck % s <nl> + <nl> + / / CHECK - LABEL : sil_coverage_map { { . * } } / / coverage_ternary . foo <nl> + func foo ( x : Int32 ) - > Int32 { <nl> + return x = = 3 <nl> + ? 9000 / / CHECK : [ [ @ LINE ] ] : 16 - > [ [ @ LINE ] ] : 20 : 1 <nl> + : 1234 / / CHECK : [ [ @ LINE ] ] : 16 - > [ [ @ LINE ] ] : 20 : ( 0 - 1 ) <nl> + } <nl> + <nl> + foo ( 1 ) <nl> + foo ( 2 ) <nl> + foo ( 3 ) <nl>
InstrProf : Handle IfExpr correctly for coverage maps
apple/swift
086c2d49eaca3e3818815cde47009c4f720f9c99
2015-07-08T07:17:08Z
mmm a / xbmc / platform / android / activity / XBMCApp . cpp <nl> ppp b / xbmc / platform / android / activity / XBMCApp . cpp <nl> void CXBMCApp : : UpdateSessionState ( ) <nl> float speed = 0 . 0 ; <nl> if ( m_playback_state ! = PLAYBACK_STATE_STOPPED ) <nl> { <nl> + if ( g_application . m_pPlayer - > HasVideo ( ) ) <nl> + m_playback_state | = PLAYBACK_STATE_VIDEO ; <nl> + else <nl> + m_playback_state & = ~ PLAYBACK_STATE_VIDEO ; <nl> + if ( g_application . m_pPlayer - > HasAudio ( ) ) <nl> + m_playback_state | = PLAYBACK_STATE_AUDIO ; <nl> + else <nl> + m_playback_state & = ~ PLAYBACK_STATE_AUDIO ; <nl> pos = g_application . m_pPlayer - > GetTime ( ) ; <nl> speed = g_application . m_pPlayer - > GetPlaySpeed ( ) ; <nl> if ( m_playback_state & PLAYBACK_STATE_PLAYING ) <nl>
Merge pull request from koying / fixupvpstateL
xbmc/xbmc
dc3c2596fd9dc17dce987d585369b2e72cc7ecbb
2017-08-25T13:36:35Z
mmm a / src / runtime / ext / soap / encoding . cpp <nl> ppp b / src / runtime / ext / soap / encoding . cpp <nl> encodeStatic s_defaultEncoding [ ] = { <nl> to_zval_double , to_xml_double } , <nl> { LiteralString , XSD_STRING_STRING , XSD_NAMESPACE , <nl> to_zval_string , to_xml_string } , <nl> + { KindOfStaticString , XSD_STRING_STRING , XSD_NAMESPACE , <nl> + to_zval_string , to_xml_string } , <nl> { KindOfString , XSD_STRING_STRING , XSD_NAMESPACE , <nl> to_zval_string , to_xml_string } , <nl> { KindOfArray , SOAP_ENC_ARRAY_STRING , SOAP_1_1_ENC_NAMESPACE , <nl> static encodePtr get_array_type ( xmlNodePtr node , CVarRef array , <nl> cur_ns = NULL ; <nl> } else { <nl> cur_type = tmp . getType ( ) ; <nl> - if ( cur_type = = LiteralString ) { <nl> + if ( cur_type = = LiteralString | | <nl> + cur_type = = KindOfStaticString ) { <nl> cur_type = KindOfString ; <nl> } <nl> cur_stype = NULL ; <nl>
Fix Soap errors introduced by StaticString changes
facebook/hhvm
41eb922bdd66783ace7633b1533f108483bcbca2
2010-05-28T18:48:47Z
mmm a / modules / planning / common / planning_gflags . cc <nl> ppp b / modules / planning / common / planning_gflags . cc <nl> DEFINE_bool ( enable_scenario_stop_sign , true , <nl> DEFINE_bool ( enable_scenario_traffic_light , true , <nl> " enable traffic_light scenarios in planning " ) ; <nl> <nl> - DEFINE_bool ( enable_scenario_yield_sign , true , <nl> + DEFINE_bool ( enable_scenario_yield_sign , false , <nl> " enable yield_sign scenarios in planning " ) ; <nl> <nl> DEFINE_bool ( enable_force_pull_over_open_space_parking_test , false , <nl> mmm a / modules / planning / scenarios / scenario_manager . cc <nl> ppp b / modules / planning / scenarios / scenario_manager . cc <nl> <nl> # include " modules / planning / scenarios / traffic_light / protected / traffic_light_protected_scenario . h " <nl> # include " modules / planning / scenarios / traffic_light / unprotected_left_turn / traffic_light_unprotected_left_turn_scenario . h " <nl> # include " modules / planning / scenarios / traffic_light / unprotected_right_turn / traffic_light_unprotected_right_turn_scenario . h " <nl> + # include " modules / planning / scenarios / yield_sign / yield_sign_scenario . h " <nl> # include " modules / planning / scenarios / util / util . h " <nl> <nl> namespace apollo { <nl> std : : unique_ptr < Scenario > ScenarioManager : : CreateScenario ( <nl> ptr . reset ( new scenario : : valet_parking : : ValetParkingScenario ( <nl> config_map_ [ scenario_type ] , & scenario_context_ ) ) ; <nl> break ; <nl> + case ScenarioConfig : : YIELD_SIGN : <nl> + ptr . reset ( new scenario : : yield_sign : : YieldSignScenario ( <nl> + config_map_ [ scenario_type ] , & scenario_context_ ) ) ; <nl> + break ; <nl> default : <nl> return nullptr ; <nl> } <nl> void ScenarioManager : : RegisterScenarios ( ) { <nl> / / valet parking <nl> CHECK ( Scenario : : LoadConfig ( FLAGS_scenario_valet_parking_config_file , <nl> & config_map_ [ ScenarioConfig : : VALET_PARKING ] ) ) ; <nl> + <nl> + / / yield_sign <nl> + CHECK ( Scenario : : LoadConfig ( FLAGS_scenario_yield_sign_config_file , <nl> + & config_map_ [ ScenarioConfig : : YIELD_SIGN ] ) ) ; <nl> } <nl> <nl> ScenarioConfig : : ScenarioType ScenarioManager : : SelectChangeLaneScenario ( <nl> ScenarioConfig : : ScenarioType ScenarioManager : : SelectTrafficLightScenario ( <nl> <nl> ScenarioConfig : : ScenarioType ScenarioManager : : SelectYieldSignScenario ( <nl> const Frame & frame , const hdmap : : PathOverlap & yield_sign_overlap ) { <nl> - / / TODO ( all ) <nl> - return current_scenario_ - > scenario_type ( ) ; <nl> + const auto & scenario_config = <nl> + config_map_ [ ScenarioConfig : : YIELD_SIGN ] . yield_sign_config ( ) ; <nl> + <nl> + const auto & reference_line_info = frame . reference_line_info ( ) . front ( ) ; <nl> + const double adc_front_edge_s = reference_line_info . AdcSlBoundary ( ) . end_s ( ) ; <nl> + const double adc_distance_to_yield_sign = <nl> + yield_sign_overlap . start_s - adc_front_edge_s ; <nl> + ADEBUG < < " adc_distance_to_yield_sign [ " < < adc_distance_to_yield_sign <nl> + < < " ] yield_sign [ " < < yield_sign_overlap . object_id <nl> + < < " ] yield_sign_overlap_start_s [ " < < yield_sign_overlap . start_s < < " ] " ; <nl> + <nl> + const bool yield_sign_scenario = <nl> + ( adc_distance_to_yield_sign > 0 . 0 & & <nl> + adc_distance_to_yield_sign < = <nl> + scenario_config . start_yield_sign_scenario_distance ( ) ) ; <nl> + <nl> + switch ( current_scenario_ - > scenario_type ( ) ) { <nl> + case ScenarioConfig : : LANE_FOLLOW : <nl> + case ScenarioConfig : : CHANGE_LANE : <nl> + case ScenarioConfig : : PARK_AND_GO : <nl> + case ScenarioConfig : : PULL_OVER : <nl> + if ( yield_sign_scenario ) { <nl> + return ScenarioConfig : : YIELD_SIGN ; <nl> + } <nl> + break ; <nl> + case ScenarioConfig : : BARE_INTERSECTION_UNPROTECTED : <nl> + case ScenarioConfig : : STOP_SIGN_PROTECTED : <nl> + case ScenarioConfig : : STOP_SIGN_UNPROTECTED : <nl> + case ScenarioConfig : : TRAFFIC_LIGHT_PROTECTED : <nl> + case ScenarioConfig : : TRAFFIC_LIGHT_UNPROTECTED_LEFT_TURN : <nl> + case ScenarioConfig : : TRAFFIC_LIGHT_UNPROTECTED_RIGHT_TURN : <nl> + case ScenarioConfig : : YIELD_SIGN : <nl> + case ScenarioConfig : : VALET_PARKING : <nl> + if ( current_scenario_ - > GetStatus ( ) ! = <nl> + Scenario : : ScenarioStatus : : STATUS_DONE ) { <nl> + return current_scenario_ - > scenario_type ( ) ; <nl> + } <nl> + break ; <nl> + default : <nl> + break ; <nl> + } <nl> + <nl> + return default_scenario_type_ ; <nl> } <nl> <nl> ScenarioConfig : : ScenarioType ScenarioManager : : SelectBareIntersectionScenario ( <nl> void ScenarioManager : : ScenarioDispatch ( const common : : TrajectoryPoint & ego_point , <nl> } <nl> break ; <nl> case ReferenceLineInfo : : YIELD_SIGN : <nl> - / / TODO ( all ) : to be added <nl> - / / scenario_type = SelectYieldSignScenario ( <nl> - / / frame , * traffic_sign_overlap ) ; <nl> + if ( FLAGS_enable_scenario_yield_sign ) { <nl> + scenario_type = <nl> + SelectYieldSignScenario ( frame , * traffic_sign_overlap ) ; <nl> + } <nl> break ; <nl> default : <nl> break ; <nl> bool ScenarioManager : : IsTrafficLightScenario ( <nl> scenario_type = = ScenarioConfig : : TRAFFIC_LIGHT_UNPROTECTED_RIGHT_TURN ) ; <nl> } <nl> <nl> + bool ScenarioManager : : IsYieldSignScenario ( <nl> + const ScenarioConfig : : ScenarioType & scenario_type ) { <nl> + return ( scenario_type = = ScenarioConfig : : YIELD_SIGN ) ; <nl> + } <nl> + <nl> void ScenarioManager : : UpdatePlanningContext ( <nl> const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) { <nl> / / BareIntersection scenario <nl> void ScenarioManager : : UpdatePlanningContext ( <nl> <nl> / / PullOver scenario <nl> UpdatePlanningContextPullOverScenario ( frame , scenario_type ) ; <nl> + <nl> + / / YieldSign scenario <nl> + UpdatePlanningContextYieldSignScenario ( frame , scenario_type ) ; <nl> } <nl> <nl> / / update : bare_intersection status in PlanningContext <nl> void ScenarioManager : : UpdatePlanningContextTrafficLightScenario ( <nl> } <nl> } <nl> <nl> + / / update : yield_sign status in PlanningContext <nl> + void ScenarioManager : : UpdatePlanningContextYieldSignScenario ( <nl> + const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) { <nl> + if ( ! IsYieldSignScenario ( scenario_type ) ) { <nl> + PlanningContext : : Instance ( ) <nl> + - > mutable_planning_status ( ) <nl> + - > mutable_yield_sign ( ) <nl> + - > Clear ( ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( scenario_type = = current_scenario_ - > scenario_type ( ) ) { <nl> + return ; <nl> + } <nl> + <nl> + / / set to first_encountered stop_sign <nl> + const auto map_itr = <nl> + first_encountered_overlap_map_ . find ( ReferenceLineInfo : : YIELD_SIGN ) ; <nl> + if ( map_itr ! = first_encountered_overlap_map_ . end ( ) ) { <nl> + PlanningContext : : Instance ( ) <nl> + - > mutable_planning_status ( ) <nl> + - > mutable_yield_sign ( ) <nl> + - > set_current_yield_sign_overlap_id ( map_itr - > second . object_id ) ; <nl> + ADEBUG < < " Update PlanningContext with first_encountered yield sign [ " <nl> + < < map_itr - > second . object_id < < " ] start_s [ " <nl> + < < map_itr - > second . start_s < < " ] " ; <nl> + } <nl> + } <nl> + <nl> / / update : pull_over status in PlanningContext <nl> void ScenarioManager : : UpdatePlanningContextPullOverScenario ( <nl> const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) { <nl> mmm a / modules / planning / scenarios / scenario_manager . h <nl> ppp b / modules / planning / scenarios / scenario_manager . h <nl> class ScenarioManager final { <nl> bool IsStopSignScenario ( const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> bool IsTrafficLightScenario ( <nl> const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> + bool IsYieldSignScenario ( const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> <nl> void UpdatePlanningContext ( const Frame & frame , <nl> const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> class ScenarioManager final { <nl> void UpdatePlanningContextTrafficLightScenario ( <nl> const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> <nl> + void UpdatePlanningContextYieldSignScenario ( <nl> + const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> + <nl> void UpdatePlanningContextPullOverScenario ( <nl> const Frame & frame , const ScenarioConfig : : ScenarioType & scenario_type ) ; <nl> <nl>
planning : update ScenarioManager for YIELD_SIGN
ApolloAuto/apollo
b78fcbabbb925ba1531ae6084a5c52cf15e80572
2019-08-22T19:53:29Z
mmm a / src / Interpreters / executeQuery . cpp <nl> ppp b / src / Interpreters / executeQuery . cpp <nl> void executeQuery ( <nl> } ) ; <nl> <nl> auto out = context . getOutputFormatProcessor ( format_name , * out_buf , pipeline . getHeader ( ) ) ; <nl> + out - > setAutoFlush ( ) ; <nl> <nl> / / / Save previous progress callback if any . TODO Do it more conveniently . <nl> auto previous_progress_callback = context . getProgressCallback ( ) ; <nl> mmm a / src / Processors / Formats / IOutputFormat . cpp <nl> ppp b / src / Processors / Formats / IOutputFormat . cpp <nl> void IOutputFormat : : work ( ) <nl> break ; <nl> } <nl> <nl> + if ( auto_flush ) <nl> + flush ( ) ; <nl> + <nl> has_input = false ; <nl> } <nl> <nl> mmm a / src / Processors / Formats / IOutputFormat . h <nl> ppp b / src / Processors / Formats / IOutputFormat . h <nl> class IOutputFormat : public IProcessor <nl> bool finished = false ; <nl> bool finalized = false ; <nl> <nl> + / / / Flush data on each consumed chunk . This is intented for interactive applications to output data as soon as it ' s ready . <nl> + bool auto_flush = false ; <nl> + <nl> RowsBeforeLimitCounterPtr rows_before_limit_counter ; <nl> <nl> virtual void consume ( Chunk ) = 0 ; <nl> class IOutputFormat : public IProcessor <nl> / / / Flush output buffers if any . <nl> virtual void flush ( ) ; <nl> <nl> + void setAutoFlush ( ) { auto_flush = true ; } <nl> + <nl> / / / Value for rows_before_limit_at_least field . <nl> virtual void setRowsBeforeLimit ( size_t / * rows_before_limit * / ) { } <nl> <nl>
Flush output for interactive applications
ClickHouse/ClickHouse
5262512f0c4c3a825b455ebbec5d85081af4853f
2020-04-19T19:02:36Z
mmm a / src / system / classes / reflection . php <nl> ppp b / src / system / classes / reflection . php <nl> public function getProperty ( $ name ) { <nl> * <nl> * @ return mixed An array of ReflectionProperty objects . <nl> * / <nl> - public function getProperties ( ) { <nl> + public function getProperties ( $ filter = 0xFFFF ) { <nl> $ ret = array ( ) ; <nl> foreach ( $ this - > fetch ( ' properties ' ) as $ name = > $ _ ) { <nl> - $ ret [ ] = $ this - > getProperty ( $ name ) ; <nl> + $ p = $ this - > getProperty ( $ name ) ; <nl> + if ( ( $ filter & ReflectionProperty : : IS_PUBLIC ) & & $ p - > isPublic ( ) | | <nl> + ( $ filter & ReflectionProperty : : IS_PROTECTED ) & & $ p - > isProtected ( ) | | <nl> + ( $ filter & ReflectionProperty : : IS_PRIVATE ) & & $ p - > isPrivate ( ) | | <nl> + ( $ filter & ReflectionProperty : : IS_STATIC ) & & $ p - > isStatic ( ) ) { <nl> + $ ret [ ] = $ p ; <nl> + } <nl> } <nl> return $ ret ; <nl> } <nl> mmm a / src / system / gen / cls / ReflectionClass . h <nl> ppp b / src / system / gen / cls / ReflectionClass . h <nl> class c_ReflectionClass : public ExtObjectData { <nl> public : p_ReflectionMethod t_getmethod ( CVarRef v_name ) ; <nl> public : Array t_getmethods ( CVarRef v_filter = 65535LL ) ; <nl> public : p_ReflectionProperty t_getproperty ( CVarRef v_name ) ; <nl> - public : Array t_getproperties ( ) ; <nl> + public : Array t_getproperties ( CVarRef v_filter = 65535LL ) ; <nl> public : Variant t_getconstants ( ) ; <nl> public : Variant t_getconstant ( CVarRef v_name ) ; <nl> public : Array t_getinterfaces ( ) ; <nl> mmm a / src / system / gen / cls / ReflectionExtension . h <nl> ppp b / src / system / gen / cls / ReflectionExtension . h <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - / * SRC : classes / reflection . php line 1826 * / <nl> + / * SRC : classes / reflection . php line 1832 * / <nl> FORWARD_DECLARE_CLASS ( ReflectionExtension ) ; <nl> class c_ReflectionExtension : public ExtObjectData { <nl> public : <nl> mmm a / src / system / gen / cls / ReflectionMethod . h <nl> ppp b / src / system / gen / cls / ReflectionMethod . h <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - / * SRC : classes / reflection . php line 1564 * / <nl> + / * SRC : classes / reflection . php line 1570 * / <nl> FORWARD_DECLARE_CLASS ( ReflectionMethod ) ; <nl> class c_ReflectionMethod : public c_ReflectionFunctionAbstract { <nl> public : <nl> mmm a / src / system / gen / cls / ReflectionObject . h <nl> ppp b / src / system / gen / cls / ReflectionObject . h <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - / * SRC : classes / reflection . php line 1274 * / <nl> + / * SRC : classes / reflection . php line 1280 * / <nl> FORWARD_DECLARE_CLASS ( ReflectionObject ) ; <nl> class c_ReflectionObject : public c_ReflectionClass { <nl> public : <nl> mmm a / src / system / gen / cls / ReflectionProperty . h <nl> ppp b / src / system / gen / cls / ReflectionProperty . h <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - / * SRC : classes / reflection . php line 1312 * / <nl> + / * SRC : classes / reflection . php line 1318 * / <nl> FORWARD_DECLARE_CLASS ( ReflectionProperty ) ; <nl> class c_ReflectionProperty : public ExtObjectData { <nl> public : <nl> mmm a / src / system / gen / php / classes / reflection . cpp <nl> ppp b / src / system / gen / php / classes / reflection . cpp <nl> int64 c_ReflectionFunctionAbstract : : t_getnumberofrequiredparameters ( ) { <nl> return v_count ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1274 * / <nl> + / * SRC : classes / reflection . php line 1280 * / <nl> # ifndef OMIT_JUMP_TABLE_CLASS_STATIC_GETINIT_ReflectionObject <nl> Variant c_ReflectionObject : : os_getInit ( CStrRef s ) { <nl> return c_ReflectionClass : : os_getInit ( s ) ; <nl> struct ObjectStaticCallbacks cw_ReflectionObject = { <nl> void c_ReflectionObject : : init ( ) { <nl> c_ReflectionClass : : init ( ) ; <nl> } <nl> - / * SRC : classes / reflection . php line 1291 * / <nl> + / * SRC : classes / reflection . php line 1297 * / <nl> Variant c_ReflectionObject : : ti_export ( CStrRef cls , Variant v_obj , CVarRef v_ret ) { <nl> STATIC_METHOD_INJECTION_BUILTIN ( ReflectionObject , ReflectionObject : : export ) ; <nl> String v_str ; <nl> Variant c_ReflectionClass : : o_invoke_from_eval ( const char * s , Eval : : VariableEnvir <nl> break ; <nl> case 68 : <nl> HASH_GUARD_LITSTR ( 0x1EB679C3602F4B44LL , NAMSTR ( s_sys_ss7ace3627 , " getProperties " ) ) { <nl> + Variant a0 ; <nl> const std : : vector < Eval : : ExpressionPtr > & params = caller - > params ( ) ; <nl> unsigned int i = 0 ; <nl> do { <nl> + if ( i = = params . size ( ) ) break ; <nl> + a0 = params [ i ] - > eval ( env ) ; <nl> + i + + ; <nl> } while ( false ) ; <nl> for ( ; i ! = params . size ( ) ; + + i ) { <nl> params [ i ] - > eval ( env ) ; <nl> } <nl> int count __attribute__ ( ( __unused__ ) ) = params . size ( ) ; <nl> - if ( count > 0 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 0 , 1 ) ; <nl> - return ( t_getproperties ( ) ) ; <nl> + if ( count > 1 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 1 , 1 ) ; <nl> + if ( count < = 0 ) return ( t_getproperties ( ) ) ; <nl> + else return ( t_getproperties ( a0 ) ) ; <nl> } <nl> break ; <nl> case 71 : <nl> CallInfo c_ReflectionClass : : ci___construct ( ( void * ) & c_ReflectionClass : : i___constr <nl> CallInfo c_ReflectionClass : : ci_isfinal ( ( void * ) & c_ReflectionClass : : i_isfinal , ( void * ) & c_ReflectionClass : : ifa_isfinal , 0 , 4 , 0x0000000000000000LL ) ; <nl> CallInfo c_ReflectionClass : : ci_getmodifiers ( ( void * ) & c_ReflectionClass : : i_getmodifiers , ( void * ) & c_ReflectionClass : : ifa_getmodifiers , 0 , 4 , 0x0000000000000000LL ) ; <nl> CallInfo c_ReflectionClass : : ci_export ( ( void * ) & c_ReflectionClass : : i_export , ( void * ) & c_ReflectionClass : : ifa_export , 2 , 12 , 0x0000000000000000LL ) ; <nl> - CallInfo c_ReflectionClass : : ci_getproperties ( ( void * ) & c_ReflectionClass : : i_getproperties , ( void * ) & c_ReflectionClass : : ifa_getproperties , 0 , 4 , 0x0000000000000000LL ) ; <nl> + CallInfo c_ReflectionClass : : ci_getproperties ( ( void * ) & c_ReflectionClass : : i_getproperties , ( void * ) & c_ReflectionClass : : ifa_getproperties , 1 , 4 , 0x0000000000000000LL ) ; <nl> CallInfo c_ReflectionClass : : ci_hasconstant ( ( void * ) & c_ReflectionClass : : i_hasconstant , ( void * ) & c_ReflectionClass : : ifa_hasconstant , 1 , 4 , 0x0000000000000000LL ) ; <nl> CallInfo c_ReflectionClass : : ci_getmethod ( ( void * ) & c_ReflectionClass : : i_getmethod , ( void * ) & c_ReflectionClass : : ifa_getmethod , 1 , 4 , 0x0000000000000000LL ) ; <nl> CallInfo c_ReflectionClass : : ci_getextensionname ( ( void * ) & c_ReflectionClass : : i_getextensionname , ( void * ) & c_ReflectionClass : : ifa_getextensionname , 0 , 4 , 0x0000000000000000LL ) ; <nl> Variant c_ReflectionClass : : i_getproperties ( MethodCallPackage & mcp , CArrRef param <nl> } else { <nl> self = createDummy ( pobj ) ; <nl> } <nl> - if ( count > 0 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 0 , 1 ) ; <nl> - return ( self - > t_getproperties ( ) ) ; <nl> + if ( count > 1 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 1 , 1 ) ; <nl> + { <nl> + ArrayData * ad ( params . get ( ) ) ; <nl> + ssize_t pos = ad ? ad - > iter_begin ( ) : ArrayData : : invalid_index ; <nl> + if ( count < = 0 ) return ( self - > t_getproperties ( ) ) ; <nl> + CVarRef arg0 ( ( ad - > getValue ( pos ) ) ) ; <nl> + return ( self - > t_getproperties ( arg0 ) ) ; <nl> + } <nl> } <nl> Variant c_ReflectionClass : : i_hasconstant ( MethodCallPackage & mcp , CArrRef params ) { <nl> int count __attribute__ ( ( __unused__ ) ) = params . size ( ) ; <nl> Variant c_ReflectionClass : : ifa_getproperties ( MethodCallPackage & mcp , int count , <nl> } else { <nl> self = createDummy ( pobj ) ; <nl> } <nl> - if ( count > 0 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 0 , 1 ) ; <nl> - return ( self - > t_getproperties ( ) ) ; <nl> + if ( count > 1 ) return throw_toomany_arguments ( " ReflectionClass : : getProperties " , 1 , 1 ) ; <nl> + if ( count < = 0 ) return ( self - > t_getproperties ( ) ) ; <nl> + CVarRef arg0 ( ( a0 ) ) ; <nl> + return ( self - > t_getproperties ( arg0 ) ) ; <nl> } <nl> Variant c_ReflectionClass : : ifa_hasconstant ( MethodCallPackage & mcp , int count , INVOKE_FEW_ARGS_IMPL_ARGS ) { <nl> c_ReflectionClass * self = NULL ; <nl> p_ReflectionProperty c_ReflectionClass : : t_getproperty ( CVarRef v_name ) { <nl> } <nl> namespace hphp_impl_splitter { } <nl> / * SRC : classes / reflection . php line 892 * / <nl> - Array c_ReflectionClass : : t_getproperties ( ) { <nl> + Array c_ReflectionClass : : t_getproperties ( CVarRef v_filter / / = 65535LL <nl> + ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getProperties ) ; <nl> Array v_ret ; <nl> Primitive v_name = 0 ; <nl> Variant v__ ; <nl> + p_ReflectionProperty v_p ; <nl> <nl> v_ret = s_sys_sa00000000 ; <nl> { <nl> Array c_ReflectionClass : : t_getproperties ( ) { <nl> { <nl> { <nl> const p_ReflectionProperty & tmp0 ( ( t_getproperty ( v_name ) ) ) ; <nl> - v_ret . append ( ( tmp0 ) ) ; <nl> + v_p = tmp0 ; <nl> + } <nl> + if ( ( ( ( ( toBoolean ( bitwise_and ( v_filter , 256LL / * ReflectionProperty : : IS_PUBLIC * / ) ) & & v_p - > t_ispublic ( ) ) | | ( toBoolean ( bitwise_and ( v_filter , 512LL / * ReflectionProperty : : IS_PROTECTED * / ) ) & & v_p - > t_isprotected ( ) ) ) | | ( toBoolean ( bitwise_and ( v_filter , 1024LL / * ReflectionProperty : : IS_PRIVATE * / ) ) & & v_p - > t_isprivate ( ) ) ) | | ( toBoolean ( bitwise_and ( v_filter , 1LL / * ReflectionProperty : : IS_STATIC * / ) ) & & toBoolean ( v_p - > t_isstatic ( ) ) ) ) ) { <nl> + { <nl> + v_ret . append ( ( v_p ) ) ; <nl> + } <nl> } <nl> } <nl> } <nl> Array c_ReflectionClass : : t_getproperties ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 910 * / <nl> + / * SRC : classes / reflection . php line 916 * / <nl> Variant c_ReflectionClass : : t_getconstants ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getConstants ) ; <nl> return t_fetch ( NAMSTR ( s_sys_ss623ae369 , " constants " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 924 * / <nl> + / * SRC : classes / reflection . php line 930 * / <nl> Variant c_ReflectionClass : : t_getconstant ( CVarRef v_name ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getConstant ) ; <nl> Variant v_constants ; <nl> Variant c_ReflectionClass : : t_getconstant ( CVarRef v_name ) { <nl> return v_constants . rvalAt ( v_name , AccessFlags : : Error ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 944 * / <nl> + / * SRC : classes / reflection . php line 950 * / <nl> Array c_ReflectionClass : : t_getinterfaces ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getInterfaces ) ; <nl> Array v_ret ; <nl> Array c_ReflectionClass : : t_getinterfaces ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 965 * / <nl> + / * SRC : classes / reflection . php line 971 * / <nl> Array c_ReflectionClass : : t_getinterfacenames ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getInterfaceNames ) ; <nl> Array v_ret ; <nl> Array c_ReflectionClass : : t_getinterfacenames ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 986 * / <nl> + / * SRC : classes / reflection . php line 992 * / <nl> Variant c_ReflectionClass : : t_isinterface ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isInterface ) ; <nl> return t_fetch ( NAMSTR ( s_sys_ss7228e959 , " interface " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 998 * / <nl> + / * SRC : classes / reflection . php line 1004 * / <nl> Variant c_ReflectionClass : : t_isabstract ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isAbstract ) ; <nl> return t_fetch ( NAMSTR ( s_sys_ss12c8a8a6 , " abstract " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1010 * / <nl> + / * SRC : classes / reflection . php line 1016 * / <nl> Variant c_ReflectionClass : : t_isfinal ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isFinal ) ; <nl> return t_fetch ( NAMSTR ( s_sys_ss2145036e , " final " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1023 * / <nl> + / * SRC : classes / reflection . php line 1029 * / <nl> Variant c_ReflectionClass : : t_getmodifiers ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getModifiers ) ; <nl> return t_fetch ( NAMSTR ( s_sys_ss9f244c80 , " modifiers " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1037 * / <nl> + / * SRC : classes / reflection . php line 1043 * / <nl> bool c_ReflectionClass : : t_isinstance ( CVarRef v_obj ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isInstance ) ; <nl> return x_hphp_instanceof ( toObject ( v_obj ) , toString ( m_name ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1050 * / <nl> + / * SRC : classes / reflection . php line 1056 * / <nl> Object c_ReflectionClass : : t_newinstance ( int num_args , Array args / * = Array ( ) * / ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : newInstance ) ; <nl> Array v_args ; <nl> Object c_ReflectionClass : : t_newinstance ( int num_args , Array args / * = Array ( ) * / <nl> return x_hphp_create_object ( toString ( m_name ) , v_args ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1069 * / <nl> + / * SRC : classes / reflection . php line 1075 * / <nl> Object c_ReflectionClass : : t_newinstanceargs ( CVarRef v_args ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : newInstanceArgs ) ; <nl> { <nl> Object c_ReflectionClass : : t_newinstanceargs ( CVarRef v_args ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1083 * / <nl> + / * SRC : classes / reflection . php line 1089 * / <nl> Variant c_ReflectionClass : : t_getparentclass ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getParentClass ) ; <nl> { <nl> Variant c_ReflectionClass : : t_getparentclass ( ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1101 * / <nl> + / * SRC : classes / reflection . php line 1107 * / <nl> Variant c_ReflectionClass : : t_issubclassof ( Variant v_cls ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isSubclassOf ) ; <nl> Primitive v_name = 0 ; <nl> Variant c_ReflectionClass : : t_issubclassof ( Variant v_cls ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1129 * / <nl> + / * SRC : classes / reflection . php line 1135 * / <nl> Array c_ReflectionClass : : t_getstaticproperties ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getStaticProperties ) ; <nl> Array v_ret ; <nl> Array c_ReflectionClass : : t_getstaticproperties ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1150 * / <nl> + / * SRC : classes / reflection . php line 1156 * / <nl> Variant c_ReflectionClass : : t_getstaticpropertyvalue ( CVarRef v_name , CVarRef v_default / / = null_variant <nl> ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getStaticPropertyValue ) ; <nl> Variant c_ReflectionClass : : t_getstaticpropertyvalue ( CVarRef v_name , CVarRef v_de <nl> return v_default ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1171 * / <nl> + / * SRC : classes / reflection . php line 1177 * / <nl> void c_ReflectionClass : : t_setstaticpropertyvalue ( CVarRef v_name , CVarRef v_value ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : setStaticPropertyValue ) ; <nl> x_hphp_set_static_property ( toString ( m_name ) , toString ( v_name ) , v_value ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1185 * / <nl> + / * SRC : classes / reflection . php line 1191 * / <nl> Array c_ReflectionClass : : t_getdefaultproperties ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getDefaultProperties ) ; <nl> Array v_ret ; <nl> Array c_ReflectionClass : : t_getdefaultproperties ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1204 * / <nl> + / * SRC : classes / reflection . php line 1210 * / <nl> Variant c_ReflectionClass : : t_isiterateable ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : isIterateable ) ; <nl> return t_issubclassof ( NAMSTR ( s_sys_ss92306c9b , " ArrayAccess " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1219 * / <nl> + / * SRC : classes / reflection . php line 1225 * / <nl> bool c_ReflectionClass : : t_implementsinterface ( Variant v_cls ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : implementsInterface ) ; <nl> p_ReflectionClass v_clsObj ; <nl> bool c_ReflectionClass : : t_implementsinterface ( Variant v_cls ) { <nl> return false ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1245 * / <nl> + / * SRC : classes / reflection . php line 1251 * / <nl> Variant c_ReflectionClass : : t_getextension ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getExtension ) ; <nl> return t_fetch ( NAMSTR ( s_sys_sse9bf4500 , " extension " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1259 * / <nl> + / * SRC : classes / reflection . php line 1265 * / <nl> Variant c_ReflectionClass : : t_getextensionname ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionClass , ReflectionClass : : getExtensionName ) ; <nl> { <nl> Variant c_ReflectionClass : : t_getextensionname ( ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1826 * / <nl> + / * SRC : classes / reflection . php line 1832 * / <nl> # ifndef OMIT_JUMP_TABLE_CLASS_STATIC_GETINIT_ReflectionExtension <nl> Variant c_ReflectionExtension : : os_getInit ( CStrRef s ) { <nl> DECLARE_SYSTEM_GLOBALS ( g ) ; <nl> void c_ReflectionExtension : : init ( ) { <nl> m_name = null ; <nl> m_info = null ; <nl> } <nl> - / * SRC : classes / reflection . php line 1830 * / <nl> + / * SRC : classes / reflection . php line 1836 * / <nl> void c_ReflectionExtension : : t___construct ( Variant v_name ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : __construct ) ; <nl> bool oldInCtor = gasInCtor ( true ) ; <nl> void c_ReflectionExtension : : t___construct ( Variant v_name ) { <nl> gasInCtor ( oldInCtor ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1834 * / <nl> + / * SRC : classes / reflection . php line 1840 * / <nl> String c_ReflectionExtension : : t___tostring ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : __toString ) ; <nl> return toString ( null ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1853 * / <nl> + / * SRC : classes / reflection . php line 1859 * / <nl> Variant c_ReflectionExtension : : ti_export ( CStrRef cls , CVarRef v_name , CVarRef v_ret ) { <nl> STATIC_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : export ) ; <nl> p_ReflectionExtension v_obj ; <nl> Variant c_ReflectionExtension : : ti_export ( CStrRef cls , CVarRef v_name , CVarRef v_ <nl> return null ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1871 * / <nl> + / * SRC : classes / reflection . php line 1877 * / <nl> Variant c_ReflectionExtension : : t_getname ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getName ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ssdc3cbddc , " name " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1884 * / <nl> + / * SRC : classes / reflection . php line 1890 * / <nl> Variant c_ReflectionExtension : : t_getversion ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getVersion ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss7cd91db4 , " version " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1900 * / <nl> + / * SRC : classes / reflection . php line 1906 * / <nl> Variant c_ReflectionExtension : : t_getfunctions ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getFunctions ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ssc8396b02 , " functions " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1913 * / <nl> + / * SRC : classes / reflection . php line 1919 * / <nl> Variant c_ReflectionExtension : : t_getconstants ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getConstants ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss623ae369 , " constants " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1927 * / <nl> + / * SRC : classes / reflection . php line 1933 * / <nl> Variant c_ReflectionExtension : : t_getinientries ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getINIEntries ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_sscedef5dc , " ini " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1942 * / <nl> + / * SRC : classes / reflection . php line 1948 * / <nl> Variant c_ReflectionExtension : : t_getclasses ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getClasses ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss0415e4a0 , " classes " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1957 * / <nl> + / * SRC : classes / reflection . php line 1963 * / <nl> Array c_ReflectionExtension : : t_getclassnames ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : getClassNames ) ; <nl> Array v_ret ; <nl> Array c_ReflectionExtension : : t_getclassnames ( ) { <nl> return v_ret ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1973 * / <nl> + / * SRC : classes / reflection . php line 1979 * / <nl> Variant c_ReflectionExtension : : t_info ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionExtension , ReflectionExtension : : info ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss33988b3e , " info " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1564 * / <nl> + / * SRC : classes / reflection . php line 1570 * / <nl> const int64 q_ReflectionMethod_IS_STATIC = 1LL ; <nl> const int64 q_ReflectionMethod_IS_PUBLIC = 256LL ; <nl> const int64 q_ReflectionMethod_IS_PROTECTED = 512LL ; <nl> void c_ReflectionMethod : : init ( ) { <nl> m_name = null ; <nl> m_class = null ; <nl> } <nl> - / * SRC : classes / reflection . php line 1576 * / <nl> + / * SRC : classes / reflection . php line 1582 * / <nl> void c_ReflectionMethod : : t___construct ( Variant v_cls , Variant v_name / / = NAMSTR ( s_sys_ss00000000 , " " ) <nl> ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : __construct ) ; <nl> void c_ReflectionMethod : : t___construct ( Variant v_cls , Variant v_name / / = NAMST <nl> gasInCtor ( oldInCtor ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1599 * / <nl> + / * SRC : classes / reflection . php line 1605 * / <nl> String c_ReflectionMethod : : t___tostring ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : __toString ) ; <nl> return toString ( null ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1620 * / <nl> + / * SRC : classes / reflection . php line 1626 * / <nl> Variant c_ReflectionMethod : : ti_export ( CStrRef cls , Variant v_cls , CVarRef v_name , CVarRef v_ret ) { <nl> STATIC_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : export ) ; <nl> Variant v_obj ; <nl> Variant c_ReflectionMethod : : ti_export ( CStrRef cls , Variant v_cls , CVarRef v_name <nl> return null ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1645 * / <nl> + / * SRC : classes / reflection . php line 1651 * / <nl> Variant c_ReflectionMethod : : t_invoke ( int num_args , CVarRef v_obj , Array args / * = Array ( ) * / ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : invoke ) ; <nl> Variant v_args ; <nl> Variant c_ReflectionMethod : : t_invoke ( int num_args , CVarRef v_obj , Array args / * <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1666 * / <nl> + / * SRC : classes / reflection . php line 1672 * / <nl> Variant c_ReflectionMethod : : t_invokeargs ( CVarRef v_obj , CVarRef v_args ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : invokeArgs ) ; <nl> { <nl> Variant c_ReflectionMethod : : t_invokeargs ( CVarRef v_obj , CVarRef v_args ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1679 * / <nl> + / * SRC : classes / reflection . php line 1685 * / <nl> Variant c_ReflectionMethod : : t_isfinal ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isFinal ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss2145036e , " final " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1692 * / <nl> + / * SRC : classes / reflection . php line 1698 * / <nl> Variant c_ReflectionMethod : : t_isabstract ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isAbstract ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss12c8a8a6 , " abstract " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1704 * / <nl> + / * SRC : classes / reflection . php line 1710 * / <nl> bool c_ReflectionMethod : : t_ispublic ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isPublic ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_ss4ce85288 , " public " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1717 * / <nl> + / * SRC : classes / reflection . php line 1723 * / <nl> bool c_ReflectionMethod : : t_isprivate ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isPrivate ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_sse781f7da , " private " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1730 * / <nl> + / * SRC : classes / reflection . php line 1736 * / <nl> bool c_ReflectionMethod : : t_isprotected ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isProtected ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_ss9fb56979 , " protected " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1742 * / <nl> + / * SRC : classes / reflection . php line 1748 * / <nl> Variant c_ReflectionMethod : : t_isstatic ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isStatic ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ssf08d205d , " static " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1755 * / <nl> + / * SRC : classes / reflection . php line 1761 * / <nl> bool c_ReflectionMethod : : t_isconstructor ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isConstructor ) ; <nl> return isset ( m_info , NAMSTR ( s_sys_ssefecb9dd , " constructor " ) , true ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1768 * / <nl> + / * SRC : classes / reflection . php line 1774 * / <nl> bool c_ReflectionMethod : : t_isdestructor ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : isDestructor ) ; <nl> { <nl> bool c_ReflectionMethod : : t_isdestructor ( ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1790 * / <nl> + / * SRC : classes / reflection . php line 1796 * / <nl> Variant c_ReflectionMethod : : t_getmodifiers ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : getModifiers ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss9f244c80 , " modifiers " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1794 * / <nl> + / * SRC : classes / reflection . php line 1800 * / <nl> Variant c_ReflectionMethod : : t_getclosure ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : getClosure ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss4cd61020 , " closure " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1808 * / <nl> + / * SRC : classes / reflection . php line 1814 * / <nl> Variant c_ReflectionMethod : : t_getdeclaringclass ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionMethod , ReflectionMethod : : getDeclaringClass ) ; <nl> if ( empty ( m_info , NAMSTR ( s_sys_ssc82dbd12 , " class " ) , true ) ) { <nl> Variant c_ReflectionMethod : : t_getdeclaringclass ( ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1312 * / <nl> + / * SRC : classes / reflection . php line 1318 * / <nl> const int64 q_ReflectionProperty_IS_STATIC = 1LL ; <nl> const int64 q_ReflectionProperty_IS_PUBLIC = 256LL ; <nl> const int64 q_ReflectionProperty_IS_PROTECTED = 512LL ; <nl> void c_ReflectionProperty : : init ( ) { <nl> m_name = null ; <nl> m_class = null ; <nl> } <nl> - / * SRC : classes / reflection . php line 1322 * / <nl> + / * SRC : classes / reflection . php line 1328 * / <nl> void c_ReflectionProperty : : t___construct ( Variant v_cls , Variant v_name ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : __construct ) ; <nl> bool oldInCtor = gasInCtor ( true ) ; <nl> void c_ReflectionProperty : : t___construct ( Variant v_cls , Variant v_name ) { <nl> gasInCtor ( oldInCtor ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1338 * / <nl> + / * SRC : classes / reflection . php line 1344 * / <nl> String c_ReflectionProperty : : t___tostring ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : __toString ) ; <nl> return toString ( null ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1354 * / <nl> + / * SRC : classes / reflection . php line 1360 * / <nl> Variant c_ReflectionProperty : : ti_export ( CStrRef cls , Variant v_cls , CVarRef v_name , CVarRef v_ret ) { <nl> STATIC_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : export ) ; <nl> Variant v_obj ; <nl> Variant c_ReflectionProperty : : ti_export ( CStrRef cls , Variant v_cls , CVarRef v_na <nl> return null ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1377 * / <nl> + / * SRC : classes / reflection . php line 1383 * / <nl> Variant c_ReflectionProperty : : t_getname ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : getName ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ssdc3cbddc , " name " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1390 * / <nl> + / * SRC : classes / reflection . php line 1396 * / <nl> bool c_ReflectionProperty : : t_ispublic ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : isPublic ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_ss4ce85288 , " public " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1403 * / <nl> + / * SRC : classes / reflection . php line 1409 * / <nl> bool c_ReflectionProperty : : t_isprivate ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : isPrivate ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_sse781f7da , " private " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1416 * / <nl> + / * SRC : classes / reflection . php line 1422 * / <nl> bool c_ReflectionProperty : : t_isprotected ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : isProtected ) ; <nl> return equal ( m_info . rvalAt ( NAMSTR ( s_sys_ss750cda3b , " access " ) , AccessFlags : : Error_Key ) , NAMSTR ( s_sys_ss9fb56979 , " protected " ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1429 * / <nl> + / * SRC : classes / reflection . php line 1435 * / <nl> Variant c_ReflectionProperty : : t_isstatic ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : isStatic ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ssf08d205d , " static " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1443 * / <nl> + / * SRC : classes / reflection . php line 1449 * / <nl> Variant c_ReflectionProperty : : t_isdefault ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : isDefault ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss570270cc , " default " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1457 * / <nl> + / * SRC : classes / reflection . php line 1463 * / <nl> void c_ReflectionProperty : : t_setaccessible ( CVarRef v_accessible ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : setAccessible ) ; <nl> throw_exception ( p_ReflectionException ( ( NEWOBJ ( c_ReflectionException ) ( ) ) - > create ( NAMSTR ( s_sys_ssf82f565f , " ReflectionProperty : : setAccessible is not supported " ) ) ) ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1471 * / <nl> + / * SRC : classes / reflection . php line 1477 * / <nl> Variant c_ReflectionProperty : : t_getmodifiers ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : getModifiers ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss9f244c80 , " modifiers " ) , AccessFlags : : Error_Key ) ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1487 * / <nl> + / * SRC : classes / reflection . php line 1493 * / <nl> Variant c_ReflectionProperty : : t_getvalue ( CVarRef v_obj / / = null_variant <nl> ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : getValue ) ; <nl> Variant c_ReflectionProperty : : t_getvalue ( CVarRef v_obj / / = null_variant <nl> return null ; <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1512 * / <nl> + / * SRC : classes / reflection . php line 1518 * / <nl> void c_ReflectionProperty : : t_setvalue ( CVarRef v_obj , CVarRef v_value ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : setValue ) ; <nl> if ( toBoolean ( t_isstatic ( ) ) ) { <nl> void c_ReflectionProperty : : t_setvalue ( CVarRef v_obj , CVarRef v_value ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1532 * / <nl> + / * SRC : classes / reflection . php line 1538 * / <nl> Variant c_ReflectionProperty : : t_getdeclaringclass ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : getDeclaringClass ) ; <nl> if ( empty ( m_info , NAMSTR ( s_sys_ssc82dbd12 , " class " ) , true ) ) { <nl> Variant c_ReflectionProperty : : t_getdeclaringclass ( ) { <nl> } <nl> } <nl> namespace hphp_impl_splitter { } <nl> - / * SRC : classes / reflection . php line 1549 * / <nl> + / * SRC : classes / reflection . php line 1555 * / <nl> Variant c_ReflectionProperty : : t_getdoccomment ( ) { <nl> INSTANCE_METHOD_INJECTION_BUILTIN ( ReflectionProperty , ReflectionProperty : : getDocComment ) ; <nl> return m_info . rvalAt ( NAMSTR ( s_sys_ss9cfa17a6 , " doc " ) , AccessFlags : : Error_Key ) ; <nl> mmm a / src / test / test_code_run . cpp <nl> ppp b / src / test / test_code_run . cpp <nl> bool TestCodeRun : : TestReflectionClasses ( ) { <nl> " $ inter = new ReflectionClass ( ' B ' ) ; " <nl> " var_dump ( $ inter - > hasMethod ( ' foo ' ) ) ; " ) ; <nl> <nl> + MVCR ( " < ? php \ n " <nl> + " class A { private $ a ; protected $ b ; public $ c ; static $ d ; } \ n " <nl> + " function f ( $ a ) { foreach ( $ a as $ v ) { var_dump ( $ v - > getName ( ) ) ; } } \ n " <nl> + " $ r = new ReflectionClass ( ' A ' ) ; \ n " <nl> + " $ a = $ r - > getProperties ( ) ; f ( $ a ) ; \ n " <nl> + " $ a = $ r - > getProperties ( ReflectionProperty : : IS_PUBLIC ) ; f ( $ a ) ; \ n " <nl> + " $ a = $ r - > getProperties ( ReflectionProperty : : IS_PRIVATE ) ; f ( $ a ) ; \ n " <nl> + " $ a = $ r - > getProperties ( ReflectionProperty : : IS_PROTECTED ) ; f ( $ a ) ; \ n " <nl> + " $ a = $ r - > getProperties ( ReflectionProperty : : IS_STATIC ) ; f ( $ a ) ; \ n " ) ; <nl> + <nl> return true ; <nl> } <nl> <nl>
Add the $ filter pramater to ReflectionClass : : getProperties ( )
facebook/hhvm
f8d1ebe52f7e5374a160a2ef5d7be447ce30b389
2011-02-23T23:26:49Z
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> <nl> + v1 . 1 . 2 ( XXXX - XX - XX ) <nl> + mmmmmmmmmmmmmmmmmm - <nl> + <nl> + * fixed issue # 328 : 1 . 1 compile warnings <nl> + <nl> + <nl> v1 . 1 . 1 ( 2012 - 12 - 18 ) <nl> mmmmmmmmmmmmmmmmmm - <nl> <nl> mmm a / lib / Scheduler / SchedulerLibev . cpp <nl> ppp b / lib / Scheduler / SchedulerLibev . cpp <nl> void SchedulerLibev : : rearmTimer ( EventToken token , double timeout ) { <nl> void * SchedulerLibev : : lookupWatcher ( EventToken token ) { <nl> SCHEDULER_LOCK ( & _watcherLock ) ; <nl> <nl> - if ( token > = _watchers . size ( ) ) { <nl> + if ( token > = ( EventToken ) _watchers . size ( ) ) { <nl> SCHEDULER_UNLOCK ( & _watcherLock ) ; <nl> return 0 ; <nl> } <nl> void * SchedulerLibev : : lookupWatcher ( EventToken token ) { <nl> void * SchedulerLibev : : lookupWatcher ( EventToken token , EventType & type ) { <nl> SCHEDULER_LOCK ( & _watcherLock ) ; <nl> <nl> - if ( token > = _watchers . size ( ) ) { <nl> + if ( token > = ( EventToken ) _watchers . size ( ) ) { <nl> SCHEDULER_UNLOCK ( & _watcherLock ) ; <nl> return 0 ; <nl> } <nl> mmm a / lib / Scheduler / TaskManager . cpp <nl> ppp b / lib / Scheduler / TaskManager . cpp <nl> void TaskManager : : deleteTask ( Task * task ) { <nl> <nl> void TaskManager : : setupTask ( Task * task , Scheduler * scheduler , EventLoop loop ) { <nl> string name = task - > getName ( ) ; <nl> - bool ok ; <nl> - ok = task - > setup ( scheduler , loop ) ; <nl> - / / todo : respond when not ok <nl> + bool ok = task - > setup ( scheduler , loop ) ; <nl> + / / TODO : respond when not ok <nl> + ( void ) ok ; <nl> } <nl> <nl> <nl>
fixed compile warnings
arangodb/arangodb
8699262625fb79781f4e79621d43afd32db11e8d
2012-12-20T16:12:22Z
mmm a / ios / LibTorch . podspec <nl> ppp b / ios / LibTorch . podspec <nl> <nl> Pod : : Spec . new do | s | <nl> s . name = ' LibTorch ' <nl> - s . version = ' 0 . 0 . 3 ' <nl> + s . version = ' 1 . 3 . 0 ' <nl> s . authors = ' PyTorch Team ' <nl> s . license = { : type = > ' BSD ' } <nl> s . homepage = ' https : / / github . com / pytorch / pytorch ' <nl> - s . source = { : http = > ' https : / / ossci - ios - build . s3 . amazonaws . com / libtorch_ios_nightly_build . zip ' } <nl> + s . source = { : http = > " https : / / ossci - ios . s3 . amazonaws . com / libtorch_ios_ # { s . version } . zip " } <nl> s . summary = ' The PyTorch C + + library for iOS ' <nl> s . description = < < - DESC <nl> The PyTorch C + + library for iOS . <nl> mmm a / ios / README . md <nl> ppp b / ios / README . md <nl> <nl> - # # LibTorch <nl> <nl> - The PyTorch C + + static library for iOS . <nl> + # # PyTorch for iOS <nl> <nl> - ( Detailed documentation will be added soon ) <nl> \ No newline at end of file <nl> + # # # Cocoapods Developers <nl> + <nl> + PyTorch is now available via Cocoapods , to integrate it to your project , simply add the following line to your ` Podfile ` and run ` pod install ` <nl> + <nl> + ` ` ` ruby <nl> + pod ' LibTorch ' <nl> + ` ` ` <nl> + <nl> + # # # Import the library <nl> + <nl> + For Objective - C developers , simply import the umbrella header <nl> + <nl> + ` ` ` <nl> + # import < LibTorch / LibTorch . h > <nl> + ` ` ` <nl> + <nl> + For Swift developers , you need to create an Objective - C class as a bridge to call the C + + APIs . We highly recommend you to follow the [ Image Classification ] ( https : / / github . com / pytorch / examples ) demo where you can find out how C + + , Objective - C and Swift work together . <nl> + <nl> + # # # Disable Bitcode <nl> + <nl> + Since PyTorch is not yet built with bitcode support , you need to disable bitcode for your target by selecting the * * Build Settings * * , searching for * * Enable Bitcode * * and set the value to * * No * * . <nl> + <nl> + # # LICENSE <nl> + <nl> + PyTorch is BSD - style licensed , as found in the LICENSE file . <nl> \ No newline at end of file <nl>
Prepare for Cocoapods 1 . 3 Release ( )
pytorch/pytorch
f7742d2b21c580119ffa06f039ff17c1245a7b0e
2019-09-25T19:16:06Z
new file mode 100644 <nl> index 0000000000 . . d130092dcf <nl> mmm / dev / null <nl> ppp b / code / online_challenges / src / project_euler / problem_020 / README . md <nl> <nl> + # Project Euler Problem 20 : Factorial digit sum <nl> + <nl> + ( [ Problem Link ] ( https : / / projecteuler . net / problem = 20 ) ) <nl> + <nl> + n ! means n × ( n − 1 ) × . . . × 3 × 2 × 1 <nl> + <nl> + For example , 10 ! = 10 × 9 × . . . × 3 × 2 × 1 = 3628800 , <nl> + and the sum of the digits in the number 10 ! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27 . <nl> + <nl> + Find the sum of the digits in the number 100 ! <nl> + <nl> + mmm <nl> + <nl> + < p align = " center " > <nl> + A massive collaborative effort by < a href = " https : / / github . com / OpenGenus / cosmos " > OpenGenus Foundation < / a > <nl> + < / p > <nl> + <nl> + mmm <nl>
Create README . md
OpenGenus/cosmos
2b84783eae23bc102d264d1baf0c88ec9b4df384
2018-03-01T10:48:05Z
mmm a / Marlin / src / lcd / tft / ili9341 . h <nl> ppp b / Marlin / src / lcd / tft / ili9341 . h <nl> <nl> # define ILI9341_ORIENTATION_LEFT ILI9341_MADCTL_MY | ILI9341_MADCTL_MX | ILI9341_MADCTL_MV / / 320x240 ; Cable on the left side <nl> # define ILI9341_ORIENTATION_DOWN ILI9341_MADCTL_MX / / 240x320 ; Cable on the upper side <nl> <nl> - # define ILI9341_COLOR_BGR <nl> - # define ILI9341_ORIENTATION ILI9341_ORIENTATION_LEFT <nl> + # ifndef ILI9341_COLOR_RGB <nl> + # define ILI9341_COLOR_BGR <nl> + # endif <nl> + # ifndef ILI9341_ORIENTATION <nl> + # define ILI9341_ORIENTATION ILI9341_ORIENTATION_LEFT <nl> + # endif <nl> # define ILI9341_MADCTL_DATA ( ILI9341_ORIENTATION | TERN ( ILI9341_COLOR_BGR , ILI9341_MADCTL_BGR , ILI9341_MADCTL_RGB ) ) <nl> <nl> # define ILI9341_NOP 0x00 / / No Operation <nl> mmm a / Marlin / src / lcd / tft / ili9488 . h <nl> ppp b / Marlin / src / lcd / tft / ili9488 . h <nl> <nl> # define ILI9488_ORIENTATION_LEFT ILI9488_MADCTL_MY | ILI9488_MADCTL_MX | ILI9488_MADCTL_MV / / 480x320 ; Cable on the left side <nl> # define ILI9488_ORIENTATION_DOWN ILI9488_MADCTL_MX / / 320x480 ; Cable on the upper side <nl> <nl> - # define ILI9488_COLOR_BGR <nl> + # ifndef ILI9488_COLOR_RGB <nl> + # define ILI9488_COLOR_BGR <nl> + # endif <nl> # ifndef ILI9488_ORIENTATION <nl> # define ILI9488_ORIENTATION ILI9488_ORIENTATION_LEFT <nl> # endif <nl> mmm a / Marlin / src / pins / stm32f1 / pins_MKS_ROBIN_MINI . h <nl> ppp b / Marlin / src / pins / stm32f1 / pins_MKS_ROBIN_MINI . h <nl> <nl> # pragma once <nl> <nl> / * * <nl> - * MKS Robin MINI ( STM32F130VET6 ) board pin assignments <nl> + * MKS Robin mini ( STM32F130VET6 ) board pin assignments <nl> * / <nl> <nl> # ifndef __STM32F1__ <nl> # error " Oops ! Select an STM32F1 board in ' Tools > Board . ' " <nl> # elif HOTENDS > 1 | | E_STEPPERS > 1 <nl> - # error " MKS Robin mini supports up to 1 hotends / E - steppers . Comment out this line to continue . " <nl> + # error " MKS Robin mini only supports 1 hotend / E - stepper . Comment out this line to continue . " <nl> # endif <nl> <nl> - # define BOARD_INFO_NAME " MKS Robin mini " <nl> + # define BOARD_INFO_NAME " MKS Robin Mini " <nl> <nl> / / <nl> / / Release PB4 ( Y_ENABLE_PIN ) from JTAG NRST role <nl> / / <nl> # define DISABLE_DEBUG <nl> <nl> + / / <nl> + / / EEPROM <nl> + / / <nl> # if EITHER ( NO_EEPROM_SELECTED , FLASH_EEPROM_EMULATION ) <nl> # define FLASH_EEPROM_EMULATION <nl> - / / 2K in a AT24C16N <nl> - # define EEPROM_PAGE_SIZE ( 0x800U ) / / 2KB <nl> - # define EEPROM_START_ADDRESS ( 0x8000000UL + ( STM32_FLASH_SIZE ) * 1024UL - ( EEPROM_PAGE_SIZE ) * 2UL ) <nl> + # define EEPROM_PAGE_SIZE ( 0x800U ) / / 2KB <nl> + # define EEPROM_START_ADDRESS ( 0x8000000UL + ( STM32_FLASH_SIZE ) * 1024UL - ( EEPROM_PAGE_SIZE ) * 2UL ) <nl> # define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE / / 2KB <nl> # endif <nl> <nl> - / / <nl> - / / Note : MKS Robin mini board is using SPI2 interface . <nl> - / / <nl> - # define SPI_MODULE 2 <nl> + # define ENABLE_SPI2 <nl> <nl> / / <nl> / / Limit Switches <nl> <nl> # define E0_STEP_PIN PD6 <nl> # define E0_DIR_PIN PD3 <nl> <nl> + <nl> + / / Motor current PWM pins <nl> + # define MOTOR_CURRENT_PWM_XY_PIN PA6 <nl> + # define MOTOR_CURRENT_PWM_Z_PIN PA7 <nl> + # define MOTOR_CURRENT_PWM_E_PIN PB0 <nl> + # define MOTOR_CURRENT_PWM_RANGE 1500 / / ( 255 * ( 1000mA / 65535 ) ) * 257 = 1000 is equal 1 . 6v Vref in turn equal 1Amp <nl> + # ifndef DEFAULT_PWM_MOTOR_CURRENT <nl> + # define DEFAULT_PWM_MOTOR_CURRENT { 800 , 800 , 800 } <nl> + # endif <nl> / / <nl> / / Temperature Sensors <nl> / / <nl> <nl> / / <nl> / / Heaters / Fans <nl> / / <nl> - # define HEATER_0_PIN PC3 / / HEATER1 <nl> - # define HEATER_BED_PIN PA0 / / HOT BED <nl> + # define HEATER_0_PIN PC3 <nl> + # define HEATER_BED_PIN PA0 <nl> <nl> # define FAN_PIN PB1 / / FAN <nl> <nl> - / / <nl> - / / Thermocouples <nl> - / / <nl> - / / # define MAX6675_SS_PIN PE5 / / TC1 - CS1 <nl> - / / # define MAX6675_SS_PIN PE6 / / TC2 - CS2 <nl> - <nl> / / <nl> / / Misc . Functions <nl> / / <nl> # define POWER_LOSS_PIN PA2 / / PW_DET <nl> # define PS_ON_PIN PA3 / / PW_OFF <nl> <nl> - / / # define LED_PIN PB2 <nl> + # define SERVO0_PIN PA8 / / Enable BLTOUCH support on IO0 ( WIFI connector ) <nl> + <nl> + # define MT_DET_1_PIN PA4 <nl> + # define MT_DET_PIN_INVERTING false <nl> + <nl> + # define WIFI_IO0_PIN PC13 <nl> + <nl> + / / <nl> + / / SD Card <nl> + / / <nl> + # ifndef SDCARD_CONNECTION <nl> + # define SDCARD_CONNECTION ONBOARD <nl> + # endif <nl> + <nl> + # define SDIO_SUPPORT <nl> + # define SDIO_CLOCK 4500000 / / 4 . 5 MHz <nl> + # define SD_DETECT_PIN PD12 <nl> + # define ONBOARD_SD_CS_PIN PC11 <nl> <nl> / / <nl> / / LCD / Controller <nl> / / <nl> # define BEEPER_PIN PC5 <nl> - # define SD_DETECT_PIN PD12 <nl> <nl> / * * <nl> * Note : MKS Robin TFT screens use various TFT controllers . <nl> * If the screen stays white , disable ' LCD_RESET_PIN ' <nl> * to let the bootloader init the screen . <nl> * / <nl> + # define XPT2046_X_CALIBRATION 12033 <nl> + # define XPT2046_Y_CALIBRATION - 9047 <nl> + # define XPT2046_X_OFFSET - 30 <nl> + # define XPT2046_Y_OFFSET 254 <nl> + <nl> # if ENABLED ( FSMC_GRAPHICAL_TFT ) <nl> + <nl> # define FSMC_CS_PIN PD7 / / NE4 <nl> # define FSMC_RS_PIN PD11 / / A0 <nl> <nl> - # define LCD_RESET_PIN PC6 <nl> + # define LCD_USE_DMA_FSMC / / Use DMA transfers to send data to the TFT <nl> + # define FSMC_DMA_DEV DMA2 <nl> + # define FSMC_DMA_CHANNEL DMA_CH5 <nl> + <nl> + # define LCD_RESET_PIN PC6 / / FSMC_RST <nl> # define LCD_BACKLIGHT_PIN PD13 <nl> <nl> # if NEED_TOUCH_PINS <nl> - # define TOUCH_CS_PIN PC2 <nl> - # define TOUCH_SCK_PIN PB13 <nl> - # define TOUCH_MOSI_PIN PB15 <nl> - # define TOUCH_MISO_PIN PB14 <nl> + # define TOUCH_CS_PIN PC2 / / SPI2_NSS <nl> + # define TOUCH_SCK_PIN PB13 / / SPI2_SCK <nl> + # define TOUCH_MISO_PIN PB14 / / SPI2_MISO <nl> + # define TOUCH_MOSI_PIN PB15 / / SPI2_MOSI <nl> # endif <nl> + <nl> + # elif ENABLED ( TFT_320x240 ) / / TFT32 / 28 <nl> + <nl> + # define TFT_RESET_PIN PC6 <nl> + # define TFT_BACKLIGHT_PIN PD13 <nl> + <nl> + # define LCD_USE_DMA_FSMC / / Use DMA transfers to send data to the TFT <nl> + # define FSMC_CS_PIN PD7 <nl> + # define FSMC_RS_PIN PD11 <nl> + # define FSMC_DMA_DEV DMA2 <nl> + # define FSMC_DMA_CHANNEL DMA_CH5 <nl> + <nl> + # define TOUCH_CS_PIN PC2 / / SPI2_NSS <nl> + # define TOUCH_SCK_PIN PB13 / / SPI2_SCK <nl> + # define TOUCH_MISO_PIN PB14 / / SPI2_MISO <nl> + # define TOUCH_MOSI_PIN PB15 / / SPI2_MOSI <nl> + <nl> + # define TFT_DRIVER ILI9341 <nl> + # define TFT_BUFFER_SIZE 14400 <nl> + <nl> + / / YV for normal screen mounting <nl> + # define ILI9341_ORIENTATION ILI9341_MADCTL_MY | ILI9341_MADCTL_MV <nl> + / / XV for 180 ° rotated screen mounting <nl> + / / # define ILI9341_ORIENTATION ILI9341_MADCTL_MX | ILI9341_MADCTL_MV <nl> + <nl> + # define ILI9341_COLOR_RGB <nl> # endif <nl> <nl> - / / Motor current PWM pins <nl> - # define MOTOR_CURRENT_PWM_XY_PIN PA6 <nl> - # define MOTOR_CURRENT_PWM_Z_PIN PA7 <nl> - # define MOTOR_CURRENT_PWM_E_PIN PB0 <nl> - # define MOTOR_CURRENT_PWM_RANGE 1500 / / ( 255 * ( 1000mA / 65535 ) ) * 257 = 1000 is equal 1 . 6v Vref in turn equal 1Amp <nl> - # define DEFAULT_PWM_MOTOR_CURRENT { 1030 , 1030 , 1030 } / / 1 . 05Amp per driver , here is XY , Z and E . This values determined empirically . <nl> - <nl> - / / This is a kind of workaround in case native marlin " digipot " interface won ' t work . <nl> - / / Required to enable related code in STM32F1 / HAL . cpp <nl> - / / # ifndef MKS_ROBIN_MINI_VREF_PWM <nl> - / / # define MKS_ROBIN_MINI_VREF_PWM <nl> - / / # endif <nl> - <nl> - / / # define VREF_XY_PIN PA6 <nl> - / / # define VREF_Z_PIN PA7 <nl> - / / # define VREF_E1_PIN PB0 <nl> + # define HAS_SPI_FLASH 1 <nl> + # define SPI_FLASH_SIZE 0x1000000 / / 16MB <nl> + # if HAS_SPI_FLASH <nl> + # define W25QXX_CS_PIN PB12 / / Flash chip - select <nl> + # define W25QXX_MOSI_PIN PB15 <nl> + # define W25QXX_MISO_PIN PB14 <nl> + # define W25QXX_SCK_PIN PB13 <nl> + # endif <nl>
MKS Robin new 320x240 TFT Color UI support ( )
MarlinFirmware/Marlin
b14f630f26b95cd08ef047ba1a83cfb6dc2a537e
2020-08-11T01:21:48Z
mmm a / Marlin / src / Marlin . cpp <nl> ppp b / Marlin / src / Marlin . cpp <nl> <nl> <nl> # include " Marlin . h " <nl> <nl> + # include " core / utility . h " <nl> # include " lcd / ultralcd . h " <nl> # include " module / motion . h " <nl> # include " module / planner . h " <nl> mmm a / Marlin / src / core / utility . cpp <nl> ppp b / Marlin / src / core / utility . cpp <nl> void safe_delay ( millis_t ms ) { <nl> # define RJDIGIT ( n , f ) ( ( n ) > = ( f ) ? DIGIMOD ( n , f ) : ' ' ) <nl> # define MINUSOR ( n , alt ) ( n > = 0 ? ( alt ) : ( n = - n , ' - ' ) ) <nl> <nl> + / / Convert a full - range unsigned 8bit int to a percentage <nl> + char * ui8tostr_percent ( const uint8_t i ) { <nl> + const uint16_t percent = 100 * i / 255 ; <nl> + conv [ 3 ] = RJDIGIT ( percent , 100 ) ; <nl> + conv [ 4 ] = RJDIGIT ( percent , 10 ) ; <nl> + conv [ 5 ] = DIGIMOD ( percent , 1 ) ; <nl> + conv [ 6 ] = ' % ' ; <nl> + return & conv [ 3 ] ; <nl> + } <nl> + <nl> / / Convert unsigned 8bit int to string 123 format <nl> char * ui8tostr3 ( const uint8_t i ) { <nl> conv [ 4 ] = RJDIGIT ( i , 100 ) ; <nl> mmm a / Marlin / src / core / utility . h <nl> ppp b / Marlin / src / core / utility . h <nl> inline void serial_delay ( const millis_t ms ) { <nl> <nl> # if ANY ( ULTRA_LCD , DEBUG_LEVELING_FEATURE , EXTENSIBLE_UI ) <nl> <nl> + / / Convert a full - range unsigned 8bit int to a percentage <nl> + char * ui8tostr_percent ( const uint8_t i ) ; <nl> + <nl> / / Convert uint8_t to string with 123 format <nl> char * ui8tostr3 ( const uint8_t x ) ; <nl> <nl> class restorer { <nl> <nl> # define REMEMBER ( N , X , . . . ) restorer < typeof ( X ) > restorer_ # # N ( X , # # __VA_ARGS__ ) <nl> # define RESTORE ( N ) restorer_ # # N . restore ( ) <nl> + <nl> + / / Converts from an uint8_t in the range of 0 - 255 to an uint8_t <nl> + / / in the range 0 - 100 while avoiding rounding artifacts <nl> + constexpr uint8_t ui8_to_percent ( const uint8_t i ) { return ( int ( i ) * 100 + 127 ) / 255 ; } <nl> + constexpr uint8_t all_on = 0xFF , all_off = 0x00 ; <nl> mmm a / Marlin / src / gcode / calibrate / G425 . cpp <nl> ppp b / Marlin / src / gcode / calibrate / G425 . cpp <nl> <nl> # define HAS_Y_CENTER BOTH ( CALIBRATION_MEASURE_FRONT , CALIBRATION_MEASURE_BACK ) <nl> <nl> # if ENABLED ( BACKLASH_GCODE ) <nl> - extern float backlash_distance_mm [ ] , backlash_correction , backlash_smoothing_mm ; <nl> + extern float backlash_distance_mm [ ] , backlash_smoothing_mm ; <nl> + extern uint8_t backlash_correction ; <nl> # endif <nl> <nl> enum side_t : uint8_t { TOP , RIGHT , FRONT , LEFT , BACK , NUM_SIDES } ; <nl> inline void calibrate_backlash ( measurements_t & m , const float uncertainty ) { <nl> <nl> { <nl> / / New scope for TEMPORARY_BACKLASH_CORRECTION <nl> - TEMPORARY_BACKLASH_CORRECTION ( 0 . 0f ) ; <nl> + TEMPORARY_BACKLASH_CORRECTION ( all_off ) ; <nl> TEMPORARY_BACKLASH_SMOOTHING ( 0 . 0f ) ; <nl> <nl> probe_sides ( m , uncertainty ) ; <nl> inline void calibrate_backlash ( measurements_t & m , const float uncertainty ) { <nl> <nl> { <nl> / / New scope for TEMPORARY_BACKLASH_CORRECTION <nl> - TEMPORARY_BACKLASH_CORRECTION ( 1 . 0f ) ; <nl> + TEMPORARY_BACKLASH_CORRECTION ( all_on ) ; <nl> TEMPORARY_BACKLASH_SMOOTHING ( 0 . 0f ) ; <nl> move_to ( <nl> X_AXIS , current_position [ X_AXIS ] + 3 , <nl> inline void update_measurements ( measurements_t & m , const AxisEnum axis ) { <nl> * - Call calibrate_backlash ( ) beforehand for best accuracy <nl> * / <nl> inline void calibrate_toolhead ( measurements_t & m , const float uncertainty , const uint8_t extruder ) { <nl> - TEMPORARY_BACKLASH_CORRECTION ( 1 . 0f ) ; <nl> + TEMPORARY_BACKLASH_CORRECTION ( all_on ) ; <nl> TEMPORARY_BACKLASH_SMOOTHING ( 0 . 0f ) ; <nl> <nl> # if HOTENDS > 1 <nl> inline void calibrate_toolhead ( measurements_t & m , const float uncertainty , const <nl> * uncertainty in - How far away from the object to begin probing <nl> * / <nl> inline void calibrate_all_toolheads ( measurements_t & m , const float uncertainty ) { <nl> - TEMPORARY_BACKLASH_CORRECTION ( 1 . 0f ) ; <nl> + TEMPORARY_BACKLASH_CORRECTION ( all_on ) ; <nl> TEMPORARY_BACKLASH_SMOOTHING ( 0 . 0f ) ; <nl> <nl> HOTEND_LOOP ( ) calibrate_toolhead ( m , uncertainty , e ) ; <nl> inline void calibrate_all ( ) { <nl> reset_hotend_offsets ( ) ; <nl> # endif <nl> <nl> - TEMPORARY_BACKLASH_CORRECTION ( 1 . 0f ) ; <nl> + TEMPORARY_BACKLASH_CORRECTION ( all_on ) ; <nl> TEMPORARY_BACKLASH_SMOOTHING ( 0 . 0f ) ; <nl> <nl> / / Do a fast and rough calibration of the toolheads <nl> mmm a / Marlin / src / gcode / calibrate / M425 . cpp <nl> ppp b / Marlin / src / gcode / calibrate / M425 . cpp <nl> <nl> <nl> # include " . . / . . / module / planner . h " <nl> <nl> - float backlash_distance_mm [ XYZ ] = BACKLASH_DISTANCE_MM , <nl> - backlash_correction = BACKLASH_CORRECTION ; <nl> + float backlash_distance_mm [ XYZ ] = BACKLASH_DISTANCE_MM ; <nl> + uint8_t backlash_correction = BACKLASH_CORRECTION * all_on ; <nl> <nl> # ifdef BACKLASH_SMOOTHING_MM <nl> float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM ; <nl> void GcodeSuite : : M425 ( ) { <nl> <nl> if ( parser . seen ( ' F ' ) ) { <nl> planner . synchronize ( ) ; <nl> - backlash_correction = MAX ( 0 , MIN ( 1 . 0 , parser . value_linear_units ( ) ) ) ; <nl> + backlash_correction = MAX ( 0 , MIN ( 1 . 0 , parser . value_float ( ) ) ) * all_on ; <nl> noArgs = false ; <nl> } <nl> <nl> void GcodeSuite : : M425 ( ) { <nl> SERIAL_ECHOPGM ( " Backlash correction is " ) ; <nl> if ( ! backlash_correction ) SERIAL_ECHOPGM ( " in " ) ; <nl> SERIAL_ECHOLNPGM ( " active : " ) ; <nl> - SERIAL_ECHOPAIR ( " Correction Amount / Fade - out : F " , backlash_correction ) ; <nl> - SERIAL_ECHOLNPGM ( " ( F1 . 0 = full , F0 . 0 = none ) " ) ; <nl> + SERIAL_ECHOLNPAIR ( " Correction Amount / Fade - out : F " , float ( ui8_to_percent ( backlash_correction ) ) / 100 , " ( F1 . 0 = full , F0 . 0 = none ) " ) ; <nl> SERIAL_ECHOPGM ( " Backlash Distance ( mm ) : " ) ; <nl> LOOP_XYZ ( a ) { <nl> SERIAL_CHAR ( ' ' ) ; <nl> mmm a / Marlin / src / lcd / extensible_ui / ui_api . cpp <nl> ppp b / Marlin / src / lcd / extensible_ui / ui_api . cpp <nl> <nl> # include " ui_api . h " <nl> <nl> # if ENABLED ( BACKLASH_GCODE ) <nl> - extern float backlash_distance_mm [ XYZ ] , backlash_correction ; <nl> + extern float backlash_distance_mm [ XYZ ] ; <nl> + extern uint8_t backlash_correction ; <nl> # ifdef BACKLASH_SMOOTHING_MM <nl> extern float backlash_smoothing_mm ; <nl> # endif <nl> namespace ExtUI { <nl> void setAxisBacklash_mm ( const float value , const axis_t axis ) <nl> { backlash_distance_mm [ axis ] = clamp ( value , 0 , 5 ) ; } <nl> <nl> - float getBacklashCorrection_percent ( ) { return backlash_correction * 100 ; } <nl> - void setBacklashCorrection_percent ( const float value ) { backlash_correction = clamp ( value , 0 , 100 ) / 100 . 0f ; } <nl> + float getBacklashCorrection_percent ( ) { return ui8_to_percent ( backlash_correction ) ; } <nl> + void setBacklashCorrection_percent ( const float value ) { backlash_correction = map ( clamp ( value , 0 , 100 ) , 0 , 100 , 0 , 255 ) ; } <nl> <nl> # ifdef BACKLASH_SMOOTHING_MM <nl> float getBacklashSmoothing_mm ( ) { return backlash_smoothing_mm ; } <nl> mmm a / Marlin / src / lcd / language / language_en . h <nl> ppp b / Marlin / src / lcd / language / language_en . h <nl> <nl> # ifndef MSG_SERVICE_IN <nl> # define MSG_SERVICE_IN _UxGT ( " in : " ) <nl> # endif <nl> + <nl> + # ifndef MSG_BACKLASH <nl> + # define MSG_BACKLASH _UxGT ( " Backlash " ) <nl> + # endif <nl> + # ifndef MSG_BACKLASH_CORRECTION <nl> + # define MSG_BACKLASH_CORRECTION _UxGT ( " Correction " ) <nl> + # endif <nl> + # ifndef MSG_BACKLASH_SMOOTHING <nl> + # define MSG_BACKLASH_SMOOTHING _UxGT ( " Smoothing " ) <nl> + # endif <nl> mmm a / Marlin / src / lcd / menu / menu . h <nl> ppp b / Marlin / src / lcd / menu / menu . h <nl> bool printer_busy ( ) ; <nl> static inline char * strfunc ( const float value ) { return STRFUNC ( ( TYPE ) value ) ; } \ <nl> } ; <nl> <nl> + DECLARE_MENU_EDIT_TYPE ( uint8_t , percent , ui8tostr_percent , 1 ) ; / / 100 % right - justified <nl> DECLARE_MENU_EDIT_TYPE ( int16_t , int3 , i16tostr3 , 1 ) ; / / 123 , - 12 right - justified <nl> DECLARE_MENU_EDIT_TYPE ( int16_t , int4 , i16tostr4sign , 1 ) ; / / 1234 , - 123 right - justified <nl> DECLARE_MENU_EDIT_TYPE ( int8_t , int8 , i8tostr3 , 1 ) ; / / 123 , - 12 right - justified <nl> FORCE_INLINE void draw_menu_item_edit_P ( const bool sel , const uint8_t row , PGM_P <nl> typedef void NAME # # _void <nl> # define DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( NAME ) _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( MenuItemInfo_ # # NAME : : type_t , NAME , MenuItemInfo_ # # NAME : : strfunc ) <nl> <nl> + DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( percent ) ; / / 100 % right - justified <nl> DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( int3 ) ; / / 123 , - 12 right - justified <nl> DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( int4 ) ; / / 1234 , - 123 right - justified <nl> DEFINE_DRAW_MENU_ITEM_SETTING_EDIT ( int8 ) ; / / 123 , - 12 right - justified <nl> class TMenuItem : MenuItemBase { <nl> <nl> # define DECLARE_MENU_EDIT_ITEM ( NAME ) typedef TMenuItem < MenuItemInfo_ # # NAME > MenuItem_ # # NAME ; <nl> <nl> + DECLARE_MENU_EDIT_ITEM ( percent ) ; <nl> DECLARE_MENU_EDIT_ITEM ( int3 ) ; <nl> DECLARE_MENU_EDIT_ITEM ( int4 ) ; <nl> DECLARE_MENU_EDIT_ITEM ( int8 ) ; <nl> mmm a / Marlin / src / lcd / menu / menu_advanced . cpp <nl> ppp b / Marlin / src / lcd / menu / menu_advanced . cpp <nl> <nl> # endif <nl> <nl> void menu_tmc ( ) ; <nl> + void menu_backlash ( ) ; <nl> <nl> # if ENABLED ( DAC_STEPPER_CURRENT ) <nl> <nl> void menu_advanced_settings ( ) { <nl> } <nl> # endif / / ! SLIM_LCD_MENUS <nl> <nl> + # if ENABLED ( BACKLASH_GCODE ) <nl> + MENU_ITEM ( submenu , MSG_BACKLASH , menu_backlash ) ; <nl> + # endif <nl> + <nl> # if ENABLED ( DAC_STEPPER_CURRENT ) <nl> MENU_ITEM ( submenu , MSG_DRIVE_STRENGTH , menu_dac ) ; <nl> # endif <nl> new file mode 100644 <nl> index 00000000000 . . 1b183e10632 <nl> mmm / dev / null <nl> ppp b / Marlin / src / lcd / menu / menu_backlash . cpp <nl> <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( C ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * Based on Sprinter and grbl . <nl> + * Copyright ( C ) 2011 Camiel Gubbels / Erik van der Zalm <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + / / <nl> + / / Backlash Menu <nl> + / / <nl> + <nl> + # include " . . / . . / inc / MarlinConfigPre . h " <nl> + <nl> + # if HAS_LCD_MENU & & ENABLED ( BACKLASH_GCODE ) <nl> + <nl> + # include " menu . h " <nl> + <nl> + extern float backlash_distance_mm [ XYZ ] ; <nl> + extern uint8_t backlash_correction ; <nl> + <nl> + # ifdef BACKLASH_SMOOTHING_MM <nl> + extern float backlash_smoothing_mm ; <nl> + # endif <nl> + <nl> + void menu_backlash ( ) { <nl> + START_MENU ( ) ; <nl> + MENU_BACK ( MSG_MAIN ) ; <nl> + <nl> + MENU_MULTIPLIER_ITEM_EDIT ( percent , MSG_BACKLASH_CORRECTION , & backlash_correction , all_off , all_on ) ; <nl> + <nl> + # define EDIT_BACKLASH_DISTANCE ( N ) MENU_MULTIPLIER_ITEM_EDIT ( float43 , MSG_ # # N , & backlash_distance_mm [ _AXIS ( N ) ] , 0 . 0f , 9 . 9f ) ; <nl> + EDIT_BACKLASH_DISTANCE ( A ) ; <nl> + EDIT_BACKLASH_DISTANCE ( B ) ; <nl> + EDIT_BACKLASH_DISTANCE ( C ) ; <nl> + <nl> + # ifdef BACKLASH_SMOOTHING_MM <nl> + MENU_MULTIPLIER_ITEM_EDIT ( float43 , MSG_BACKLASH_SMOOTHING , & backlash_smoothing_mm , 0 . 0f , 9 . 9f ) ; <nl> + # endif <nl> + <nl> + END_MENU ( ) ; <nl> + } <nl> + <nl> + # endif / / HAS_LCD_MENU & & BACKLASH_COMPENSATION <nl> mmm a / Marlin / src / lcd / menu / menu_temperature . cpp <nl> ppp b / Marlin / src / lcd / menu / menu_temperature . cpp <nl> void menu_temperature ( ) { <nl> / / <nl> # if FAN_COUNT > 0 <nl> # if HAS_FAN0 <nl> - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( uint8 , MSG_FAN_SPEED FAN_SPEED_1_SUFFIX , & thermalManager . lcd_tmpfan_speed [ 0 ] , 0 , 255 , thermalManager . lcd_setFanSpeed0 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( percent , MSG_FAN_SPEED FAN_SPEED_1_SUFFIX , & thermalManager . lcd_tmpfan_speed [ 0 ] , 0 , 255 , thermalManager . lcd_setFanSpeed0 ) ; <nl> # if ENABLED ( EXTRA_FAN_SPEED ) <nl> - MENU_MULTIPLIER_ITEM_EDIT ( uint8 , MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX , & thermalManager . new_fan_speed [ 0 ] , 3 , 255 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT ( percent , MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX , & thermalManager . new_fan_speed [ 0 ] , 3 , 255 ) ; <nl> # endif <nl> # endif <nl> # if HAS_FAN1 | | ( ENABLED ( SINGLENOZZLE ) & & EXTRUDERS > 1 ) <nl> - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( uint8 , MSG_FAN_SPEED " 2 " , & thermalManager . lcd_tmpfan_speed [ 1 ] , 0 , 255 , thermalManager . lcd_setFanSpeed1 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( percent , MSG_FAN_SPEED " 2 " , & thermalManager . lcd_tmpfan_speed [ 1 ] , 0 , 255 , thermalManager . lcd_setFanSpeed1 ) ; <nl> # if ENABLED ( EXTRA_FAN_SPEED ) <nl> - MENU_MULTIPLIER_ITEM_EDIT ( uint8 , MSG_EXTRA_FAN_SPEED " 2 " , & thermalManager . new_fan_speed [ 1 ] , 3 , 255 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT ( percent , MSG_EXTRA_FAN_SPEED " 2 " , & thermalManager . new_fan_speed [ 1 ] , 3 , 255 ) ; <nl> # endif <nl> # endif <nl> # if HAS_FAN2 | | ( ENABLED ( SINGLENOZZLE ) & & EXTRUDERS > 2 ) <nl> - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( uint8 , MSG_FAN_SPEED " 3 " , & thermalManager . lcd_tmpfan_speed [ 2 ] , 0 , 255 , thermalManager . lcd_setFanSpeed2 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( percent , MSG_FAN_SPEED " 3 " , & thermalManager . lcd_tmpfan_speed [ 2 ] , 0 , 255 , thermalManager . lcd_setFanSpeed2 ) ; <nl> # if ENABLED ( EXTRA_FAN_SPEED ) <nl> - MENU_MULTIPLIER_ITEM_EDIT ( uint8 , MSG_EXTRA_FAN_SPEED " 3 " , & thermalManager . new_fan_speed [ 2 ] , 3 , 255 ) ; <nl> + MENU_MULTIPLIER_ITEM_EDIT ( percent , MSG_EXTRA_FAN_SPEED " 3 " , & thermalManager . new_fan_speed [ 2 ] , 3 , 255 ) ; <nl> # endif <nl> # endif <nl> # endif / / FAN_COUNT > 0 <nl> mmm a / Marlin / src / module / planner . cpp <nl> ppp b / Marlin / src / module / planner . cpp <nl> void Planner : : synchronize ( ) { <nl> * / <nl> # if ENABLED ( BACKLASH_COMPENSATION ) <nl> # if ENABLED ( BACKLASH_GCODE ) <nl> - extern float backlash_distance_mm [ ] , backlash_correction ; <nl> + extern float backlash_distance_mm [ ] ; <nl> + extern uint8_t backlash_correction ; <nl> # ifdef BACKLASH_SMOOTHING_MM <nl> extern float backlash_smoothing_mm ; <nl> # endif <nl> # else <nl> constexpr float backlash_distance_mm [ XYZ ] = BACKLASH_DISTANCE_MM , <nl> - backlash_correction = BACKLASH_CORRECTION ; <nl> + constexpr uint8_t backlash_correction = BACKLASH_CORRECTION * 255 ; <nl> # ifdef BACKLASH_SMOOTHING_MM <nl> constexpr float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM ; <nl> # endif <nl> void Planner : : synchronize ( ) { <nl> if ( ! changed_dir ) return ; <nl> # endif <nl> <nl> + const float f_corr = float ( backlash_correction ) / 255 . 0f ; <nl> + <nl> LOOP_XYZ ( axis ) { <nl> if ( backlash_distance_mm [ axis ] ) { <nl> const bool reversing = TEST ( dm , axis ) ; <nl> <nl> / / When an axis changes direction , add axis backlash to the residual error <nl> if ( TEST ( changed_dir , axis ) ) <nl> - residual_error [ axis ] + = backlash_correction * ( reversing ? - 1 . 0f : 1 . 0f ) * backlash_distance_mm [ axis ] * planner . settings . axis_steps_per_mm [ axis ] ; <nl> + residual_error [ axis ] + = ( reversing ? - f_corr : f_corr ) * backlash_distance_mm [ axis ] * planner . settings . axis_steps_per_mm [ axis ] ; <nl> <nl> / / Decide how much of the residual error to correct in this segment <nl> int32_t error_correction = residual_error [ axis ] ; <nl> mmm a / Marlin / src / module / temperature . h <nl> ppp b / Marlin / src / module / temperature . h <nl> class Temperature { <nl> static uint8_t paused_fan_speed [ FAN_COUNT ] ; <nl> # endif <nl> <nl> - static constexpr inline uint8_t fanPercent ( const uint8_t speed ) { return ( int ( speed ) * 100 + 127 ) / 255 ; } <nl> + static constexpr inline uint8_t fanPercent ( const uint8_t speed ) { return ui8_to_percent ( speed ) ; } <nl> <nl> # if ENABLED ( ADAPTIVE_FAN_SLOWING ) <nl> static uint8_t fan_speed_scaler [ FAN_COUNT ] ; <nl>
UltraLCD enhancements ( lower fan resolution , backlash menu ) ( )
MarlinFirmware/Marlin
5679fae11efbc7e8b9de2f0e68dc9a879757ff88
2019-03-29T19:07:43Z
mmm a / tools / SourceKit / include / SourceKit / Core / Context . h <nl> ppp b / tools / SourceKit / include / SourceKit / Core / Context . h <nl> <nl> # define LLVM_SOURCEKIT_CORE_CONTEXT_H <nl> <nl> # include " SourceKit / Core / LLVM . h " <nl> - # include " llvm / ADT / StringRef . h " <nl> # include " llvm / ADT / STLExtras . h " <nl> + # include " llvm / ADT / StringMap . h " <nl> + # include " llvm / ADT / StringRef . h " <nl> # include < memory > <nl> # include < string > <nl> <nl> namespace llvm { <nl> } <nl> <nl> namespace SourceKit { <nl> - class LangSupport ; <nl> - class NotificationCenter ; <nl> + class FileSystemProvider ; <nl> + class LangSupport ; <nl> + class NotificationCenter ; <nl> <nl> class Context { <nl> std : : string RuntimeLibPath ; <nl> std : : unique_ptr < LangSupport > SwiftLang ; <nl> std : : shared_ptr < NotificationCenter > NotificationCtr ; <nl> <nl> + llvm : : StringMap < std : : unique_ptr < FileSystemProvider > > FileSystemProviders ; <nl> + <nl> public : <nl> Context ( StringRef RuntimeLibPath , <nl> llvm : : function_ref < <nl> class Context { <nl> LangSupport & getSwiftLangSupport ( ) { return * SwiftLang ; } <nl> <nl> std : : shared_ptr < NotificationCenter > getNotificationCenter ( ) { return NotificationCtr ; } <nl> + <nl> + FileSystemProvider * getFileSystemProvider ( StringRef Name ) ; <nl> } ; <nl> <nl> } / / namespace SourceKit <nl> new file mode 100644 <nl> index 000000000000 . . 19afcec9e217 <nl> mmm / dev / null <nl> ppp b / tools / SourceKit / include / SourceKit / Core / FileSystemProvider . h <nl> <nl> + / / = = = mmm FileSystemProvider . h - mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm * - C + + - * - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # ifndef LLVM_SOURCEKIT_CORE_FILESYSTEMPROVIDER_H <nl> + # define LLVM_SOURCEKIT_CORE_FILESYSTEMPROVIDER_H <nl> + <nl> + # include " llvm / ADT / IntrusiveRefCntPtr . h " <nl> + # include " llvm / ADT / SmallVector . h " <nl> + # include " llvm / ADT / StringMap . h " <nl> + # include " llvm / Support / VirtualFileSystem . h " <nl> + <nl> + namespace SourceKit { <nl> + <nl> + / / / Allows clients of SourceKit to specify custom llvm : : vfs : : FileSystems to be <nl> + / / / used while serving a request . <nl> + / / / <nl> + / / / Requests to SourceKit select FileSystemProviders by specifying <nl> + / / / ' key . vfs . name ' , and pass arguments to the FileSystemProviders by <nl> + / / / specifying ' key . vfs . args ' . SourceKit then passes the given arguments to the <nl> + / / / selected FileSystemProvider , and uses the resulting llvm : : vfs : : FileSystem <nl> + / / / while serving the request . <nl> + class FileSystemProvider { <nl> + public : <nl> + virtual ~ FileSystemProvider ( ) = default ; <nl> + <nl> + / / / Returns a llvm : : vfs : : FileSystem to be used while serving a request , or <nl> + / / / nullptr on failure . <nl> + / / / \ param Args arguments passed into the request under ' key . vfs . args ' . <nl> + / / / \ param [ out ] ErrBuf filled with an error message on failure . <nl> + virtual llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > <nl> + getFileSystem ( const llvm : : SmallVectorImpl < const char * > & Args , <nl> + llvm : : SmallVectorImpl < char > & ErrBuf ) = 0 ; <nl> + } ; <nl> + <nl> + / / / Inserts all the selectable FileSystemProviders into Providers . The key is <nl> + / / / the string specified in ' key . vfs . name ' to select the FileSystemProvider . <nl> + void makeAllFileSystemProviders ( <nl> + llvm : : StringMap < std : : unique_ptr < FileSystemProvider > > & Providers ) ; <nl> + <nl> + } / / namespace SourceKit <nl> + <nl> + # endif <nl> mmm a / tools / SourceKit / lib / Core / CMakeLists . txt <nl> ppp b / tools / SourceKit / lib / Core / CMakeLists . txt <nl> <nl> <nl> add_sourcekit_library ( SourceKitCore <nl> Context . cpp <nl> + FileSystemProvider . cpp <nl> LangSupport . cpp <nl> NotificationCenter . cpp <nl> LINK_LIBS SourceKitSupport <nl> mmm a / tools / SourceKit / lib / Core / Context . cpp <nl> ppp b / tools / SourceKit / lib / Core / Context . cpp <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # include " SourceKit / Core / Context . h " <nl> + # include " SourceKit / Core / FileSystemProvider . h " <nl> # include " SourceKit / Core / LangSupport . h " <nl> # include " SourceKit / Core / NotificationCenter . h " <nl> <nl> SourceKit : : Context : : Context ( StringRef RuntimeLibPath , <nl> LangSupportFactoryFn , <nl> bool shouldDispatchNotificationsOnMain ) : RuntimeLibPath ( RuntimeLibPath ) , <nl> NotificationCtr ( new NotificationCenter ( shouldDispatchNotificationsOnMain ) ) { <nl> + makeAllFileSystemProviders ( FileSystemProviders ) ; <nl> / / Should be called last after everything is initialized . <nl> SwiftLang = LangSupportFactoryFn ( * this ) ; <nl> } <nl> <nl> SourceKit : : Context : : ~ Context ( ) { <nl> } <nl> + <nl> + FileSystemProvider * SourceKit : : Context : : getFileSystemProvider ( StringRef Name ) { <nl> + auto It = FileSystemProviders . find ( Name ) ; <nl> + if ( It = = FileSystemProviders . end ( ) ) <nl> + return nullptr ; <nl> + return It - > second . get ( ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 8791dbde4351 <nl> mmm / dev / null <nl> ppp b / tools / SourceKit / lib / Core / FileSystemProvider . cpp <nl> <nl> + / / = = = mmm FileSystemProvider . cpp mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # include " SourceKit / Core / FileSystemProvider . h " <nl> + <nl> + using namespace SourceKit ; <nl> + <nl> + / / / A simple configurable FileSystemProvider , useful for SourceKit tests that <nl> + / / / exercise the FileSystemProvider code . <nl> + class TestFileSystemProvider : public FileSystemProvider { <nl> + / / / Provides the real filesystem , overlayed with an InMemoryFileSystem that <nl> + / / / contains specified files at specified locations . <nl> + / / / \ param Args The locations of the InMemoryFileSystem files , interleaved <nl> + / / with paths on the real filesystem to fetch their contents <nl> + / / from . <nl> + llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > <nl> + getFileSystem ( const llvm : : SmallVectorImpl < const char * > & Args , <nl> + llvm : : SmallVectorImpl < char > & ErrBuf ) override { <nl> + auto InMemoryFS = llvm : : IntrusiveRefCntPtr < llvm : : vfs : : InMemoryFileSystem > ( <nl> + new llvm : : vfs : : InMemoryFileSystem ( ) ) ; <nl> + for ( unsigned i = 0 ; i < Args . size ( ) ; i + = 2 ) { <nl> + const char * InMemoryName = Args [ i ] ; <nl> + const char * TargetPath = Args [ i + 1 ] ; <nl> + auto TargetBufferOrErr = llvm : : MemoryBuffer : : getFile ( TargetPath ) ; <nl> + if ( auto Err = TargetBufferOrErr . getError ( ) ) { <nl> + llvm : : raw_svector_ostream ErrStream ( ErrBuf ) ; <nl> + ErrStream < < " Error reading target file ' " < < TargetPath <nl> + < < " ' : " < < Err . message ( ) < < " \ n " ; <nl> + return nullptr ; <nl> + } <nl> + auto RenamedTargetBuffer = llvm : : MemoryBuffer : : getMemBufferCopy ( <nl> + TargetBufferOrErr . get ( ) - > getBuffer ( ) , InMemoryName ) ; <nl> + InMemoryFS - > addFile ( InMemoryName , 0 , std : : move ( RenamedTargetBuffer ) ) ; <nl> + } <nl> + <nl> + auto OverlayFS = llvm : : IntrusiveRefCntPtr < llvm : : vfs : : OverlayFileSystem > ( <nl> + new llvm : : vfs : : OverlayFileSystem ( llvm : : vfs : : getRealFileSystem ( ) ) ) ; <nl> + OverlayFS - > pushOverlay ( std : : move ( InMemoryFS ) ) ; <nl> + return OverlayFS ; <nl> + } <nl> + } ; <nl> + <nl> + void SourceKit : : makeAllFileSystemProviders ( <nl> + llvm : : StringMap < std : : unique_ptr < FileSystemProvider > > & Providers ) { <nl> + Providers . try_emplace ( " testvfs " , llvm : : make_unique < TestFileSystemProvider > ( ) ) ; <nl> + } <nl> mmm a / tools / SourceKit / tools / sourcekitd - test / TestOptions . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd - test / TestOptions . cpp <nl> bool TestOptions : : parseArgs ( llvm : : ArrayRef < const char * > Args ) { <nl> case OPT_vfs_files : <nl> for ( const char * VFSFile : InputArg - > getValues ( ) ) { <nl> auto NameAndTarget = StringRef ( VFSFile ) . split ( ' = ' ) ; <nl> - VFSFiles . push_back ( std : : make_pair ( std : : get < 0 > ( NameAndTarget ) . str ( ) , <nl> - std : : get < 1 > ( NameAndTarget ) . str ( ) ) ) ; <nl> + VFSFiles . try_emplace ( std : : get < 0 > ( NameAndTarget ) , <nl> + std : : get < 1 > ( NameAndTarget ) . str ( ) ) ; <nl> } <nl> break ; <nl> <nl> mmm a / tools / SourceKit / tools / sourcekitd - test / TestOptions . h <nl> ppp b / tools / SourceKit / tools / sourcekitd - test / TestOptions . h <nl> <nl> <nl> # include " llvm / ADT / ArrayRef . h " <nl> # include " llvm / ADT / Optional . h " <nl> + # include " llvm / ADT / StringMap . h " <nl> # include < string > <nl> <nl> namespace sourcekitd_test { <nl> struct TestOptions { <nl> bool isAsyncRequest = false ; <nl> bool timeRequest = false ; <nl> unsigned repeatRequest = 1 ; <nl> - llvm : : SmallVector < std : : pair < std : : string , std : : string > , 4 > VFSFiles ; <nl> + llvm : : StringMap < std : : string > VFSFiles ; <nl> llvm : : Optional < bool > CancelOnSubsequentRequest ; <nl> bool parseArgs ( llvm : : ArrayRef < const char * > Args ) ; <nl> void printHelp ( bool ShowHidden ) const ; <nl> mmm a / tools / SourceKit / tools / sourcekitd - test / sourcekitd - test . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd - test / sourcekitd - test . cpp <nl> static bool handleResponse ( sourcekitd_response_t Resp , const TestOptions & Opts , <nl> std : : unique_ptr < llvm : : MemoryBuffer > SourceBuf , <nl> TestOptions * InitOpts ) ; <nl> static void printCursorInfo ( sourcekitd_variant_t Info , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles , <nl> llvm : : raw_ostream & OS ) ; <nl> static void printNameTranslationInfo ( sourcekitd_variant_t Info , llvm : : raw_ostream & OS ) ; <nl> static void printRangeInfo ( sourcekitd_variant_t Info , StringRef Filename , <nl> static void printDocInfo ( sourcekitd_variant_t Info , StringRef Filename ) ; <nl> static void printInterfaceGen ( sourcekitd_variant_t Info , bool CheckASCII ) ; <nl> static void printSemanticInfo ( ) ; <nl> static void printRelatedIdents ( sourcekitd_variant_t Info , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles , <nl> llvm : : raw_ostream & OS ) ; <nl> static void printFoundInterface ( sourcekitd_variant_t Info , <nl> llvm : : raw_ostream & OS ) ; <nl> static void prepareMangleRequest ( sourcekitd_object_t Req , <nl> static void printMangleResults ( sourcekitd_variant_t Info , raw_ostream & OS ) ; <nl> static void printStatistics ( sourcekitd_variant_t Info , raw_ostream & OS ) ; <nl> <nl> - static unsigned resolveFromLineCol ( unsigned Line , unsigned Col , <nl> - StringRef Filename ) ; <nl> + static unsigned <nl> + resolveFromLineCol ( unsigned Line , unsigned Col , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) ; <nl> static unsigned resolveFromLineCol ( unsigned Line , unsigned Col , <nl> llvm : : MemoryBuffer * InputBuf ) ; <nl> - static std : : pair < unsigned , unsigned > resolveToLineCol ( unsigned Offset , <nl> - StringRef Filename ) ; <nl> + static std : : pair < unsigned , unsigned > <nl> + resolveToLineCol ( unsigned Offset , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) ; <nl> static std : : pair < unsigned , unsigned > resolveToLineCol ( unsigned Offset , <nl> llvm : : MemoryBuffer * InputBuf ) ; <nl> static std : : pair < unsigned , unsigned > resolveToLineColFromBuf ( unsigned Offset , <nl> const char * Buf ) ; <nl> - static llvm : : MemoryBuffer * getBufferForFilename ( StringRef Filename ) ; <nl> + static llvm : : MemoryBuffer * <nl> + getBufferForFilename ( StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) ; <nl> <nl> static void notification_receiver ( sourcekitd_response_t resp ) ; <nl> <nl> static const char * semaName ; <nl> static sourcekitd_uid_t NoteTest ; <nl> static SourceKit : : Semaphore noteSyncSemaphore ( 0 ) ; <nl> <nl> - static llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > InjectedVFS ; <nl> - <nl> namespace { <nl> struct AsyncResponseInfo { <nl> SourceKit : : Semaphore semaphore { 0 } ; <nl> static sourcekitd_response_t sendRequestSync ( sourcekitd_object_t req , <nl> Optional < PrintingTimer > timer ; <nl> if ( opts . timeRequest ) <nl> timer . emplace ( " request time " ) ; <nl> - return sourcekitd_send_request_sync_with_filesystem ( req , <nl> - ( void * ) & InjectedVFS ) ; <nl> + return sourcekitd_send_request_sync ( req ) ; <nl> } <nl> <nl> static int handleJsonRequestPath ( StringRef QueryPath , const TestOptions & Opts ) { <nl> - auto Buffer = getBufferForFilename ( QueryPath ) - > getBuffer ( ) ; <nl> + auto Buffer = getBufferForFilename ( QueryPath , Opts . VFSFiles ) - > getBuffer ( ) ; <nl> char * Err = nullptr ; <nl> auto Req = sourcekitd_request_create_from_yaml ( Buffer . data ( ) , & Err ) ; <nl> if ( ! Req ) { <nl> static int setExpectedTypes ( const sourcekitd_test : : TestOptions & Opts , <nl> } <nl> <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> - if ( Opts . VFSFiles . empty ( ) ) { <nl> - InjectedVFS = nullptr ; <nl> - } else { <nl> - auto InMemoryFS = llvm : : IntrusiveRefCntPtr < llvm : : vfs : : InMemoryFileSystem > ( <nl> - new llvm : : vfs : : InMemoryFileSystem ( ) ) ; <nl> - for ( auto & NameAndTarget : Opts . VFSFiles ) { <nl> - auto TargetBufferOrErr = <nl> - llvm : : MemoryBuffer : : getFile ( std : : get < 1 > ( NameAndTarget ) ) ; <nl> - if ( auto Err = TargetBufferOrErr . getError ( ) ) { <nl> - llvm : : errs ( ) < < " Error reading target file ' " <nl> - < < std : : get < 1 > ( NameAndTarget ) < < " ' : " < < Err . message ( ) <nl> - < < " \ n " ; <nl> - return 1 ; <nl> - } <nl> - auto RenamedTargetBuffer = llvm : : MemoryBuffer : : getMemBufferCopy ( <nl> - TargetBufferOrErr . get ( ) - > getBuffer ( ) , std : : get < 0 > ( NameAndTarget ) ) ; <nl> - InMemoryFS - > addFile ( std : : get < 0 > ( NameAndTarget ) , 0 , <nl> - std : : move ( RenamedTargetBuffer ) ) ; <nl> - } <nl> - <nl> - auto OverlayFS = llvm : : IntrusiveRefCntPtr < llvm : : vfs : : OverlayFileSystem > ( <nl> - new llvm : : vfs : : OverlayFileSystem ( llvm : : vfs : : getRealFileSystem ( ) ) ) ; <nl> - OverlayFS - > pushOverlay ( std : : move ( InMemoryFS ) ) ; <nl> - InjectedVFS = std : : move ( OverlayFS ) ; <nl> - } <nl> - <nl> if ( ! Opts . JsonRequestPath . empty ( ) ) <nl> return handleJsonRequestPath ( Opts . JsonRequestPath , Opts ) ; <nl> <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> std : : string SemaName = ! Opts . Name . empty ( ) ? Opts . Name : SourceFile ; <nl> <nl> if ( ! Opts . TextInputFile . empty ( ) ) { <nl> - auto Buf = getBufferForFilename ( Opts . TextInputFile ) ; <nl> + auto Buf = getBufferForFilename ( Opts . TextInputFile , Opts . VFSFiles ) ; <nl> Opts . SourceText = Buf - > getBuffer ( ) ; <nl> } <nl> <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> SourceBuf = llvm : : MemoryBuffer : : getMemBuffer ( * Opts . SourceText , Opts . SourceFile ) ; <nl> } else if ( ! SourceFile . empty ( ) ) { <nl> SourceBuf = llvm : : MemoryBuffer : : getMemBuffer ( <nl> - getBufferForFilename ( SourceFile ) - > getBuffer ( ) , SourceFile ) ; <nl> + getBufferForFilename ( SourceFile , Opts . VFSFiles ) - > getBuffer ( ) , <nl> + SourceFile ) ; <nl> } <nl> <nl> / / FIXME : we should detect if offset is required but not set . <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> sourcekitd_request_dictionary_set_int64 ( Req , KeyOffset , ByteOffset ) ; <nl> auto Length = Opts . Length ; <nl> if ( Opts . Length = = 0 & & Opts . EndLine > 0 ) { <nl> - auto EndOff = resolveFromLineCol ( Opts . EndLine , Opts . EndCol , SourceFile ) ; <nl> + auto EndOff = resolveFromLineCol ( Opts . EndLine , Opts . EndCol , SourceFile , <nl> + Opts . VFSFiles ) ; <nl> Length = EndOff - ByteOffset ; <nl> } <nl> sourcekitd_request_dictionary_set_int64 ( Req , KeyLength , Length ) ; <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> llvm : : errs ( ) < < " Missing ' - rename - spec < file path > ' \ n " ; <nl> return 1 ; <nl> } <nl> - auto Buffer = getBufferForFilename ( Opts . RenameSpecPath ) - > getBuffer ( ) ; <nl> + auto Buffer = <nl> + getBufferForFilename ( Opts . RenameSpecPath , Opts . VFSFiles ) - > getBuffer ( ) ; <nl> char * Err = nullptr ; <nl> auto RenameSpec = sourcekitd_request_create_from_yaml ( Buffer . data ( ) , & Err ) ; <nl> if ( ! RenameSpec ) { <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> <nl> if ( ! SourceFile . empty ( ) ) { <nl> if ( Opts . PassAsSourceText ) { <nl> - auto Buf = getBufferForFilename ( SourceFile ) ; <nl> + auto Buf = getBufferForFilename ( SourceFile , Opts . VFSFiles ) ; <nl> sourcekitd_request_dictionary_set_string ( Req , KeySourceText , <nl> Buf - > getBufferStart ( ) ) ; <nl> } <nl> static int handleTestInvocation ( TestOptions Opts , TestOptions & InitOpts ) { <nl> } <nl> } <nl> <nl> + if ( ! Opts . VFSFiles . empty ( ) ) { <nl> + sourcekitd_request_dictionary_set_string ( Req , KeyVFSName , " testvfs " ) ; <nl> + sourcekitd_object_t VFSArgs = sourcekitd_request_array_create ( nullptr , 0 ) ; <nl> + for ( auto & NameAndTarget : Opts . VFSFiles ) { <nl> + sourcekitd_request_array_set_string ( VFSArgs , SOURCEKITD_ARRAY_APPEND , <nl> + NameAndTarget . first ( ) . data ( ) ) ; <nl> + sourcekitd_request_array_set_string ( VFSArgs , SOURCEKITD_ARRAY_APPEND , <nl> + NameAndTarget . second . c_str ( ) ) ; <nl> + } <nl> + sourcekitd_request_dictionary_set_value ( Req , KeyVFSArgs , VFSArgs ) ; <nl> + sourcekitd_request_release ( VFSArgs ) ; <nl> + } <nl> <nl> if ( ! Opts . isAsyncRequest ) { <nl> sourcekitd_response_t Resp = sendRequestSync ( Req , Opts ) ; <nl> static bool handleResponse ( sourcekitd_response_t Resp , const TestOptions & Opts , <nl> break ; <nl> <nl> case SourceKitRequest : : RelatedIdents : <nl> - printRelatedIdents ( Info , SourceFile , llvm : : outs ( ) ) ; <nl> + printRelatedIdents ( Info , SourceFile , Opts . VFSFiles , llvm : : outs ( ) ) ; <nl> break ; <nl> <nl> case SourceKitRequest : : CursorInfo : <nl> - printCursorInfo ( Info , SourceFile , llvm : : outs ( ) ) ; <nl> + printCursorInfo ( Info , SourceFile , Opts . VFSFiles , llvm : : outs ( ) ) ; <nl> break ; <nl> <nl> case SourceKitRequest : : NameTranslation : <nl> static bool handleResponse ( sourcekitd_response_t Resp , const TestOptions & Opts , <nl> case SourceKitRequest : : Structure : <nl> sourcekitd_response_description_dump_filedesc ( Resp , STDOUT_FILENO ) ; <nl> if ( Opts . ReplaceText . hasValue ( ) ) { <nl> - unsigned Offset = resolveFromLineCol ( Opts . Line , Opts . Col , SourceFile ) ; <nl> + unsigned Offset = <nl> + resolveFromLineCol ( Opts . Line , Opts . Col , SourceFile , Opts . VFSFiles ) ; <nl> unsigned Length = Opts . Length ; <nl> sourcekitd_object_t EdReq = sourcekitd_request_dictionary_create ( nullptr , <nl> nullptr , 0 ) ; <nl> static void printNameTranslationInfo ( sourcekitd_variant_t Info , <nl> } <nl> <nl> static void printCursorInfo ( sourcekitd_variant_t Info , StringRef FilenameIn , <nl> + const llvm : : StringMap < std : : string > & VFSFiles , <nl> llvm : : raw_ostream & OS ) { <nl> const char * InternalDiagnostic = <nl> sourcekitd_variant_dictionary_get_string ( Info , KeyInternalDiagnostic ) ; <nl> static void printCursorInfo ( sourcekitd_variant_t Info , StringRef FilenameIn , <nl> if ( Offset . hasValue ( ) ) { <nl> if ( Filename ! = FilePath ) <nl> OS < < FilePath < < " : " ; <nl> - auto LineCol = resolveToLineCol ( Offset . getValue ( ) , FilePath ) ; <nl> + auto LineCol = resolveToLineCol ( Offset . getValue ( ) , FilePath , VFSFiles ) ; <nl> OS < < LineCol . first < < ' : ' < < LineCol . second ; <nl> - auto EndLineCol = resolveToLineCol ( Offset . getValue ( ) + Length , FilePath ) ; <nl> + auto EndLineCol = <nl> + resolveToLineCol ( Offset . getValue ( ) + Length , FilePath , VFSFiles ) ; <nl> OS < < ' - ' < < EndLineCol . first < < ' : ' < < EndLineCol . second ; <nl> } <nl> OS < < " ) \ n " ; <nl> static void printInterfaceGen ( sourcekitd_variant_t Info , bool CheckASCII ) { <nl> } <nl> <nl> static void printRelatedIdents ( sourcekitd_variant_t Info , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles , <nl> llvm : : raw_ostream & OS ) { <nl> OS < < " START RANGES \ n " ; <nl> sourcekitd_variant_t Res = <nl> static void printRelatedIdents ( sourcekitd_variant_t Info , StringRef Filename , <nl> sourcekitd_variant_t Range = sourcekitd_variant_array_get_value ( Res , i ) ; <nl> int64_t Offset = sourcekitd_variant_dictionary_get_int64 ( Range , KeyOffset ) ; <nl> int64_t Length = sourcekitd_variant_dictionary_get_int64 ( Range , KeyLength ) ; <nl> - auto LineCol = resolveToLineCol ( Offset , Filename ) ; <nl> + auto LineCol = resolveToLineCol ( Offset , Filename , VFSFiles ) ; <nl> OS < < LineCol . first < < ' : ' < < LineCol . second < < " - " < < Length < < ' \ n ' ; <nl> } <nl> OS < < " END RANGES \ n " ; <nl> static void expandPlaceholders ( llvm : : MemoryBuffer * SourceBuf , <nl> } <nl> <nl> static std : : pair < unsigned , unsigned > <nl> - resolveToLineCol ( unsigned Offset , StringRef Filename ) { <nl> - return resolveToLineCol ( Offset , getBufferForFilename ( Filename ) ) ; <nl> + resolveToLineCol ( unsigned Offset , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) { <nl> + return resolveToLineCol ( Offset , getBufferForFilename ( Filename , VFSFiles ) ) ; <nl> } <nl> <nl> static std : : pair < unsigned , unsigned > <nl> resolveToLineColFromBuf ( unsigned Offset , const char * Ptr ) { <nl> return { Line , Col } ; <nl> } <nl> <nl> - static unsigned resolveFromLineCol ( unsigned Line , unsigned Col , <nl> - StringRef Filename ) { <nl> - return resolveFromLineCol ( Line , Col , getBufferForFilename ( Filename ) ) ; <nl> + static unsigned <nl> + resolveFromLineCol ( unsigned Line , unsigned Col , StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) { <nl> + return resolveFromLineCol ( Line , Col , <nl> + getBufferForFilename ( Filename , VFSFiles ) ) ; <nl> } <nl> <nl> static unsigned resolveFromLineCol ( unsigned Line , unsigned Col , <nl> static unsigned resolveFromLineCol ( unsigned Line , unsigned Col , <nl> <nl> static llvm : : StringMap < llvm : : MemoryBuffer * > Buffers ; <nl> <nl> - static llvm : : MemoryBuffer * getBufferForFilename ( StringRef Filename ) { <nl> + static llvm : : MemoryBuffer * <nl> + getBufferForFilename ( StringRef Filename , <nl> + const llvm : : StringMap < std : : string > & VFSFiles ) { <nl> + auto VFSFileIt = VFSFiles . find ( Filename ) ; <nl> + if ( VFSFileIt ! = VFSFiles . end ( ) ) <nl> + Filename = VFSFileIt - > second ; <nl> + <nl> auto It = Buffers . find ( Filename ) ; <nl> if ( It ! = Buffers . end ( ) ) <nl> return It - > second ; <nl> <nl> - auto FileBufOrErr = InjectedVFS ? InjectedVFS - > getBufferForFile ( Filename ) <nl> - : llvm : : MemoryBuffer : : getFile ( Filename ) ; <nl> + auto FileBufOrErr = llvm : : MemoryBuffer : : getFile ( Filename ) ; <nl> if ( ! FileBufOrErr ) { <nl> llvm : : errs ( ) < < " error opening input file ' " < < Filename < < " ' ( " <nl> < < FileBufOrErr . getError ( ) . message ( ) < < " ) \ n " ; <nl> mmm a / tools / SourceKit / tools / sourcekitd / bin / InProc / sourcekitdInProc . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd / bin / InProc / sourcekitdInProc . cpp <nl> void sourcekitd : : set_interrupted_connection_handler ( <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> sourcekitd_response_t sourcekitd_send_request_sync ( sourcekitd_object_t req ) { <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > vfs ; <nl> - return sourcekitd_send_request_sync_with_filesystem ( req , ( void * ) & vfs ) ; <nl> - } <nl> - <nl> - sourcekitd_response_t <nl> - sourcekitd_send_request_sync_with_filesystem ( sourcekitd_object_t req , <nl> - void * vfs ) { <nl> Semaphore sema ( 0 ) ; <nl> <nl> sourcekitd_response_t ReturnedResp ; <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ( <nl> - * ( llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > * ) vfs ) ; <nl> - sourcekitd : : handleRequest ( <nl> - req , <nl> - [ & ] ( sourcekitd_response_t resp ) { <nl> - ReturnedResp = resp ; <nl> - sema . signal ( ) ; <nl> - } , <nl> - FileSystem ) ; <nl> + sourcekitd : : handleRequest ( req , [ & ] ( sourcekitd_response_t resp ) { <nl> + ReturnedResp = resp ; <nl> + sema . signal ( ) ; <nl> + } ) ; <nl> <nl> sema . wait ( ) ; <nl> return ReturnedResp ; <nl> void sourcekitd_send_request ( sourcekitd_object_t req , <nl> sourcekitd_request_retain ( req ) ; <nl> receiver = Block_copy ( receiver ) ; <nl> WorkQueue : : dispatchConcurrent ( [ = ] { <nl> - sourcekitd : : handleRequest ( <nl> - req , <nl> - [ = ] ( sourcekitd_response_t resp ) { <nl> - / / The receiver accepts ownership of the response . <nl> - receiver ( resp ) ; <nl> - Block_release ( receiver ) ; <nl> - } , <nl> - nullptr ) ; <nl> + sourcekitd : : handleRequest ( req , [ = ] ( sourcekitd_response_t resp ) { <nl> + / / The receiver accepts ownership of the response . <nl> + receiver ( resp ) ; <nl> + Block_release ( receiver ) ; <nl> + } ) ; <nl> sourcekitd_request_release ( req ) ; <nl> } ) ; <nl> } <nl> mmm a / tools / SourceKit / tools / sourcekitd / bin / XPC / Client / sourcekitd . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd / bin / XPC / Client / sourcekitd . cpp <nl> sourcekitd_response_t sourcekitd_send_request_sync ( sourcekitd_object_t req ) { <nl> return resp ; <nl> } <nl> <nl> - sourcekitd_response_t <nl> - sourcekitd_send_request_sync_with_filesystem ( sourcekitd_object_t req , <nl> - void * vfs ) { <nl> - llvm : : report_fatal_error ( " XPC client does not support custom filesystems " ) ; <nl> - } <nl> - <nl> void sourcekitd_send_request ( sourcekitd_object_t req , <nl> sourcekitd_request_handle_t * out_handle , <nl> sourcekitd_response_receiver_t receiver ) { <nl> mmm a / tools / SourceKit / tools / sourcekitd / include / sourcekitd / Internal . h <nl> ppp b / tools / SourceKit / tools / sourcekitd / include / sourcekitd / Internal . h <nl> <nl> # endif <nl> <nl> # include " sourcekitd / sourcekitd . h " <nl> - # include " llvm / ADT / IntrusiveRefCntPtr . h " <nl> # include " llvm / ADT / Optional . h " <nl> # include " llvm / ADT / STLExtras . h " <nl> - # include " llvm / Support / VirtualFileSystem . h " <nl> # include < functional > <nl> # include < string > <nl> <nl> void set_interrupted_connection_handler ( llvm : : function_ref < void ( ) > handler ) ; <nl> <nl> typedef std : : function < void ( sourcekitd_response_t ) > ResponseReceiver ; <nl> <nl> - void handleRequest ( sourcekitd_object_t Request , ResponseReceiver Receiver , <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ) ; <nl> + void handleRequest ( sourcekitd_object_t Request , ResponseReceiver Receiver ) ; <nl> <nl> void printRequestObject ( sourcekitd_object_t Obj , llvm : : raw_ostream & OS ) ; <nl> void printResponse ( sourcekitd_response_t Resp , llvm : : raw_ostream & OS ) ; <nl> mmm a / tools / SourceKit / tools / sourcekitd / include / sourcekitd / sourcekitd . h <nl> ppp b / tools / SourceKit / tools / sourcekitd / include / sourcekitd / sourcekitd . h <nl> SOURCEKITD_PUBLIC SOURCEKITD_NONNULL_ALL SOURCEKITD_WARN_RESULT <nl> sourcekitd_response_t <nl> sourcekitd_send_request_sync ( sourcekitd_object_t req ) ; <nl> <nl> - SOURCEKITD_PUBLIC <nl> - SOURCEKITD_NONNULL_ALL SOURCEKITD_WARN_RESULT sourcekitd_response_t <nl> - sourcekitd_send_request_sync_with_filesystem ( sourcekitd_object_t req , <nl> - void * vfs ) ; <nl> - <nl> / / / Used to cancel a request that has been invoked asynchronously . <nl> typedef void * sourcekitd_request_handle_t ; <nl> <nl> mmm a / tools / SourceKit / tools / sourcekitd / lib / API / Requests . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd / lib / API / Requests . cpp <nl> <nl> # include " sourcekitd / ExpressionTypeArray . h " <nl> <nl> # include " SourceKit / Core / Context . h " <nl> + # include " SourceKit / Core / FileSystemProvider . h " <nl> # include " SourceKit / Core / LangSupport . h " <nl> # include " SourceKit / Core / NotificationCenter . h " <nl> # include " SourceKit / Support / Concurrency . h " <nl> syntaxSerializationFormatFromUID ( sourcekitd_uid_t UID ) { <nl> } <nl> } <nl> <nl> - static void <nl> - handleRequestImpl ( sourcekitd_object_t Req , ResponseReceiver Receiver , <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ) ; <nl> + static void handleRequestImpl ( sourcekitd_object_t Req , <nl> + ResponseReceiver Receiver ) ; <nl> <nl> - void sourcekitd : : handleRequest ( <nl> - sourcekitd_object_t Req , ResponseReceiver Receiver , <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ) { <nl> + void sourcekitd : : handleRequest ( sourcekitd_object_t Req , <nl> + ResponseReceiver Receiver ) { <nl> LOG_SECTION ( " handleRequest - before " , InfoHighPrio ) { <nl> sourcekitd : : printRequestObject ( Req , Log - > getOS ( ) ) ; <nl> } <nl> <nl> - handleRequestImpl ( <nl> - Req , <nl> - [ Receiver ] ( sourcekitd_response_t Resp ) { <nl> - LOG_SECTION ( " handleRequest - after " , InfoHighPrio ) { <nl> - / / Responses are big , print them out with info medium priority . <nl> - if ( Logger : : isLoggingEnabledForLevel ( Logger : : Level : : InfoMediumPrio ) ) <nl> - sourcekitd : : printResponse ( Resp , Log - > getOS ( ) ) ; <nl> - } <nl> + handleRequestImpl ( Req , [ Receiver ] ( sourcekitd_response_t Resp ) { <nl> + LOG_SECTION ( " handleRequest - after " , InfoHighPrio ) { <nl> + / / Responses are big , print them out with info medium priority . <nl> + if ( Logger : : isLoggingEnabledForLevel ( Logger : : Level : : InfoMediumPrio ) ) <nl> + sourcekitd : : printResponse ( Resp , Log - > getOS ( ) ) ; <nl> + } <nl> <nl> - Receiver ( Resp ) ; <nl> - } , <nl> - FileSystem ) ; <nl> + Receiver ( Resp ) ; <nl> + } ) ; <nl> } <nl> <nl> static std : : unique_ptr < llvm : : MemoryBuffer > <nl> static void handleSemanticRequest ( <nl> ArrayRef < const char * > Args , <nl> llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ) ; <nl> <nl> - void handleRequestImpl ( <nl> - sourcekitd_object_t ReqObj , ResponseReceiver Rec , <nl> - llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem ) { <nl> + void handleRequestImpl ( sourcekitd_object_t ReqObj , ResponseReceiver Rec ) { <nl> / / NOTE : if we had a connection context , these stats should move into it . <nl> static Statistic numRequests ( UIdentFromSKDUID ( KindStatNumRequests ) , " # of requests ( total ) " ) ; <nl> static Statistic numSemaRequests ( UIdentFromSKDUID ( KindStatNumSemaRequests ) , " # of semantic requests " ) ; <nl> void handleRequestImpl ( <nl> <nl> llvm : : SmallString < 64 > ErrBuf ; <nl> <nl> + llvm : : IntrusiveRefCntPtr < llvm : : vfs : : FileSystem > FileSystem = nullptr ; <nl> + if ( Optional < StringRef > VFSName = Req . getString ( KeyVFSName ) ) { <nl> + FileSystemProvider * Provider = <nl> + getGlobalContext ( ) . getFileSystemProvider ( * VFSName ) ; <nl> + if ( ! Provider ) { <nl> + return Rec ( createErrorRequestInvalid ( <nl> + " ' key . vfs . name ' refers to a filesystem that does not exist " ) ) ; <nl> + } <nl> + <nl> + SmallVector < const char * , 8 > VFSArgs ; <nl> + bool Failed = Req . getStringArray ( KeyVFSArgs , VFSArgs , / * isOptional = * / true ) ; <nl> + if ( Failed ) { <nl> + return Rec ( <nl> + createErrorRequestInvalid ( " ' key . vfs . args ' not an array of strings " ) ) ; <nl> + } <nl> + <nl> + FileSystem = Provider - > getFileSystem ( VFSArgs , ErrBuf ) ; <nl> + if ( ! FileSystem ) { <nl> + return Rec ( createErrorRequestInvalid ( ErrBuf . c_str ( ) ) ) ; <nl> + } <nl> + } <nl> + <nl> SmallVector < const char * , 8 > Args ; <nl> bool Failed = Req . getStringArray ( KeyCompilerArgs , Args , / * isOptional = * / true ) ; <nl> if ( Failed ) { <nl> mmm a / utils / gyb_sourcekit_support / UIDs . py <nl> ppp b / utils / gyb_sourcekit_support / UIDs . py <nl> def __init__ ( self , internal_name , external_name ) : <nl> KEY ( ' ExpressionType ' , ' key . expression_type ' ) , <nl> KEY ( ' CanonicalizeType ' , ' key . canonicalize_type ' ) , <nl> KEY ( ' InternalDiagnostic ' , " key . internal_diagnostic " ) , <nl> + KEY ( ' VFSName ' , ' key . vfs . name ' ) , <nl> + KEY ( ' VFSArgs ' , ' key . vfs . args ' ) , <nl> ] <nl> <nl> <nl>
change it to use a FileSystemProvider selected by the request
apple/swift
ed3a8ec6fcf283e47ec3207d09f643b723176cd9
2019-07-16T17:19:24Z
mmm a / hphp / hack / src / typing / nastCheck . ml <nl> ppp b / hphp / hack / src / typing / nastCheck . ml <nl> type control_context = <nl> | SwitchContext <nl> <nl> type env = { <nl> - t_is_finally : bool ; <nl> function_name : string option ; <nl> class_name : string option ; <nl> class_kind : Ast . class_kind option ; <nl> module CheckFunctionBody = struct <nl> | Ast . FAsync , Return ( _ , Some e ) - > <nl> expr_allow_await f_type env e ; <nl> ( ) <nl> - | ( Ast . FGenerator | Ast . FAsyncGenerator ) , Return ( p , e ) - > <nl> - ( match e with <nl> - None - > ( ) <nl> - | Some _ - > Errors . return_in_gen p ) ; <nl> + | ( Ast . FGenerator | Ast . FAsyncGenerator ) , Return _ - > <nl> ( ) <nl> | Ast . FCoroutine , Return ( _ , e ) - > <nl> Option . iter e ~ f : ( expr f_type env ) <nl> module CheckFunctionBody = struct <nl> | _ , Try ( b , cl , fb ) - > <nl> block f_type env b ; <nl> List . iter cl ( catch f_type env ) ; <nl> - block f_type { env with t_is_finally = true } fb ; <nl> + block f_type env fb ; <nl> ( ) <nl> | _ , Def_inline _ - > ( ) <nl> | _ , Let ( ( p , x ) , _ , e ) - > <nl> let fun_is_reactive user_attributes = <nl> List . exists user_attributes ~ f : is_some_reactivity_attribute <nl> <nl> let rec fun_ tenv f named_body = <nl> - let env = { t_is_finally = false ; <nl> - is_array_append_allowed = false ; <nl> + let env = { is_array_append_allowed = false ; <nl> class_name = None ; class_kind = None ; <nl> typedef_tparams = [ ] ; <nl> tenv = tenv ; <nl> and func env f named_body = <nl> Phase . localize_where_constraints ~ ety_env tenv f . f_where_constraints in <nl> let env = { env with <nl> tenv = Env . set_mode tenv f . f_mode ; <nl> - t_is_finally = false ; <nl> is_reactive = env . is_reactive | | fun_is_reactive f . f_user_attributes ; <nl> } in <nl> maybe hint env f . f_ret ; <nl> and check_happly unchecked_tparams env h = <nl> <nl> and class_ tenv c = <nl> let cname = Some ( snd c . c_name ) in <nl> - let env = { t_is_finally = false ; <nl> - is_array_append_allowed = false ; <nl> + let env = { is_array_append_allowed = false ; <nl> class_name = cname ; <nl> class_kind = Some c . c_kind ; <nl> typedef_tparams = [ ] ; <nl> and stmt env = function <nl> | Try ( b , cl , fb ) - > <nl> block env b ; <nl> List . iter cl ( catch env ) ; <nl> - block { env with t_is_finally = true } fb ; <nl> + block env fb ; <nl> ( ) <nl> | Def_inline _ - > ( ) <nl> | Let ( ( p , x ) , _ , e ) - > <nl> and field env ( e1 , e2 ) = <nl> ( ) <nl> <nl> let typedef tenv t = <nl> - let env = { t_is_finally = false ; <nl> - is_array_append_allowed = false ; <nl> + let env = { is_array_append_allowed = false ; <nl> class_name = None ; class_kind = None ; <nl> function_name = None ; <nl> ( * Since typedefs cannot have constraints we shouldn ' t check <nl> mmm a / hphp / hack / src / typing / nast_check / naming_coroutine_check . ml <nl> ppp b / hphp / hack / src / typing / nast_check / naming_coroutine_check . ml <nl> type ctx = { <nl> is_coroutine : bool ; <nl> is_async : bool ; <nl> is_final : bool ; <nl> + is_generator : bool ; <nl> } <nl> <nl> let set_ctx ctx f = <nl> let set_ctx ctx f = <nl> | Ast . FCoroutine - > <nl> { ctx with is_coroutine = true } <nl> | Ast . FSync <nl> - | Ast . FAsync <nl> + | Ast . FAsync - > <nl> + { ctx with is_async = true } <nl> | Ast . FGenerator <nl> | Ast . FAsyncGenerator - > <nl> - { ctx with is_async = true } <nl> + { ctx with is_async = true ; is_generator = true ; } <nl> <nl> let default_ctx = { <nl> is_coroutine = false ; <nl> is_async = false ; <nl> is_final = false ; <nl> + is_generator = false ; <nl> } <nl> <nl> let visitor = object ( self ) <nl> inherit [ ctx ] Nast_visitor . iter_with_state as super <nl> <nl> + method ! on_Efun ( env , ctx ) = super # on_Efun ( env , { ctx with is_generator = false } ) <nl> + method ! on_Lfun ( env , ctx ) = super # on_Lfun ( env , { ctx with is_generator = false } ) <nl> + <nl> method ! on_fun_ ( env , ctx ) f = <nl> super # on_fun_ ( env , set_ctx ctx f ) f <nl> <nl> method ! on_expr ( env , ctx ) ( p , e ) = <nl> - match e with <nl> + begin match e with <nl> | Yield _ <nl> | Yield_break <nl> | Yield_from _ - > <nl> let visitor = object ( self ) <nl> | Suspend _ - > <nl> if ctx . is_coroutine & & ctx . is_final then Errors . suspend_in_finally p ; <nl> if ctx . is_async & & not ctx . is_coroutine then Errors . suspend_outside_of_coroutine p <nl> - | _ - > ( ) ; <nl> + | _ - > ( ) <nl> + end ; <nl> super # on_expr ( env , ctx ) ( p , e ) <nl> <nl> method ! on_stmt ( env , ctx ) s = <nl> let visitor = object ( self ) <nl> self # on_block ( env , { ctx with is_final = true } ) fb <nl> | _ - > ( ) <nl> end ; <nl> + if ctx . is_generator then <nl> + begin match s with <nl> + | Return ( p , e ) - > <nl> + begin match e with <nl> + | None - > ( ) <nl> + | Some _ - > Errors . return_in_gen p <nl> + end <nl> + | _ - > ( ) <nl> + end ; <nl> super # on_stmt ( env , ctx ) s <nl> <nl> end <nl>
Move return in gen check to nast_check
facebook/hhvm
86ae37b327979f548518be833b31d904135f35ea
2019-02-27T19:47:17Z
mmm a / docs / faq / index . md <nl> ppp b / docs / faq / index . md <nl> and full working examples , visit the [ tutorials section ] ( . . / tutorials / index . md ) . <nl> <nl> # # API <nl> <nl> - * [ What ' s the difference between the Module and Gluon APIs for Python ? ] ( http : / / mxnet . io / api / python / index . html ) <nl> + * [ What ' s the difference between the Module and Gluon APIs for Python ? ] ( . . / api / python / index . html ) <nl> <nl> # # Modeling <nl> - * [ How do I fine - tune pre - trained models to a new dataset ? ] ( http : / / mxnet . io / faq / finetune . html ) <nl> + * [ How do I fine - tune pre - trained models to a new dataset ? ] ( finetune . html ) <nl> <nl> - * [ How do I work with variable - length input in MXNet ( bucketing ) ? ] ( http : / / mxnet . io / faq / bucketing . html ) <nl> + * [ How do I work with variable - length input in MXNet ( bucketing ) ? ] ( bucketing . html ) <nl> <nl> - * [ How do I visualize neural networks as computation graphs ? ] ( http : / / mxnet . io / faq / visualize_graph . html ) <nl> + * [ How do I visualize neural networks as computation graphs ? ] ( visualize_graph . html ) <nl> <nl> <nl> # # Scale <nl> - * [ How can I train with multiple CPU / GPUs on a single machine with data parallelism ? ] ( http : / / mxnet . io / faq / multi_devices . html ) <nl> + * [ How can I train with multiple CPU / GPUs on a single machine with data parallelism ? ] ( multi_devices . html ) <nl> <nl> - * [ How can I train using multiple machines with data parallelism ? ] ( http : / / mxnet . io / faq / distributed_training . html ) <nl> + * [ How can I train using multiple machines with data parallelism ? ] ( distributed_training . html ) <nl> <nl> - * [ How can I train using multiple GPUs with model parallelism ? ] ( http : / / mxnet . io / faq / model_parallel_lstm . html ) <nl> + * [ How can I train using multiple GPUs with model parallelism ? ] ( model_parallel_lstm . html ) <nl> <nl> <nl> # # Speed <nl> - * [ How do I use gradient compression with distributed training ? ] ( http : / / mxnet . io / faq / gradient_compression . html ) <nl> + * [ How do I use gradient compression with distributed training ? ] ( gradient_compression . html ) <nl> <nl> - * [ Can I use nnpack to improve the CPU performance of MXNet ? ] ( http : / / mxnet . io / faq / nnpack . html ) <nl> + * [ Can I use nnpack to improve the CPU performance of MXNet ? ] ( nnpack . html ) <nl> <nl> - * [ What are the best setup and data - handling tips and tricks for improving speed ? ] ( http : / / mxnet . io / faq / perf . html ) <nl> + * [ What are the best setup and data - handling tips and tricks for improving speed ? ] ( perf . html ) <nl> <nl> - * [ How do I use mixed precision with MXNet or Gluon ? ] ( http : / / mxnet . io / faq / float16 . html ) <nl> + * [ How do I use mixed precision with MXNet or Gluon ? ] ( float16 . html ) <nl> <nl> # # Deployment Environments <nl> - * [ Can I run MXNet on smart or mobile devices ? ] ( http : / / mxnet . io / faq / smart_device . html ) <nl> + * [ Can I run MXNet on smart or mobile devices ? ] ( smart_device . html ) <nl> <nl> * [ How to use data from S3 for training ? ] ( s3_integration . md ) <nl> <nl> - * [ How to setup MXNet on AWS ? ] ( http : / / docs . aws . amazon . com / mxnet / latest / dg / mxnet - on - ec2 - instance . html ) <nl> + * [ How to run MXNet on AWS ? ] ( https : / / docs . aws . amazon . com / mxnet / latest / dg / whatis . html ) <nl> <nl> * [ How to do distributed training using MXNet on AWS ? ] ( http : / / docs . aws . amazon . com / mxnet / latest / dg / mxnet - on - ec2 - cluster . html ) <nl> <nl> - * [ How do I run MXNet on a Raspberry Pi for computer vision ? ] ( http : / / mxnet . io / tutorials / embedded / wine_detector . html ) <nl> + * [ How do I run MXNet on a Raspberry Pi for computer vision ? ] ( . . / tutorials / embedded / wine_detector . html ) <nl> <nl> * [ How do I run Keras 2 with MXNet backend ? ] ( https : / / github . com / awslabs / keras - apache - mxnet / blob / master / docs / mxnet_backend / installation . md ) <nl> <nl> * [ How to convert MXNet models to Apple CoreML format ? ] ( https : / / github . com / apache / incubator - mxnet / tree / master / tools / coreml ) <nl> <nl> # # Security <nl> - * [ How to run MXNet securely ? ] ( http : / / mxnet . io / faq / security . html ) <nl> + * [ How to run MXNet securely ? ] ( security . html ) <nl> <nl> # # Extend and Contribute to MXNet <nl> <nl> - * [ How do I join the MXNet development discussion ? ] ( http : / / mxnet . io / community / mxnet_channels . html ) <nl> + * [ How do I join the MXNet development discussion ? ] ( . . / community / mxnet_channels . html ) <nl> <nl> - * [ How do I contribute a patch to MXNet ? ] ( http : / / mxnet . io / community / contribute . html ) <nl> + * [ How do I contribute a patch to MXNet ? ] ( . . / community / contribute . html ) <nl> <nl> - * [ How do I implement operators in MXNet backend ? ] ( http : / / mxnet . io / faq / add_op_in_backend . html ) <nl> + * [ How do I implement operators in MXNet backend ? ] ( add_op_in_backend . html ) <nl> <nl> - * [ How do I create new operators in MXNet ? ] ( http : / / mxnet . io / faq / new_op . html ) <nl> + * [ How do I create new operators in MXNet ? ] ( new_op . html ) <nl> <nl> * [ How do I implement sparse operators in MXNet backend ? ] ( https : / / cwiki . apache . org / confluence / display / MXNET / A + Guide + to + Implementing + Sparse + Operators + in + MXNet + Backend ) <nl> <nl> * [ How do I contribute an example or tutorial ? ] ( https : / / github . com / apache / incubator - mxnet / tree / master / example # contributing ) <nl> <nl> - * [ How do I set MXNet ' s environmental variables ? ] ( http : / / mxnet . io / faq / env_var . html ) <nl> + * [ How do I set MXNet ' s environmental variables ? ] ( env_var . html ) <nl> <nl> # # Questions about Using MXNet <nl> If you need help with using MXNet , have questions about applying it to a particular kind of problem , or have a discussion topic , please use our [ forum ] ( https : / / discuss . mxnet . io ) . <nl> <nl> # # Issue Tracker <nl> - We track bugs and new feature requests in the MXNet Github repo in the issues folder : [ mxnet / issues ] ( https : / / github . com / dmlc / mxnet / issues ) . <nl> + We track bugs and new feature requests in the MXNet Github repo in the issues folder : [ mxnet / issues ] ( https : / / github . com / apache / incubator - mxnet / issues ) . <nl> <nl> # # Roadmap <nl> - MXNet is evolving fast . To see what ' s next and what we are working on internally , go to the [ MXNet Roadmap ] ( https : / / github . com / dmlc / mxnet / labels / Roadmap ) . <nl> + MXNet is evolving fast . To see what ' s next and what we are working on internally , go to the [ MXNet Roadmap ] ( https : / / cwiki . apache . org / confluence / display / MXNET / MXNet + Roadmap ) . <nl>
use relative links ; update links ( )
apache/incubator-mxnet
e30d9733214dde84e1c01c00ff2664283d435588
2019-01-03T06:59:36Z
mmm a / modules / routing / common / utils_test . cc <nl> ppp b / modules / routing / common / utils_test . cc <nl> TEST ( FileUtilsTestSuit , test1 ) { <nl> graph_1 . set_hdmap_version ( map_version ) ; <nl> <nl> : : apollo : : routing : : Graph graph_2 ; <nl> - ASSERT_TRUE ( FileUtils : : dump_protobuf_data_to_file ( file_path , graph_1 ) ) ; <nl> - ASSERT_TRUE ( FileUtils : : load_protobuf_data_from_file ( file_path , & graph_2 ) ) ; <nl> - ASSERT_EQ ( map_version , graph_2 . hdmap_version ( ) ) ; <nl> } <nl> <nl> } / / namespace routing <nl> mmm a / modules / routing / topo_creator / graph_creator . cc <nl> ppp b / modules / routing / topo_creator / graph_creator . cc <nl> bool GraphCreator : : create ( ) { <nl> LOG ( ERROR ) < < " Failed to load base map file from " < < _base_map_file_path ; <nl> return false ; <nl> } <nl> - LOG ( INFO ) < < " Number of lanes : " < < _pbmap . lane_size ( ) ; <nl> + LOG ( ERROR ) < < " Number of lanes : " < < _pbmap . lane_size ( ) ; <nl> <nl> _graph . set_hdmap_version ( _pbmap . header ( ) . version ( ) ) ; <nl> _graph . set_hdmap_district ( _pbmap . header ( ) . district ( ) ) ; <nl> bool GraphCreator : : create ( ) { <nl> add_edge ( from_node , lane . successor_id ( ) , Edge : : FORWARD ) ; <nl> } <nl> <nl> - if ( ! : : apollo : : routing : : FileUtils : : dump_protobuf_data_to_file ( <nl> - _dump_topo_file_path , _graph ) ) { <nl> + if ( ! : : apollo : : common : : util : : SetProtoToASCIIFile ( <nl> + _graph , _dump_topo_file_path ) ) { <nl> LOG ( ERROR ) < < " Failed to dump topo data into file " < < _dump_topo_file_path ; <nl> return false ; <nl> } <nl> mmm a / modules / routing / topo_creator / topo_creator . cc <nl> ppp b / modules / routing / topo_creator / topo_creator . cc <nl> int main ( int argc , char * * argv ) { <nl> AERROR < < " Create routing topo failed ! " ; <nl> return - 1 ; <nl> } <nl> - LOG ( INFO ) < < " Create routing topo succesful ! " ; <nl> - LOG ( INFO ) < < FLAGS_graph_dir + " / " + FLAGS_graph_file_name ; <nl> + AERROR < < " Create routing topo succesful ! " ; <nl> + AINFO < < FLAGS_graph_dir + " / " + FLAGS_graph_file_name ; <nl> return 0 ; <nl> } <nl> <nl>
routing fix file io
ApolloAuto/apollo
c7c226d7d2c6fd2fc2e891f3f4edc06cdb6e3e83
2017-08-03T21:42:24Z
mmm a / modules / java / generator / src / java / android + JavaCameraView . java <nl> ppp b / modules / java / generator / src / java / android + JavaCameraView . java <nl> protected boolean initializeCamera ( int width , int height ) { <nl> params . setPreviewSize ( ( int ) frameSize . width , ( int ) frameSize . height ) ; <nl> <nl> List < String > FocusModes = params . getSupportedFocusModes ( ) ; <nl> - if ( FocusModes . contains ( Camera . Parameters . FOCUS_MODE_CONTINUOUS_VIDEO ) ) <nl> + if ( FocusModes ! = null & & FocusModes . contains ( Camera . Parameters . FOCUS_MODE_CONTINUOUS_VIDEO ) ) <nl> { <nl> params . setFocusMode ( Camera . Parameters . FOCUS_MODE_CONTINUOUS_VIDEO ) ; <nl> } <nl>
Merge ppull request from asmorkalov / android_emu_fix
opencv/opencv
efecf3b8fd4cbb6daf055b20447b3b0dbf622c44
2012-12-24T15:25:57Z
mmm a / src / core / memory . cpp <nl> ppp b / src / core / memory . cpp <nl> T Read ( const VAddr vaddr ) { <nl> return value ; <nl> } <nl> <nl> - / / The memory access might do an MMIO or cached access , so we have to lock the HLE kernel state <nl> - std : : lock_guard < std : : recursive_mutex > lock ( HLE : : g_hle_lock ) ; <nl> - <nl> PageType type = current_page_table - > attributes [ vaddr > > PAGE_BITS ] ; <nl> switch ( type ) { <nl> case PageType : : Unmapped : <nl> void Write ( const VAddr vaddr , const T data ) { <nl> return ; <nl> } <nl> <nl> - / / The memory access might do an MMIO or cached access , so we have to lock the HLE kernel state <nl> - std : : lock_guard < std : : recursive_mutex > lock ( HLE : : g_hle_lock ) ; <nl> - <nl> PageType type = current_page_table - > attributes [ vaddr > > PAGE_BITS ] ; <nl> switch ( type ) { <nl> case PageType : : Unmapped : <nl>
Memory : don ' t lock hle mutex in memory read / write
yuzu-emu/yuzu
5159f4eee882027928098962cdcd71a0b56bfd38
2019-03-02T14:20:05Z
mmm a / tensorflow / contrib / distribute / python / estimator_training_test . py <nl> ppp b / tensorflow / contrib / distribute / python / estimator_training_test . py <nl> def predict_input_fn ( ) : <nl> <nl> def _get_strategy_object ( self , strategy_cls ) : <nl> if strategy_cls = = mirrored_strategy . CoreMirroredStrategy : <nl> - return strategy_cls ( mirrored_strategy . all_local_devices ( ) ) <nl> + return strategy_cls ( ) <nl> else : <nl> return strategy_cls ( num_gpus_per_worker = context . num_gpus ( ) ) <nl> <nl> def _get_strategy_object ( self , strategy_cls ) : <nl> mirrored_strategy . MirroredStrategy , <nl> mirrored_strategy . CoreMirroredStrategy , <nl> parameter_server_strategy . ParameterServerStrategy , <nl> + collective_all_reduce_strategy . CollectiveAllReduceStrategy , <nl> ] , <nl> required_gpus = [ 0 , 1 ] ) ) <nl> def test_complete_flow_standalone_client ( self , train_distribute_cls , <nl> def _independent_worker_fn ( <nl> parameter_server_strategy . ParameterServerStrategy , <nl> ] , <nl> eval_distribute_cls = [ <nl> - None , mirrored_strategy . MirroredStrategy , <nl> + None , <nl> + mirrored_strategy . MirroredStrategy , <nl> mirrored_strategy . CoreMirroredStrategy , <nl> parameter_server_strategy . ParameterServerStrategy , <nl> + collective_all_reduce_strategy . CollectiveAllReduceStrategy , <nl> ] , <nl> required_gpus = [ 0 , 1 ] ) ) <nl> def test_complete_flow_independent_worker_between_graph ( <nl> mmm a / tensorflow / python / distribute / collective_all_reduce_strategy . py <nl> ppp b / tensorflow / python / distribute / collective_all_reduce_strategy . py <nl> def _initialize_multi_worker ( self , cluster_resolver ) : <nl> task_id = cluster_resolver . task_id <nl> if task_type is None or task_id is None : <nl> raise ValueError ( " When ` cluster_spec ` is given , you must also specify " <nl> - " ` task_type ` and ` task_id ` in the ` cluster_resolver ` . " ) <nl> - if task_type not in ( " chief " , " worker " ) : <nl> - raise ValueError ( <nl> - " Unrecognized task_type : % r , valid task types are : \ " chief \ " , " <nl> - " \ " worker \ " . " % task_type ) <nl> + " ` task_type ` and ` task_id ` . " ) <nl> <nl> self . _num_workers = multi_worker_util . worker_count ( cluster_spec , task_type ) <nl> if not self . _num_workers : <nl> - raise ValueError ( " No ` worker ` or ` chief ` tasks can be found in " <nl> - " ` cluster_spec ` . " ) <nl> + raise ValueError ( " No ` worker ` , ` chief ` or ` evaluator ` tasks can be found " <nl> + " in ` cluster_spec ` . " ) <nl> <nl> self . _is_chief = multi_worker_util . is_chief ( cluster_spec , task_type , <nl> task_id ) <nl> def _update_config_proto ( self , config_proto ) : <nl> <nl> # Collective group leader is needed for collective ops to coordinate <nl> # workers . <nl> - if " chief " in self . _cluster_spec . jobs : <nl> - updated_config . experimental . collective_group_leader = ( <nl> - " / job : chief / replica : 0 / task : 0 " ) <nl> - else : <nl> - if " worker " not in self . _cluster_spec . jobs : <nl> - raise ValueError ( <nl> - " You must have ` chief ` or ` worker ` jobs in the ` cluster_spec ` . " ) <nl> - updated_config . experimental . collective_group_leader = ( <nl> - " / job : worker / replica : 0 / task : 0 " ) <nl> + updated_config . experimental . collective_group_leader = ( <nl> + multi_worker_util . collective_leader ( self . _cluster_spec , self . _task_type , <nl> + self . _task_id ) ) <nl> <nl> # The device filters prevent communication between workers . <nl> del updated_config . device_filters [ : ] <nl> mmm a / tensorflow / python / distribute / distribute_coordinator . py <nl> ppp b / tensorflow / python / distribute / distribute_coordinator . py <nl> def _split_cluster_for_evaluator ( cluster_spec , task_type ) : <nl> # distribution strategies and as a result ops in the evalauator task may have <nl> # unspecified devices . Those ops may end up on other tasks if we don ' t split <nl> # the cluster . <nl> + # Note : if you bypass distribute coordinator and bring the cluster yourself , <nl> + # you can equivalently set device filters to split clusters . This is already <nl> + # done by distribution strategy ' s ` update_config_proto ` method . <nl> new_cluster_spec = multi_worker_util . normalize_cluster_spec ( <nl> cluster_spec ) . as_dict ( ) <nl> if task_type = = _TaskType . EVALUATOR : <nl> mmm a / tensorflow / python / distribute / multi_worker_util . py <nl> ppp b / tensorflow / python / distribute / multi_worker_util . py <nl> def normalize_cluster_spec ( cluster_spec ) : <nl> def _validate_cluster_spec ( cluster_spec , task_type , task_id ) : <nl> " " " Validates ` cluster_spec ` . <nl> <nl> - It checks <nl> - 1 ) whether there is such a task type as ` task_type ` in the <nl> - ` cluster_spec ` . <nl> - 2 ) whether there is at most one " chief " job . <nl> - 3 ) whether the ` task_id ` is smaller than the number of ` task_type ` . <nl> + It checks : <nl> + 1 ) task type is one of " chief " , " worker " or " evaluator " . <nl> + 2 ) whether there is such a task type as ` task_type ` in the ` cluster_spec ` . <nl> + 3 ) whether there is at most one " chief " job . <nl> + 4 ) whether there is at most one " evaluator " job . <nl> + 5 ) whether the ` task_id ` is smaller than the number of tasks for that <nl> + particular ` task_type ` . <nl> <nl> Args : <nl> cluster_spec : a dict , ` ClusterDef ` or ` ClusterSpec ` object to be validated . <nl> def _validate_cluster_spec ( cluster_spec , task_type , task_id ) : <nl> ValueError : if ` cluster_spec ` fails any check . <nl> " " " <nl> cluster_spec = normalize_cluster_spec ( cluster_spec ) . as_dict ( ) <nl> + if task_type not in ( " chief " , " worker " , " evaluator " , " ps " ) : <nl> + raise ValueError ( <nl> + " Unrecognized task_type : % r , valid task types are : \ " chief \ " , " <nl> + " \ " worker \ " , \ " evaluator \ " and \ " ps \ " . " % task_type ) <nl> + <nl> if task_type and task_type not in cluster_spec : <nl> raise ValueError ( " ` task_type ` % r not found in cluster_spec . " % task_type ) <nl> + <nl> if len ( cluster_spec . get ( " chief " , [ ] ) ) > 1 : <nl> raise ValueError ( " There must be at most one ' chief ' job . " ) <nl> + <nl> + if len ( cluster_spec . get ( " evaluator " , [ ] ) ) > 1 : <nl> + raise ValueError ( " There must be at most one ' evaluator ' job . " ) <nl> + <nl> if task_id > = len ( cluster_spec [ task_type ] ) : <nl> raise ValueError ( <nl> " The ` task_id ` % d exceeds the maximum id of % s . " % ( task_id , task_type ) ) <nl> def _validate_cluster_spec ( cluster_spec , task_type , task_id ) : <nl> def is_chief ( cluster_spec , task_type , task_id ) : <nl> " " " Returns whether the given task is chief in the cluster . <nl> <nl> + Since there is at most one evaluator and the evaluator itself should be <nl> + independent of the training cluster , the evaluator job is also a chief job on <nl> + its own . <nl> + <nl> Args : <nl> cluster_spec : a dict , ` ClusterDef ` or ` ClusterSpec ` object specifying the <nl> cluster configurations . <nl> def is_chief ( cluster_spec , task_type , task_id ) : <nl> _validate_cluster_spec ( cluster_spec , task_type , task_id ) <nl> cluster_spec = normalize_cluster_spec ( cluster_spec ) . as_dict ( ) <nl> <nl> - if task_type = = " chief " : <nl> + if task_type = = " chief " or task_type = = " evaluator " : <nl> return True <nl> <nl> # If chief not in the cluster_spec , use the first worker as chief . This is <nl> def is_chief ( cluster_spec , task_type , task_id ) : <nl> return False <nl> <nl> <nl> + def collective_leader ( cluster_spec , task_type , task_id ) : <nl> + " " " Return the job name for the leader of for collective ops . <nl> + <nl> + Args : <nl> + cluster_spec : a dict , ` ClusterDef ` or ` ClusterSpec ` object specifying the <nl> + cluster configurations . <nl> + task_type : the task type in the cluster . <nl> + task_id : the task id in the cluster . <nl> + <nl> + Returns : <nl> + a string indicating the leader job name or empty string if no need to set <nl> + leader job . <nl> + " " " <nl> + cluster_spec = normalize_cluster_spec ( cluster_spec ) <nl> + <nl> + # No need to set collective leader for local . <nl> + if not cluster_spec . as_dict ( ) : <nl> + return " " <nl> + <nl> + _validate_cluster_spec ( cluster_spec , task_type , task_id ) <nl> + <nl> + # Only one evaluator , so no need to set collective leader . <nl> + if task_type = = " evaluator " : <nl> + return " " <nl> + <nl> + # Use chief if chief is in the cluster . <nl> + if " chief " in cluster_spec . jobs : <nl> + return " / job : chief / replica : 0 / task : 0 " <nl> + <nl> + # Use worker 0 if no chief job . <nl> + assert " worker " in cluster_spec . jobs <nl> + return " / job : worker / replica : 0 / task : 0 " <nl> + <nl> + <nl> def worker_count ( cluster_spec , task_type ) : <nl> " " " Returns the number of workers in the cluster . " " " <nl> _validate_cluster_spec ( cluster_spec , task_type , task_id = 0 ) <nl> mmm a / tensorflow / python / distribute / multi_worker_util_test . py <nl> ppp b / tensorflow / python / distribute / multi_worker_util_test . py <nl> def testClusterWithoutChief ( self ) : <nl> ValueError , " The ` task_id ` 2 exceeds the maximum id of worker . " ) : <nl> multi_worker_util . is_chief ( cluster_spec , " worker " , 2 ) <nl> <nl> + def testEvaluatorIsChief ( self ) : <nl> + cluster_spec = { <nl> + " chief " : [ " 127 . 0 . 0 . 1 : 1234 " ] , <nl> + " worker " : [ " 127 . 0 . 0 . 1 : 8964 " , " 127 . 0 . 0 . 1 : 2333 " ] , <nl> + " evaluator " : [ " 127 . 0 . 0 . 1 : 2019 " ] <nl> + } <nl> + self . assertTrue ( multi_worker_util . is_chief ( cluster_spec , " evaluator " , 0 ) ) <nl> + <nl> <nl> class NumWorkersTest ( test . TestCase ) : <nl> <nl> def testMultipleChiefs ( self ) : <nl> multi_worker_util . id_in_cluster ( cluster_spec , " chief " , 0 ) <nl> <nl> <nl> + class CollectiveLeaderTest ( test . TestCase ) : <nl> + <nl> + def testChiefAsLeader ( self ) : <nl> + cluster_spec = { <nl> + " chief " : [ " 127 . 0 . 0 . 1 : 1234 " ] , <nl> + " worker " : [ " 127 . 0 . 0 . 1 : 8964 " , " 127 . 0 . 0 . 1 : 2333 " ] , <nl> + " ps " : [ " 127 . 0 . 0 . 1 : 1926 " , " 127 . 0 . 0 . 1 : 3141 " ] <nl> + } <nl> + self . assertEqual ( <nl> + multi_worker_util . collective_leader ( cluster_spec , " worker " , 0 ) , <nl> + " / job : chief / replica : 0 / task : 0 " ) <nl> + <nl> + def testWorkerAsLeader ( self ) : <nl> + cluster_spec = { <nl> + " worker " : [ " 127 . 0 . 0 . 1 : 8964 " , " 127 . 0 . 0 . 1 : 2333 " ] , <nl> + " ps " : [ " 127 . 0 . 0 . 1 : 1926 " , " 127 . 0 . 0 . 1 : 3141 " ] <nl> + } <nl> + self . assertEqual ( <nl> + multi_worker_util . collective_leader ( cluster_spec , " worker " , 1 ) , <nl> + " / job : worker / replica : 0 / task : 0 " ) <nl> + <nl> + def testLeaderForEvaluator ( self ) : <nl> + cluster_spec = { <nl> + " chief " : [ " 127 . 0 . 0 . 1 : 1234 " ] , <nl> + " worker " : [ " 127 . 0 . 0 . 1 : 8964 " , " 127 . 0 . 0 . 1 : 2333 " ] , <nl> + " ps " : [ " 127 . 0 . 0 . 1 : 1926 " , " 127 . 0 . 0 . 1 : 3141 " ] , <nl> + " evaluator " : [ " 127 . 0 . 0 . 1 : 2019 " ] <nl> + } <nl> + self . assertEqual ( <nl> + multi_worker_util . collective_leader ( cluster_spec , " evaluator " , 0 ) , " " ) <nl> + <nl> + def testLocalLeader ( self ) : <nl> + cluster_spec = { } <nl> + self . assertEqual ( <nl> + multi_worker_util . collective_leader ( cluster_spec , None , 0 ) , " " ) <nl> + <nl> + <nl> if __name__ = = " __main__ " : <nl> test . main ( ) <nl> mmm a / tensorflow / python / distribute / parameter_server_strategy . py <nl> ppp b / tensorflow / python / distribute / parameter_server_strategy . py <nl> def _update_config_proto ( self , config_proto ) : <nl> assert self . _task_id is not None <nl> <nl> # The device filters prevent communication between workers . <nl> - if self . _task_type not in [ " chief " , " worker " ] : <nl> - return updated_config <nl> del updated_config . device_filters [ : ] <nl> - updated_config . device_filters . extend ( <nl> - [ " / job : % s / task : % d " % ( self . _task_type , self . _task_id ) , " / job : ps " ] ) <nl> + if self . _task_type in [ " chief " , " worker " ] : <nl> + updated_config . device_filters . extend ( <nl> + [ " / job : % s / task : % d " % ( self . _task_type , self . _task_id ) , " / job : ps " ] ) <nl> + elif self . _task_type = = " evaluator " : <nl> + updated_config . device_filters . append ( <nl> + " / job : % s / task : % d " % ( self . _task_type , self . _task_id ) ) <nl> return updated_config <nl> <nl> @ property <nl>
Make Distribution Strategy more friendly with evaluator job .
tensorflow/tensorflow
7e9528af9eea0cafa8d4d0276c0f439d71ecddaf
2019-02-28T19:40:39Z
mmm a / tensorflow / python / tpu / tpu . py <nl> ppp b / tensorflow / python / tpu / tpu . py <nl> def computation ( ) : <nl> . . . = shard ( computation , . . . ) <nl> <nl> If ` outputs_from_all_shards ` is true , the outputs from all shards of <nl> - ` computation ` are concatenated back together along their ` output_shards_axes ` . <nl> + ` computation ` are concatenated back together along their ` output_shard_axes ` . <nl> Otherwise , each output is taken from an arbitrary shard . <nl> <nl> Inputs and outputs of the computation must be at least rank - 1 Tensors . <nl> def computation ( ) : <nl> as inputs . <nl> <nl> If ` outputs_from_all_shards ` is true , the outputs from all shards of <nl> - ` computation ` are concatenated back together along their ` output_shards_axes ` . <nl> + ` computation ` are concatenated back together along their ` output_shard_axes ` . <nl> Otherwise , each output is taken from an arbitrary shard . <nl> <nl> Inputs and outputs of the computation must be at least rank - 1 Tensors . <nl>
Merge pull request from shawwn : patch - 1
tensorflow/tensorflow
59df5f7dfa608d5a40ba4c07ba6a0954de1eeab7
2019-11-06T05:27:18Z
deleted file mode 100644 <nl> index 706209526a . . 0000000000 <nl> mmm a / html5 / browser / extend / api / dom . js <nl> ppp / dev / null <nl> <nl> - ' use strict ' <nl> - <nl> - const scroll = require ( ' scroll - to ' ) <nl> - <nl> - const dom = { <nl> - <nl> - / * * <nl> - * createBody : create root component <nl> - * @ param { object } element <nl> - * container | listview | scrollview <nl> - * @ return { [ type ] } [ description ] <nl> - * / <nl> - createBody : function ( element ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - element . scale = this . scale <nl> - element . instanceId = componentManager . instanceId <nl> - return componentManager . createBody ( element ) <nl> - } , <nl> - <nl> - addElement : function ( parentRef , element , index ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - element . scale = this . scale <nl> - element . instanceId = componentManager . instanceId <nl> - return componentManager . addElement ( parentRef , element , index ) <nl> - } , <nl> - <nl> - removeElement : function ( ref ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . removeElement ( ref ) <nl> - } , <nl> - <nl> - moveElement : function ( ref , parentRef , index ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . moveElement ( ref , parentRef , index ) <nl> - } , <nl> - <nl> - addEvent : function ( ref , type ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . addEvent ( ref , type ) <nl> - } , <nl> - <nl> - removeEvent : function ( ref , type ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . removeEvent ( ref , type ) <nl> - } , <nl> - <nl> - / * * <nl> - * updateAttrs : update attributes of component <nl> - * @ param { string } ref <nl> - * @ param { obj } attr <nl> - * / <nl> - updateAttrs : function ( ref , attr ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . updateAttrs ( ref , attr ) <nl> - } , <nl> - <nl> - / * * <nl> - * updateStyle : udpate style of component <nl> - * @ param { string } ref <nl> - * @ param { obj } style <nl> - * / <nl> - updateStyle : function ( ref , style ) { <nl> - const componentManager = this . getComponentManager ( ) <nl> - return componentManager . updateStyle ( ref , style ) <nl> - } , <nl> - <nl> - createFinish : function ( ) { <nl> - / / TODO <nl> - / / FrameUpdater . pause ( ) <nl> - } , <nl> - <nl> - refreshFinish : function ( ) { <nl> - / / TODO <nl> - } , <nl> - <nl> - / * * <nl> - * scrollToElement <nl> - * @ param { string } ref <nl> - * @ param { obj } options { offset : Number } <nl> - * ps : scroll - to has ' ease ' and ' duration ' ( ms ) as options . <nl> - * / <nl> - scrollToElement : function ( ref , options ) { <nl> - ! options & & ( options = { } ) <nl> - const offset = ( Number ( options . offset ) | | 0 ) * this . scale <nl> - const componentManager = this . getComponentManager ( ) <nl> - const elem = componentManager . getComponent ( ref ) <nl> - if ( ! elem ) { <nl> - return console . error ( ' component of ref ' + ref + ' doesn \ ' t exist . ' ) <nl> - } <nl> - const parentScroller = elem . getParentScroller ( ) <nl> - if ( parentScroller ) { <nl> - parentScroller . scroller . scrollToElement ( elem . node , true , offset ) <nl> - } <nl> - else { <nl> - const offsetTop = elem . node . getBoundingClientRect ( ) . top <nl> - + document . body . scrollTop <nl> - const tween = scroll ( 0 , offsetTop + offset , options ) <nl> - tween . on ( ' end ' , function ( ) { <nl> - console . log ( ' scroll end . ' ) <nl> - } ) <nl> - } <nl> - } <nl> - } <nl> - <nl> - const meta = { <nl> - dom : [ { <nl> - name : ' createBody ' , <nl> - args : [ ' object ' ] <nl> - } , { <nl> - name : ' addElement ' , <nl> - args : [ ' string ' , ' object ' , ' number ' ] <nl> - } , { <nl> - name : ' removeElement ' , <nl> - args : [ ' string ' ] <nl> - } , { <nl> - name : ' moveElement ' , <nl> - args : [ ' string ' , ' string ' , ' number ' ] <nl> - } , { <nl> - name : ' addEvent ' , <nl> - args : [ ' string ' , ' string ' ] <nl> - } , { <nl> - name : ' removeEvent ' , <nl> - args : [ ' string ' , ' string ' ] <nl> - } , { <nl> - name : ' updateAttrs ' , <nl> - args : [ ' string ' , ' object ' ] <nl> - } , { <nl> - name : ' updateStyle ' , <nl> - args : [ ' string ' , ' object ' ] <nl> - } , { <nl> - name : ' createFinish ' , <nl> - args : [ ] <nl> - } , { <nl> - name : ' refreshFinish ' , <nl> - args : [ ] <nl> - } , { <nl> - name : ' scrollToElement ' , <nl> - args : [ ' string ' , ' object ' ] <nl> - } ] <nl> - } <nl> - <nl> - export default { <nl> - init : function ( Weex ) { <nl> - Weex . registerApiModule ( ' dom ' , dom , meta ) <nl> - } <nl> - } <nl> mmm a / html5 / browser / extend / api / index . js <nl> ppp b / html5 / browser / extend / api / index . js <nl> <nl> - import dom from ' . / dom ' <nl> import event from ' . / event ' <nl> import pageInfo from ' . / pageInfo ' <nl> import stream from ' . / stream ' <nl> import navigator from ' . / navigator ' <nl> <nl> export default { <nl> init : function ( Weex ) { <nl> - Weex . install ( dom ) <nl> Weex . install ( event ) <nl> Weex . install ( pageInfo ) <nl> Weex . install ( stream ) <nl> mmm a / html5 / browser / runtime / index . js <nl> ppp b / html5 / browser / runtime / index . js <nl> <nl> ' use strict ' <nl> <nl> - import ' . . / . . / shared ' <nl> + import ' . / shared ' <nl> import init from ' . . / . . / runtime / init ' <nl> import { Document , Element , Comment } from ' . . / dom ' <nl> import { subversion } from ' . . / . . / . . / package . json ' <nl> new file mode 100644 <nl> index 0000000000 . . a3fde5a272 <nl> mmm / dev / null <nl> ppp b / html5 / browser / runtime / shared . js <nl> <nl> + import ' . . / . . / shared / objectAssign ' <nl> + import ' . . / . . / shared / promise ' <nl> + import ' . . / . . / shared / console ' <nl> + <nl>
* [ html5 ] rm dom api
apache/incubator-weex
1c93e2274e55f451f90eb4eb49335f0f7d0a0835
2016-08-03T08:59:59Z
mmm a / src / mongo / base / SConscript <nl> ppp b / src / mongo / base / SConscript <nl> <nl> <nl> Import ( " env " ) <nl> <nl> + env . Command ( [ ' error_codes . h ' , ' error_codes . cpp ' ] , [ ' generate_error_codes . py ' , ' error_codes . err ' ] , <nl> + ' $ PYTHON $ SOURCES $ TARGETS ' ) <nl> + <nl> env . StaticLibrary ( ' base ' , [ ' configuration_variable_manager . cpp ' , <nl> + ' error_codes . cpp ' , <nl> ' global_initializer . cpp ' , <nl> ' global_initializer_registerer . cpp ' , <nl> ' init . cpp ' , <nl> new file mode 100644 <nl> index 000000000000 . . 806a5b5f2c6d <nl> mmm / dev / null <nl> ppp b / src / mongo / base / error_codes . err <nl> <nl> + # - * - python - mode - * - <nl> + <nl> + error_code ( " OK " , 0 ) <nl> + error_code ( " InternalError " , 1 ) <nl> + error_code ( " BadValue " , 2 ) <nl> + error_code ( " DuplicateKey " , 3 ) <nl> + error_code ( " NoSuchKey " , 4 ) <nl> + error_code ( " GraphContainsCycle " , 5 ) <nl> + error_code ( " HostUnreachable " , 6 ) <nl> + error_code ( " HostNotFound " , 7 ) <nl> + error_code ( " UnknownError " , 8 ) <nl> + error_code ( " FailedToParse " , 9 ) <nl> + error_code ( " CannotMutateObject " , 10 ) <nl> + error_code ( " UserNotFound " , 11 ) <nl> + error_code ( " UnsupportedFormat " , 12 ) <nl> + error_code ( " Unauthorized " , 13 ) <nl> + error_code ( " TypeMismatch " , 14 ) <nl> + error_code ( " Overflow " , 15 ) <nl> + <nl> + error_class ( " NetworkError " , [ " HostUnreachable " , " HostNotFound " ] ) <nl> deleted file mode 100644 <nl> index 33b51c43d1b6 . . 000000000000 <nl> mmm a / src / mongo / base / error_codes . h <nl> ppp / dev / null <nl> <nl> - / * Copyright 2012 10gen Inc . <nl> - * <nl> - * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - * you may not use this file except in compliance with the License . <nl> - * You may obtain a copy of the License at <nl> - * <nl> - * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - * <nl> - * Unless required by applicable law or agreed to in writing , software <nl> - * distributed under the License is distributed on an " AS IS " BASIS , <nl> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - * See the License for the specific language governing permissions and <nl> - * limitations under the License . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include < string > <nl> - <nl> - namespace mongo { <nl> - <nl> - / * * <nl> - * This is a generated class containg a table of error codes and their corresponding <nl> - * error strings . The class is derived from the definitions in the error_codes . err <nl> - * file . <nl> - * <nl> - * TODO : Do not update this file directly . Update error_codes . err instead . <nl> - * <nl> - * # Error table <nl> - * [ OK , " ok " ] <nl> - * [ InternalError , 1 ] <nl> - * [ BadValue , 2 ] <nl> - * . . . <nl> - * [ HostUnreachable , < nnnn > ] <nl> - * [ HostNotFound , < nnnn > ] <nl> - * <nl> - * # Error classes <nl> - * [ NetworkError , [ HostUnreachable , HostNotFound ] ] <nl> - * <nl> - * / <nl> - class ErrorCodes { <nl> - public : <nl> - enum Error { <nl> - OK = 0 , <nl> - InternalError = 1 , <nl> - BadValue = 2 , <nl> - DuplicateKey = 3 , <nl> - NoSuchKey = 4 , <nl> - GraphContainsCycle = 5 , <nl> - HostUnreachable = 6 , <nl> - HostNotFound = 7 , <nl> - UnknownError = 8 , <nl> - FailedToParse = 9 , <nl> - CannotMutateObject = 10 , <nl> - UserNotFound = 11 , <nl> - UnsupportedFormat = 12 , <nl> - Unauthorized = 13 , <nl> - MaxError <nl> - } ; <nl> - <nl> - static const char * errorString ( Error err ) { <nl> - switch ( err ) { <nl> - case OK : <nl> - return " OK " ; <nl> - case InternalError : <nl> - return " InternalError " ; <nl> - case BadValue : <nl> - return " BadValue " ; <nl> - case NoSuchKey : <nl> - return " NoSuchKey " ; <nl> - case HostUnreachable : <nl> - return " HostUnreachable " ; <nl> - case HostNotFound : <nl> - return " HostNotFound " ; <nl> - case DuplicateKey : <nl> - return " DuplicateKey " ; <nl> - case GraphContainsCycle : <nl> - return " GraphContainsCycle " ; <nl> - case UnknownError : <nl> - return " UnknownError " ; <nl> - case FailedToParse : <nl> - return " FailedToParse " ; <nl> - case CannotMutateObject : <nl> - return " CannotMutateObject " ; <nl> - default : <nl> - return " Unknown error code " ; <nl> - } <nl> - } <nl> - <nl> - static bool isNetworkError ( Error err ) { <nl> - switch ( err ) { <nl> - case HostUnreachable : <nl> - case HostNotFound : <nl> - return true ; <nl> - default : <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - } ; <nl> - <nl> - } / / namespace mongo <nl> - <nl> new file mode 100644 <nl> index 000000000000 . . 4ca74b04b05a <nl> mmm / dev / null <nl> ppp b / src / mongo / base / generate_error_codes . py <nl> <nl> + # ! / usr / bin / python <nl> + <nl> + # Copyright 2012 10gen Inc . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # <nl> + <nl> + " " " Generate error_codes . { h , cpp } from error_codes . err . <nl> + <nl> + Format of error_codes . err : <nl> + <nl> + error_code ( " symbol1 " , code1 ) <nl> + error_code ( " symbol2 " , code2 ) <nl> + . . . <nl> + error_class ( " class1 " , [ " symbol1 " , " symbol2 , . . . " ] ) <nl> + <nl> + Usage : <nl> + python generate_error_codes . py < path to error_codes . err > < header file path > < source file path > <nl> + " " " <nl> + <nl> + import sys <nl> + <nl> + def main ( argv ) : <nl> + if len ( argv ) ! = 4 : <nl> + usage ( " Wrong number of arguments . " ) <nl> + <nl> + error_codes , error_classes = parse_error_definitions_from_file ( argv [ 1 ] ) <nl> + check_for_conflicts ( error_codes , error_classes ) <nl> + generate_header ( argv [ 2 ] , error_codes , error_classes ) <nl> + generate_source ( argv [ 3 ] , error_codes , error_classes ) <nl> + <nl> + def die ( message = None ) : <nl> + sys . stderr . write ( message or " Fatal error \ n " ) <nl> + sys . exit ( 1 ) <nl> + <nl> + def usage ( message = None ) : <nl> + sys . stderr . write ( __doc__ ) <nl> + die ( message ) <nl> + <nl> + def parse_error_definitions_from_file ( errors_filename ) : <nl> + errors_file = open ( errors_filename , ' r ' ) <nl> + errors_code = compile ( errors_file . read ( ) , errors_filename , ' exec ' ) <nl> + error_codes = [ ] <nl> + error_classes = [ ] <nl> + eval ( errors_code , dict ( error_code = lambda * args : error_codes . append ( args ) , <nl> + error_class = lambda * args : error_classes . append ( args ) ) ) <nl> + error_codes . sort ( key = lambda x : x [ 1 ] ) <nl> + return error_codes , error_classes <nl> + <nl> + def check_for_conflicts ( error_codes , error_classes ) : <nl> + failed = has_duplicate_error_codes ( error_codes ) <nl> + if has_duplicate_error_classes ( error_classes ) : <nl> + failed = True <nl> + if has_missing_error_codes ( error_codes , error_classes ) : <nl> + failed = True <nl> + if failed : <nl> + die ( ) <nl> + <nl> + def has_duplicate_error_codes ( error_codes ) : <nl> + sorted_by_name = sorted ( error_codes , key = lambda x : x [ 0 ] ) <nl> + sorted_by_code = sorted ( error_codes , key = lambda x : x [ 1 ] ) <nl> + <nl> + failed = False <nl> + prev_name , prev_code = sorted_by_name [ 0 ] <nl> + for name , code in sorted_by_name [ 1 : ] : <nl> + if name = = prev_name : <nl> + sys . stdout . write ( ' Duplicate name % s with codes % s and % s \ n ' % ( name , code , prev_code ) ) <nl> + failed = True <nl> + prev_name , prev_code = name , code <nl> + <nl> + prev_name , prev_code = sorted_by_code [ 0 ] <nl> + for name , code in sorted_by_code [ 1 : ] : <nl> + if code = = prev_code : <nl> + sys . stdout . write ( ' Duplicate code % s with names % s and % s \ n ' % ( code , name , prev_name ) ) <nl> + failed = True <nl> + prev_name , prev_code = name , code <nl> + <nl> + return failed <nl> + <nl> + def has_duplicate_error_classes ( error_classes ) : <nl> + names = sorted ( ec [ 0 ] for ec in error_classes ) <nl> + <nl> + failed = False <nl> + prev_name = names [ 0 ] <nl> + for name in names [ 1 : ] : <nl> + if prev_name = = name : <nl> + sys . stdout . write ( ' Duplicate error class name % s \ n ' % name ) <nl> + failed = True <nl> + prev_name = name <nl> + return failed <nl> + <nl> + def has_missing_error_codes ( error_codes , error_classes ) : <nl> + code_names = set ( ec [ 0 ] for ec in error_codes ) <nl> + failed = False <nl> + for class_name , class_code_names in error_classes : <nl> + for name in class_code_names : <nl> + if name not in code_names : <nl> + sys . stdout . write ( ' Undeclared error code % s in class % s \ n ' % ( name , class_name ) ) <nl> + failed = True <nl> + return failed <nl> + <nl> + def generate_header ( filename , error_codes , error_classes ) : <nl> + <nl> + enum_declarations = ' , \ n ' . join ( ' % s = % s ' % ec for ec in error_codes ) <nl> + predicate_declarations = ' ; \ n ' . join ( <nl> + ' static bool is % s ( Error err ) ' % ec [ 0 ] for ec in error_classes ) <nl> + <nl> + open ( filename , ' w ' ) . write ( header_template % dict ( <nl> + error_code_enum_declarations = enum_declarations , <nl> + error_code_class_predicate_declarations = predicate_declarations ) ) <nl> + <nl> + def generate_source ( filename , error_codes , error_classes ) : <nl> + symbol_to_string_cases = ' ; \ n ' . join ( ' case % s : return " % s " ' % ( ec [ 0 ] , ec [ 0 ] ) for ec in error_codes ) <nl> + predicate_definitions = ' \ n ' . join ( generate_error_class_predicate_definition ( * ec ) for ec in error_classes ) <nl> + open ( filename , ' w ' ) . write ( source_template % dict ( <nl> + symbol_to_string_cases = symbol_to_string_cases , <nl> + error_code_class_predicate_definitions = predicate_definitions ) ) <nl> + <nl> + def generate_error_class_predicate_definition ( class_name , code_names ) : <nl> + cases = ' \ n ' . join ( ' case % s : ' % c for c in code_names ) <nl> + return error_class_predicate_template % dict ( class_name = class_name , cases = cases ) <nl> + <nl> + header_template = ' ' ' / / AUTO - GENERATED FILE DO NOT EDIT <nl> + / / See src / mongo / base / generate_error_codes . py <nl> + <nl> + # pragma once <nl> + <nl> + namespace mongo { <nl> + <nl> + / * * <nl> + * This is a generated class containg a table of error codes and their corresponding error <nl> + * strings . The class is derived from the definitions in src / mongno / base / error_codes . err file . <nl> + * <nl> + * Do not update this file directly . Update src / mongo / base / error_codes . err instead . <nl> + * / <nl> + <nl> + class ErrorCodes { <nl> + public : <nl> + enum Error { <nl> + % ( error_code_enum_declarations ) s , <nl> + MaxError <nl> + } ; <nl> + <nl> + static const char * errorString ( Error err ) ; <nl> + <nl> + % ( error_code_class_predicate_declarations ) s ; <nl> + } ; <nl> + <nl> + } / / namespace mongo <nl> + ' ' ' <nl> + <nl> + source_template = ' ' ' / / AUTO - GENERATED FILE DO NOT EDIT <nl> + / / See src / mongo / base / generate_error_codes . py <nl> + <nl> + # include " mongo / base / error_codes . h " <nl> + <nl> + namespace mongo { <nl> + const char * ErrorCodes : : errorString ( Error err ) { <nl> + switch ( err ) { <nl> + % ( symbol_to_string_cases ) s ; <nl> + default : return " Unknown error code " ; <nl> + } <nl> + } <nl> + <nl> + % ( error_code_class_predicate_definitions ) s <nl> + } / / namespace mongo <nl> + ' ' ' <nl> + <nl> + error_class_predicate_template = ' ' ' bool ErrorCodes : : is % ( class_name ) s ( Error err ) { <nl> + switch ( err ) { <nl> + % ( cases ) s <nl> + return true ; <nl> + default : <nl> + return false ; <nl> + } <nl> + } <nl> + ' ' ' <nl> + if __name__ = = ' __main__ ' : <nl> + main ( sys . argv ) <nl>
Auto - generate error_codes . { h , cpp } .
mongodb/mongo
e79fc864820e67fb45f3abbe308ce6ab07043c03
2012-10-29T17:13:25Z
mmm a / tensorflow / contrib / tpu / python / tpu / async_checkpoint . py <nl> ppp b / tensorflow / contrib / tpu / python / tpu / async_checkpoint . py <nl> def before_run ( self , run_context ) : # pylint : disable = unused - argument <nl> return SessionRunArgs ( self . _global_step_tensor ) <nl> <nl> def after_run ( self , run_context , run_values ) : <nl> - stale_global_step = run_values . results <nl> - if self . _timer . should_trigger_for_step ( stale_global_step + <nl> - self . _steps_per_run ) : <nl> - # get the real value after train op . <nl> - global_step = run_context . session . run ( self . _global_step_tensor ) <nl> - if self . _timer . should_trigger_for_step ( global_step ) : <nl> - self . _timer . update_last_triggered_step ( global_step ) <nl> - if self . _save ( run_context . session , global_step ) : <nl> - run_context . request_stop ( ) <nl> + global_step = run_context . session . run ( self . _global_step_tensor ) <nl> + if self . _timer . should_trigger_for_step ( global_step ) : <nl> + self . _timer . update_last_triggered_step ( global_step ) <nl> + logging . info ( " Triggering checkpoint . % s " , global_step ) <nl> + if self . _save ( run_context . session , global_step ) : <nl> + run_context . request_stop ( ) <nl> <nl> def end ( self , session ) : <nl> if self . _save_thread : <nl>
Fix triggering of asynchronous checkpoints .
tensorflow/tensorflow
d1a23c501f95a91f74282a481ddd29c64cf6da56
2018-10-17T19:55:13Z
mmm a / format - test . cc <nl> ppp b / format - test . cc <nl> TEST ( FormatterTest , FormatExamples ) { <nl> std : : string s = writer . str ( ) ; / / s = = 0123456789 <nl> EXPECT_EQ ( " 0123456789 " , s ) ; <nl> } <nl> + <nl> + const char * filename = " nonexistent " ; <nl> + FILE * f = fopen ( filename , " r " ) ; <nl> + if ( ! f ) <nl> + fmt : : ThrowSystemError ( errno , " Cannot open file ' { } ' " ) < < filename ; <nl> } <nl> <nl> TEST ( FormatterTest , StrNamespace ) { <nl> TEST ( FormatterTest , FileSinkWriteError ) { <nl> std : : fclose ( f ) ; <nl> } <nl> <nl> - / / TODO : test SystemErrorSink , ThrowSystemError , CErrorSink , ThrowCError . <nl> + / / TODO : test SystemErrorSink , ThrowSystemError , CErrorSink , ThrowWinError . <nl> <nl> / / The test doesn ' t compile on older compilers which follow C + + 03 and <nl> / / require an accessible copy constructor when binding a temporary to <nl> mmm a / format . cc <nl> ppp b / format . cc <nl> inline int FMT_SNPRINTF ( char * buffer , size_t size , const char * format , . . . ) { <nl> <nl> const char RESET_COLOR [ ] = " \ x1b [ 0m " ; <nl> <nl> - void FormatCErrorMessage ( <nl> + void FormatSystemErrorMessage ( <nl> fmt : : Writer & out , int error_code , fmt : : StringRef message ) { <nl> fmt : : internal : : Array < char , fmt : : internal : : INLINE_BUFFER_SIZE > buffer ; <nl> buffer . resize ( fmt : : internal : : INLINE_BUFFER_SIZE ) ; <nl> void FormatCErrorMessage ( <nl> out < < message < < " : " < < system_message ; <nl> } <nl> <nl> - void FormatSystemErrorMessage ( <nl> + # ifdef _WIN32 <nl> + void FormatWinErrorMessage ( <nl> fmt : : Writer & out , int error_code , fmt : : StringRef message ) { <nl> - # ifndef _WIN32 <nl> - FormatCErrorMessage ( out , error_code , message ) ; <nl> - # else <nl> class String { <nl> private : <nl> LPWSTR str_ ; <nl> void FormatSystemErrorMessage ( <nl> } <nl> / / Can ' t get error message , report error code instead . <nl> out < < message < < " : error code = " < < error_code ; <nl> - # endif <nl> } <nl> + # endif <nl> } <nl> <nl> template < typename T > <nl> void fmt : : SystemErrorSink : : operator ( ) ( const fmt : : Writer & w ) const { <nl> throw SystemError ( message . c_str ( ) , error_code_ ) ; <nl> } <nl> <nl> - void fmt : : CErrorSink : : operator ( ) ( const Writer & w ) const { <nl> + # ifdef _WIN32 <nl> + void fmt : : WinErrorSink : : operator ( ) ( const Writer & w ) const { <nl> Writer message ; <nl> - FormatCErrorMessage ( message , error_code_ , w . c_str ( ) ) ; <nl> + FormatWinErrorMessage ( message , error_code_ , w . c_str ( ) ) ; <nl> throw SystemError ( message . c_str ( ) , error_code_ ) ; <nl> } <nl> + # endif <nl> <nl> void fmt : : ANSITerminalSink : : operator ( ) ( <nl> const fmt : : BasicWriter < char > & w ) const { <nl> mmm a / format . h <nl> ppp b / format . h <nl> inline Formatter < NullSink , wchar_t > Format ( WStringRef format ) { <nl> <nl> / * * <nl> A sink that gets the error message corresponding to a system error code <nl> - and throws SystemError . <nl> + as given by errno and throws SystemError . <nl> * / <nl> class SystemErrorSink { <nl> private : <nl> class SystemErrorSink { <nl> Formats a message and throws SystemError with the description of the form <nl> " < message > : < system - message > " , where < message > is the formatted message and <nl> < system - message > is the system message corresponding to the error code . <nl> - error_code is a system error code as given by errno for POSIX and <nl> - GetLastError for Windows . <nl> + error_code is a system error code as given by errno . <nl> * / <nl> inline Formatter < SystemErrorSink > ThrowSystemError ( <nl> int error_code , StringRef format ) { <nl> inline Formatter < SystemErrorSink > ThrowSystemError ( <nl> } <nl> <nl> / * * <nl> - A sink that gets the error message corresponding to a standard C library <nl> - error code as given by errno and throws SystemError . <nl> + A sink that gets the error message corresponding to a Windows error code <nl> + as given by GetLastError and throws SystemError . <nl> * / <nl> - class CErrorSink { <nl> + class WinErrorSink { <nl> private : <nl> int error_code_ ; <nl> <nl> public : <nl> - explicit CErrorSink ( int error_code ) : error_code_ ( error_code ) { } <nl> + explicit WinErrorSink ( int error_code ) : error_code_ ( error_code ) { } <nl> <nl> void operator ( ) ( const Writer & w ) const ; <nl> } ; <nl> class CErrorSink { <nl> Formats a message and throws SystemError with the description of the form <nl> " < message > : < system - message > " , where < message > is the formatted message and <nl> < system - message > is the system message corresponding to the error code . <nl> - error_code is an error code as given by errno after calling a C library <nl> - function . <nl> + error_code is a Windows error code as given by GetLastError . <nl> * / <nl> - inline Formatter < CErrorSink > ThrowCError ( int error_code , StringRef format ) { <nl> - Formatter < CErrorSink > f ( format , CErrorSink ( error_code ) ) ; <nl> + inline Formatter < WinErrorSink > ThrowWinError ( int error_code , StringRef format ) { <nl> + Formatter < WinErrorSink > f ( format , WinErrorSink ( error_code ) ) ; <nl> return f ; <nl> } <nl> <nl> class FileSink { <nl> / * * Writes the output to a file . * / <nl> void operator ( ) ( const BasicWriter < char > & w ) const { <nl> if ( std : : fwrite ( w . data ( ) , w . size ( ) , 1 , file_ ) = = 0 ) <nl> - ThrowCError ( errno , " cannot write to file " ) ; <nl> + ThrowSystemError ( errno , " cannot write to file " ) ; <nl> } <nl> } ; <nl> <nl>
CError - > WinError
fmtlib/fmt
400812a905f11e808a5addbe532a226b8c50796f
2014-04-30T19:38:17Z
mmm a / arangosh / V8Client / arangosh . cpp <nl> ppp b / arangosh / V8Client / arangosh . cpp <nl> using namespace arangodb ; <nl> / / / @ brief command prompt <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - static std : : string Prompt = " arangosh [ % d ] > " ; <nl> + static std : : string Prompt = " % E @ % d > " ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief base class for clients <nl>
changed arangosh default prompt
arangodb/arangodb
1168ef98d4e71fab98344f1953ed5c6679264dbb
2016-02-18T14:39:22Z
mmm a / include / swift / SIL / SILCloner . h <nl> ppp b / include / swift / SIL / SILCloner . h <nl> template < typename ImplClass > <nl> void SILCloner < ImplClass > : : visitUnmanagedRetainValueInst ( <nl> UnmanagedRetainValueInst * Inst ) { <nl> getBuilder ( ) . setCurrentDebugScope ( getOpScope ( Inst - > getDebugScope ( ) ) ) ; <nl> + if ( ! getBuilder ( ) . hasOwnership ( ) ) { <nl> + return recordClonedInstruction ( <nl> + Inst , getBuilder ( ) . createRetainValue ( getOpLocation ( Inst - > getLoc ( ) ) , <nl> + getOpValue ( Inst - > getOperand ( ) ) , <nl> + Inst - > getAtomicity ( ) ) ) ; <nl> + } <nl> + <nl> recordClonedInstruction ( Inst , getBuilder ( ) . createUnmanagedRetainValue ( <nl> getOpLocation ( Inst - > getLoc ( ) ) , <nl> getOpValue ( Inst - > getOperand ( ) ) , <nl> template < typename ImplClass > <nl> void SILCloner < ImplClass > : : visitUnmanagedReleaseValueInst ( <nl> UnmanagedReleaseValueInst * Inst ) { <nl> getBuilder ( ) . setCurrentDebugScope ( getOpScope ( Inst - > getDebugScope ( ) ) ) ; <nl> + if ( ! getBuilder ( ) . hasOwnership ( ) ) { <nl> + return recordClonedInstruction ( <nl> + Inst , getBuilder ( ) . createReleaseValue ( getOpLocation ( Inst - > getLoc ( ) ) , <nl> + getOpValue ( Inst - > getOperand ( ) ) , <nl> + Inst - > getAtomicity ( ) ) ) ; <nl> + } <nl> recordClonedInstruction ( Inst , getBuilder ( ) . createUnmanagedReleaseValue ( <nl> getOpLocation ( Inst - > getLoc ( ) ) , <nl> getOpValue ( Inst - > getOperand ( ) ) , <nl> mmm a / test / SILOptimizer / mandatory_inlining_ossa_to_non_ossa . sil <nl> ppp b / test / SILOptimizer / mandatory_inlining_ossa_to_non_ossa . sil <nl> bb0 ( % 0 : $ Builtin . NativeObject ) : <nl> % 9999 = tuple ( ) <nl> return % 9999 : $ ( ) <nl> } <nl> + <nl> + / / Test out functionality that we use to work around weird semantics of <nl> + / / destructors . <nl> + sil [ ossa ] [ transparent ] @ unmanaged_rr_callee : $ @ convention ( thin ) ( @ guaranteed Builtin . NativeObject ) - > ( ) { <nl> + bb0 ( % 0 : @ guaranteed $ Builtin . NativeObject ) : <nl> + unmanaged_retain_value % 0 : $ Builtin . NativeObject <nl> + unmanaged_release_value % 0 : $ Builtin . NativeObject <nl> + % 9999 = tuple ( ) <nl> + return % 9999 : $ ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : sil @ unmanaged_rr_caller : $ @ convention ( thin ) ( @ guaranteed Builtin . NativeObject ) - > ( ) { <nl> + / / CHECK : bb0 ( [ [ ARG : % . * ] ] : <nl> + / / CHECK - NEXT : retain_value [ [ ARG ] ] <nl> + / / CHECK - NEXT : release_value [ [ ARG ] ] <nl> + / / CHECK - NEXT : tuple <nl> + / / CHECK - NEXT : tuple <nl> + / / CHECK - NEXT : return <nl> + / / CHECK : } / / end sil function ' unmanaged_rr_caller ' <nl> + sil @ unmanaged_rr_caller : $ @ convention ( thin ) ( @ guaranteed Builtin . NativeObject ) - > ( ) { <nl> + bb0 ( % 0 : $ Builtin . NativeObject ) : <nl> + % 1 = function_ref @ unmanaged_rr_callee : $ @ convention ( thin ) ( @ guaranteed Builtin . NativeObject ) - > ( ) <nl> + apply % 1 ( % 0 ) : $ @ convention ( thin ) ( @ guaranteed Builtin . NativeObject ) - > ( ) <nl> + % 9999 = tuple ( ) <nl> + return % 9999 : $ ( ) <nl> + } <nl> + <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
5ffd790c6d1a31714535f2955ab3d6dcafe2ec35
2019-01-31T21:49:26Z
mmm a / README . md <nl> ppp b / README . md <nl> cocos2d - x <nl> | | iOS | Mac | Linux | Win32 | Android | Win8 . 1 - Universal | <nl> | mmm - | mmm - | mmm - - | mmm | mmm - | mmmmmm | mmm | <nl> | v3 | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = ios ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = ios ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = mac ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = mac ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = linux ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = linux ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = win32_bak ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = win32_bak ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = android ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = android ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v3 / node = windows - universal_bak ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v3 / node = windows - universal_bak ) | <nl> - | v4 | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = ios ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = ios ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = mac ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = mac ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = linux ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = linux ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = win32_bak ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = win32_bak ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = android ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = android ) | [ ! [ Build Status ] ( http : / / 45 . 56 . 80 . 45 : 8080 / buildStatus / icon ? job = daily - build - v4 / node = windows - universal_bak ) ] ( http : / / 45 . 56 . 80 . 45 : 8080 / job / daily - build - v4 / node = windows - universal_bak ) | <nl> - <nl> <nl> <nl> [ cocos2d - x ] [ 1 ] is a multi - platform framework for building 2d games , interactive books , demos and other graphical applications . <nl>
Update README . md . ( )
cocos2d/cocos2d-x
54285ac2bd703a2e68029965b98faf26c9102036
2017-03-16T07:13:17Z
mmm a / test / es5conform / es5conform . status <nl> ppp b / test / es5conform / es5conform . status <nl> chapter13 : UNIMPLEMENTED <nl> chapter14 : UNIMPLEMENTED <nl> chapter15 / 15 . 1 : UNIMPLEMENTED <nl> chapter15 / 15 . 2 / 15 . 2 . 3 / 15 . 2 . 3 . 1 : UNIMPLEMENTED <nl> - chapter15 / 15 . 2 / 15 . 2 . 3 / 15 . 2 . 3 . 5 : UNIMPLEMENTED <nl> chapter15 / 15 . 2 / 15 . 2 . 3 / 15 . 2 . 3 . 8 : UNIMPLEMENTED <nl> chapter15 / 15 . 2 / 15 . 2 . 3 / 15 . 2 . 3 . 9 : UNIMPLEMENTED <nl> chapter15 / 15 . 2 / 15 . 2 . 3 / 15 . 2 . 3 . 10 : UNIMPLEMENTED <nl>
Enable Object . create tests since we implement this correctly ( since 3786 i guess , it was enabled in 3438 but did not function correctly because DefineOwnProperty was not implemented fully according to spec ) .
v8/v8
29c330e8e9e41d4e060bbeadb272f08fe9c3a50c
2010-04-28T08:04:39Z
mmm a / appveyor . yml <nl> ppp b / appveyor . yml <nl> artifacts : <nl> - path : build \ bin \ Release <nl> # - path : build <nl> name : tesseract - $ ( APPVEYOR_BUILD_VERSION ) <nl> - <nl>
Update appveyor . yml
tesseract-ocr/tesseract
59dc3e627e087776034ec64fdff3e1300dd7ab15
2018-03-05T11:20:49Z
mmm a / src / isolate . h <nl> ppp b / src / isolate . h <nl> class Isolate { <nl> thread_local_top_ . save_context_ = save ; <nl> } <nl> <nl> - / / Access to the map of " new Object ( ) " . <nl> - Map * empty_object_map ( ) { <nl> - return context ( ) - > native_context ( ) - > object_function ( ) - > map ( ) ; <nl> - } <nl> - <nl> / / Access to current thread id . <nl> ThreadId thread_id ( ) { return thread_local_top_ . thread_id_ ; } <nl> void set_thread_id ( ThreadId id ) { thread_local_top_ . thread_id_ = id ; } <nl> mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> MaybeObject * JSObject : : AddFastProperty ( String * name , <nl> if ( ! maybe_values - > To ( & values ) ) return maybe_values ; <nl> } <nl> <nl> - / / Only allow map transition if the object isn ' t the global object . <nl> - TransitionFlag flag = isolate - > empty_object_map ( ) ! = map ( ) <nl> - ? INSERT_TRANSITION <nl> - : OMIT_TRANSITION ; <nl> + TransitionFlag flag = INSERT_TRANSITION ; <nl> <nl> Map * new_map ; <nl> MaybeObject * maybe_new_map = map ( ) - > CopyAddDescriptor ( & new_field , flag ) ; <nl> MaybeObject * JSObject : : AddConstantFunctionProperty ( <nl> / / Allocate new instance descriptors with ( name , function ) added <nl> ConstantFunctionDescriptor d ( name , function , attributes , 0 ) ; <nl> <nl> - Heap * heap = GetHeap ( ) ; <nl> TransitionFlag flag = <nl> - / / Do not add transitions to the empty object map ( map of " new Object ( ) " ) , <nl> - / / nor to global objects . <nl> - ( map ( ) = = heap - > isolate ( ) - > empty_object_map ( ) | | IsGlobalObject ( ) | | <nl> + / / Do not add transitions to global objects . <nl> + ( IsGlobalObject ( ) | | <nl> / / Don ' t add transitions to special properties with non - trivial <nl> / / attributes . <nl> - / / TODO ( verwaest ) : Once we support attribute changes , these transitions <nl> - / / should be kept as well . <nl> attributes ! = NONE ) <nl> ? OMIT_TRANSITION <nl> : INSERT_TRANSITION ; <nl> MaybeObject * JSObject : : ConvertTransitionToMapTransition ( <nl> <nl> if ( ! HasFastProperties ( ) ) return result ; <nl> <nl> - / / This method should only be used to convert existing transitions . Objects <nl> - / / with the map of " new Object ( ) " cannot have transitions in the first place . <nl> + / / This method should only be used to convert existing transitions . <nl> Map * new_map = map ( ) ; <nl> - ASSERT ( new_map ! = GetIsolate ( ) - > empty_object_map ( ) ) ; <nl> <nl> / / TODO ( verwaest ) : From here on we lose existing map transitions , causing <nl> / / invalid back pointers . This will change once we can store multiple <nl> MaybeObject * JSObject : : GetElementsTransitionMapSlow ( ElementsKind to_kind ) { <nl> } <nl> <nl> bool allow_store_transition = <nl> - / / Only remember the map transition if the object ' s map is NOT equal to <nl> - / / the global object_function ' s map and there is not an already existing <nl> + / / Only remember the map transition if there is not an already existing <nl> / / non - matching element transition . <nl> - ( GetIsolate ( ) - > empty_object_map ( ) ! = map ( ) ) & & <nl> ! start_map - > IsUndefined ( ) & & ! start_map - > is_shared ( ) & & <nl> IsFastElementsKind ( from_kind ) ; <nl> <nl>
Also allow the empty object map to keep transitions .
v8/v8
e7420f65bcb22d6ec64f5cb3bc19a8b31589750d
2013-01-30T15:07:58Z
mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> void MarkCompactCollector : : ProcessEphemeronsLinear ( ) { <nl> / / is necessary . <nl> <nl> work_to_do = ! marking_worklist ( ) - > IsEmpty ( ) | | <nl> + ! marking_worklist ( ) - > IsEmbedderEmpty ( ) | | <nl> ! heap ( ) - > local_embedder_heap_tracer ( ) - > IsRemoteTracingDone ( ) ; <nl> CHECK ( weak_objects_ . discovered_ephemerons . IsEmpty ( ) ) ; <nl> } <nl>
heap : Consider embedder objects when linearly processing ephemerons
v8/v8
b1a91ce5430e48fa1ec2d468588701f947a38a91
2019-04-01T10:51:56Z
mmm a / lite - example / example . cpp <nl> ppp b / lite - example / example . cpp <nl> int main ( ) <nl> l . info_printf ( " Hello % d " , 12346 ) ; <nl> l . warn_printf ( " Hello % f " , 12346 . 5656 ) ; <nl> l . warn ( " Hello { } " , " LITE : ) " ) ; <nl> + <nl> + auto l2 = l . clone ( " logger2 " ) ; <nl> + l2 . debug ( " HELLO " ) ; <nl> + <nl> } <nl> \ No newline at end of file <nl> mmm a / lite / spdlite . cpp <nl> ppp b / lite / spdlite . cpp <nl> void spdlog : : lite : : logger : : set_pattern ( std : : string pattern ) <nl> impl_ - > set_pattern ( std : : move ( pattern ) ) ; <nl> } <nl> <nl> + spdlog : : lite : : logger spdlog : : lite : : logger : : clone ( std : : string logger_name ) <nl> + { <nl> + return spdlog : : lite : : logger ( impl_ - > clone ( std : : move ( logger_name ) ) ) ; <nl> + } <nl> + <nl> void spdlog : : lite : : logger : : log_formatted_ ( spdlog : : lite : : level lvl , const fmt : : memory_buffer & formatted ) <nl> { <nl> auto spd_level = to_spdlog_level ( lvl ) ; <nl> mmm a / lite / spdlite . h <nl> ppp b / lite / spdlite . h <nl> class logger <nl> / / <nl> void set_pattern ( std : : string pattern ) ; <nl> <nl> + / / <nl> + / / clone with new name <nl> + / / <nl> + spdlog : : lite : : logger clone ( std : : string logger_name ) ; <nl> + <nl> protected : <nl> std : : shared_ptr < spdlog : : logger > impl_ ; <nl> void log_formatted_ ( lite : : level lvl , const fmt : : memory_buffer & formatted ) ; <nl>
clone support in lite logger
gabime/spdlog
4ccca079a56102060006761c0f59c8f6c7dd9234
2019-03-23T23:40:20Z
mmm a / CHANGELOG . md <nl> ppp b / CHANGELOG . md <nl> Swift 2 . 2 <nl> * Associated types in protocols can now be specified with a new ' associatedtype ' <nl> declaration , to replace the use of ' typealias ' : <nl> <nl> + ` ` ` <nl> protocol P { <nl> associatedtype Ty <nl> } <nl> + ` ` ` <nl> <nl> The typealias keyword is still allowed ( but deprecated and produces a warning ) <nl> in Swift 2 . 2 . This warning will become an error in Swift 3 . <nl> Swift 2 . 2 <nl> Swift 3 . <nl> <nl> * The + + and - - operators have been deprecated , and are slated to be removed in <nl> - Swift 3 . 0 . As a replacement , please use " x + = 1 " on integer or floating point <nl> - types , and " x = x . successor ( ) " on Index types . <nl> + Swift 3 . 0 . As a replacement , please use " ` x + = 1 ` " on integer or floating point <nl> + types , and " ` x = x . successor ( ) ` " on Index types . <nl> <nl> * The implicit tuple splat behavior in function application has been deprecated <nl> and will be removed in Swift 3 . 0 . For example , this code : <nl> <nl> + ` ` ` <nl> func foo ( a : Int , b : Int ) { . . . } <nl> let x = ( 1 , b : 2 ) <nl> foo ( x ) / / Warning , deprecated . <nl> + ` ` ` <nl> <nl> should move to being written as : <nl> + ` ` ` <nl> foo ( x . 0 , x . b ) <nl> + ` ` ` <nl> <nl> For more information and rationale , see <nl> [ SE - 0029 ] ( https : / / github . com / apple / swift - evolution / blob / master / proposals / 0029 - remove - implicit - tuple - splat . md ) . <nl>
prettify the changelog a bit . More could be done here if someone is interested .
apple/swift
8cb13ba2f3c38776ecf72499981fa3fce413dbac
2016-02-10T21:28:54Z
mmm a / include / server . h <nl> ppp b / include / server . h <nl> void swServer_store_listen_socket ( swServer * serv ) ; <nl> int swServer_get_manager_pid ( swServer * serv ) ; <nl> int swServer_get_socket ( swServer * serv , int port ) ; <nl> int swServer_worker_init ( swServer * serv , swWorker * worker ) ; <nl> + void swServer_worker_start ( swServer * serv , swWorker * worker ) ; <nl> swString * * swServer_create_worker_buffer ( swServer * serv ) ; <nl> int swServer_create_task_worker ( swServer * serv ) ; <nl> void swServer_enable_accept ( swReactor * reactor ) ; <nl> mmm a / include / swoole . h <nl> ppp b / include / swoole . h <nl> enum swGlobal_hook_type <nl> { <nl> SW_GLOBAL_HOOK_BEFORE_SERVER_START , <nl> SW_GLOBAL_HOOK_BEFORE_CLIENT_START , <nl> + SW_GLOBAL_HOOK_BEFORE_WORKER_START , <nl> SW_GLOBAL_HOOK_ON_CORO_START , <nl> SW_GLOBAL_HOOK_ON_CORO_STOP , <nl> } ; <nl> mmm a / src / network / reactor_process . c <nl> ppp b / src / network / reactor_process . c <nl> static int swReactorProcess_loop ( swProcessPool * pool , swWorker * worker ) <nl> return SW_ERR ; <nl> } <nl> <nl> - / * * <nl> - * call internal serv hooks <nl> - * / <nl> - if ( SwooleG . serv - > hooks [ SW_SERVER_HOOK_WORKER_START ] ) <nl> - { <nl> - void * hook_args [ 2 ] ; <nl> - hook_args [ 0 ] = serv ; <nl> - hook_args [ 1 ] = ( void * ) ( uintptr_t ) SwooleWG . id ; <nl> - swServer_call_hook ( serv , SW_SERVER_HOOK_WORKER_START , hook_args ) ; <nl> - } <nl> - <nl> - if ( serv - > onWorkerStart ) <nl> - { <nl> - serv - > onWorkerStart ( serv , worker - > id ) ; <nl> - } <nl> + swServer_worker_start ( serv , worker ) ; <nl> <nl> / * * <nl> * for heartbeat check <nl> mmm a / src / network / server . c <nl> ppp b / src / network / server . c <nl> int swServer_worker_init ( swServer * serv , swWorker * worker ) <nl> return SW_OK ; <nl> } <nl> <nl> + void swServer_worker_start ( swServer * serv , swWorker * worker ) <nl> + { <nl> + void * hook_args [ 2 ] ; <nl> + hook_args [ 0 ] = serv ; <nl> + hook_args [ 1 ] = ( void * ) ( uintptr_t ) worker - > id ; <nl> + <nl> + if ( SwooleG . hooks [ SW_GLOBAL_HOOK_BEFORE_WORKER_START ] ) <nl> + { <nl> + swoole_call_hook ( SW_GLOBAL_HOOK_BEFORE_WORKER_START , hook_args ) ; <nl> + } <nl> + if ( SwooleG . serv - > hooks [ SW_SERVER_HOOK_WORKER_START ] ) <nl> + { <nl> + swServer_call_hook ( serv , SW_SERVER_HOOK_WORKER_START , hook_args ) ; <nl> + } <nl> + if ( serv - > onWorkerStart ) <nl> + { <nl> + serv - > onWorkerStart ( serv , worker - > id ) ; <nl> + } <nl> + } <nl> + <nl> void swServer_reopen_log_file ( swServer * serv ) <nl> { <nl> if ( ! SwooleG . log_file ) <nl> mmm a / src / network / worker . c <nl> ppp b / src / network / worker . c <nl> int swWorker_onTask ( swFactory * factory , swEventData * task ) <nl> <nl> void swWorker_onStart ( swServer * serv ) <nl> { <nl> - / * * <nl> - * Release other worker process <nl> - * / <nl> swWorker * worker ; <nl> <nl> - / * * <nl> - * call internal serv hooks <nl> - * / <nl> - if ( SwooleG . serv - > hooks [ SW_SERVER_HOOK_WORKER_START ] ) <nl> - { <nl> - void * hook_args [ 2 ] ; <nl> - hook_args [ 0 ] = serv ; <nl> - hook_args [ 1 ] = ( void * ) ( uintptr_t ) SwooleWG . id ; <nl> - swServer_call_hook ( serv , SW_SERVER_HOOK_WORKER_START , hook_args ) ; <nl> - } <nl> - <nl> if ( SwooleWG . id > = serv - > worker_num ) <nl> { <nl> SwooleG . process_type = SW_PROCESS_TASKWORKER ; <nl> void swWorker_onStart ( swServer * serv ) <nl> SwooleWG . worker - > status = SW_WORKER_IDLE ; <nl> sw_shm_protect ( serv - > session_list , PROT_READ ) ; <nl> <nl> - if ( serv - > onWorkerStart ) <nl> - { <nl> - serv - > onWorkerStart ( serv , SwooleWG . id ) ; <nl> - } <nl> + swServer_worker_start ( serv , worker ) ; <nl> } <nl> <nl> void swWorker_onStop ( swServer * serv ) <nl>
added SW_GLOBAL_HOOK_BEFORE_WORKER_START
swoole/swoole-src
31692fda603528dcd6ccadf81fc57fa8f012e82d
2018-11-29T04:09:29Z
mmm a / test / IRGen / async / partial_apply . sil <nl> ppp b / test / IRGen / async / partial_apply . sil <nl> bb0 ( % 0 : $ * A2 < A3 > ) : <nl> return % 5 : $ @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) <nl> } <nl> <nl> - sil @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> - <nl> - / / CHECK - LABEL : define { { . * } } swiftcc i8 * @ partial_apply_stack_in_coroutine ( i8 * { { . * } } % 0 , % T13partial_apply2A3C * % 1 ) <nl> - sil @ partial_apply_stack_in_coroutine : $ @ yield_once ( @ owned A3 ) - > ( ) { <nl> - entry ( % 0 : $ A3 ) : <nl> - % f = function_ref @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> - % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % 0 ) : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> - apply % p ( ) : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> - dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> - % 1000 = integer_literal $ Builtin . Int32 , 1000 <nl> - yield ( ) , resume resume , unwind unwind <nl> - <nl> - resume : <nl> - % ret = tuple ( ) <nl> - return % ret : $ ( ) <nl> - <nl> - unwind : <nl> - unwind <nl> - } <nl> + / / sil @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + / / <nl> + / / / / CHECK LABEL : define { { . * } } swiftcc i8 * @ partial_apply_stack_in_coroutine ( i8 * { { . * } } % 0 , % T13partial_apply2A3C * % 1 ) <nl> + / / sil @ partial_apply_stack_in_coroutine : $ @ async @ yield_once ( @ owned A3 ) - > ( ) { <nl> + / / entry ( % 0 : $ A3 ) : <nl> + / / % f = function_ref @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + / / % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % 0 ) : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + / / apply % p ( ) : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + / / dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + / / % 1000 = integer_literal $ Builtin . Int32 , 1000 <nl> + / / yield ( ) , resume resume , unwind unwind <nl> + / / <nl> + / / resume : <nl> + / / % ret = tuple ( ) <nl> + / / return % ret : $ ( ) <nl> + / / <nl> + / / unwind : <nl> + / / unwind <nl> + / / } <nl> sil_vtable A3 { } <nl> <nl> <nl> mmm a / test / IRGen / async / run - call - classinstance - int64 - to - void . sil <nl> ppp b / test / IRGen / async / run - call - classinstance - int64 - to - void . sil <nl> class S { <nl> / / CHECK - LL : define hidden swiftcc void @ classinstanceSInt64ToVoid ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> sil hidden @ classinstanceSInt64ToVoid : $ @ async @ convention ( method ) ( Int64 , @ guaranteed S ) - > ( ) { <nl> bb0 ( % int : $ Int64 , % instance : $ S ) : <nl> - % take_s = function_ref @ take_S : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> - % result = apply % take_s ( % instance ) : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> + % take_s = function_ref @ take_S : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> + % result = apply % take_s ( % instance ) : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil hidden @ take_S : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) { <nl> + sil hidden @ take_S : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) { <nl> bb0 ( % instance : $ S ) : <nl> % any = alloc_stack $ Any <nl> strong_retain % instance : $ S <nl> mmm a / test / IRGen / async / run - call - classinstance - void - to - void . sil <nl> ppp b / test / IRGen / async / run - call - classinstance - void - to - void . sil <nl> class S { <nl> / / CHECK - LL : define hidden swiftcc void @ classinstanceSVoidToVoid ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> sil hidden @ classinstanceSVoidToVoid : $ @ async @ convention ( method ) ( @ guaranteed S ) - > ( ) { <nl> bb0 ( % instance : $ S ) : <nl> - % take_s = function_ref @ take_S : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> - % result = apply % take_s ( % instance ) : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> + % take_s = function_ref @ take_S : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> + % result = apply % take_s ( % instance ) : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil hidden @ take_S : $ @ convention ( thin ) ( @ guaranteed S ) - > ( ) { <nl> + sil hidden @ take_S : $ @ async @ convention ( thin ) ( @ guaranteed S ) - > ( ) { <nl> bb0 ( % instance : $ S ) : <nl> % any = alloc_stack $ Any <nl> strong_retain % instance : $ S <nl> mmm a / test / IRGen / async / run - call - existential - to - void . sil <nl> ppp b / test / IRGen / async / run - call - existential - to - void . sil <nl> bb0 ( % existential : $ * P ) : <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % S_type = metatype $ @ thin S . Type <nl> % int_literal = integer_literal $ Builtin . Int64 , 7384783 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 7384783 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 7384783 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - structinstance - int64 - to - void . sil <nl> ppp b / test / IRGen / async / run - call - structinstance - int64 - to - void . sil <nl> struct S { <nl> / / CHECK - LL : define hidden swiftcc void @ structinstanceSInt64ToVoid ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> sil hidden @ structinstanceSInt64ToVoid : $ @ async @ convention ( method ) ( Int64 , S ) - > ( ) { <nl> bb0 ( % int : $ Int64 , % self : $ S ) : <nl> - % takeSAndInt64 = function_ref @ takeSAndInt64 : $ @ convention ( thin ) ( S , Int64 ) - > ( ) <nl> - % takeSAndInt64_result = apply % takeSAndInt64 ( % self , % int ) : $ @ convention ( thin ) ( S , Int64 ) - > ( ) <nl> + % takeSAndInt64 = function_ref @ takeSAndInt64 : $ @ async @ convention ( thin ) ( S , Int64 ) - > ( ) <nl> + % takeSAndInt64_result = apply % takeSAndInt64 ( % self , % int ) : $ @ async @ convention ( thin ) ( S , Int64 ) - > ( ) <nl> % out = tuple ( ) <nl> return % out : $ ( ) <nl> } <nl> <nl> - sil hidden @ takeSAndInt64 : $ @ convention ( thin ) ( S , Int64 ) - > ( ) { <nl> + sil hidden @ takeSAndInt64 : $ @ async @ convention ( thin ) ( S , Int64 ) - > ( ) { <nl> bb0 ( % self : $ S , % int : $ Int64 ) : <nl> % s_addr = alloc_stack $ S <nl> store % self to % s_addr : $ * S <nl> mmm a / test / IRGen / async / run - call - void - throws - to - int - throwing . sil <nl> ppp b / test / IRGen / async / run - call - void - throws - to - int - throwing . sil <nl> sil_witness_table hidden E : Error module main { <nl> } <nl> <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % voidThrowsToInt = function_ref @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) <nl> try_apply % voidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) , normal bb1 , error bb3 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - throws - to - int - throwing_call - async - nothrow_call - sync - throw . sil <nl> ppp b / test / IRGen / async / run - call - void - throws - to - int - throwing_call - async - nothrow_call - sync - throw . sil <nl> sil_witness_table hidden E : Error module main { <nl> } <nl> <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % voidThrowsToInt = function_ref @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> try_apply % voidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal bb1 , error bb3 <nl> entry : <nl> % asyncVoidThrowsToInt = function_ref @ asyncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> try_apply % asyncVoidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success1 , error error1 <nl> success1 ( % out1 : $ Int64 ) : <nl> - % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> - try_apply % syncVoidThrowsToInt ( ) : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success2 , error error2 <nl> + % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> + try_apply % syncVoidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success2 , error error2 <nl> success2 ( % out : $ Int64 ) : <nl> return % out : $ Int64 <nl> error1 ( % error1 : $ Error ) : <nl> error ( % error : $ Error ) : <nl> throw % error : $ Error <nl> } <nl> <nl> - sil hidden @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) { <nl> + sil hidden @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) { <nl> bb0 : <nl> % e_type = metatype $ @ thin E . Type <nl> % int_literal = integer_literal $ Builtin . Int64 , 42 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - throws - to - int - throwing_call - async - throw . sil <nl> ppp b / test / IRGen / async / run - call - void - throws - to - int - throwing_call - async - throw . sil <nl> sil_witness_table hidden E : Error module main { <nl> } <nl> <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % voidThrowsToInt = function_ref @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) <nl> try_apply % voidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) , normal bb1 , error bb3 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - throws - to - int - throwing_call - sync - nothrow_call - async - throw . sil <nl> ppp b / test / IRGen / async / run - call - void - throws - to - int - throwing_call - sync - nothrow_call - async - throw . sil <nl> sil_witness_table hidden E : Error module main { <nl> } <nl> <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % voidThrowsToInt = function_ref @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> try_apply % voidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal bb1 , error bb3 <nl> bb5 : <nl> / / CHECK - LL : define hidden swiftcc void @ voidThrowsToInt ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> sil hidden @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) { <nl> entry : <nl> - % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> - try_apply % syncVoidThrowsToInt ( ) : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success1 , error error1 <nl> + % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> + try_apply % syncVoidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success1 , error error1 <nl> success1 ( % out1 : $ Int64 ) : <nl> % asyncVoidThrowsToInt = function_ref @ asyncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) <nl> try_apply % asyncVoidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) , normal success2 , error error2 <nl> error ( % error : $ Error ) : <nl> throw % error : $ Error <nl> } <nl> <nl> - sil hidden @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) { <nl> + sil hidden @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int64 , @ error Error ) { <nl> bb0 : <nl> % int_literal = integer_literal $ Builtin . Int64 , 1 / / user : % 2 <nl> % Int64 = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) / / user : % 3 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - throws - to - int - throwing_call - sync - throw . sil <nl> ppp b / test / IRGen / async / run - call - void - throws - to - int - throwing_call - sync - throw . sil <nl> sil_witness_table hidden E : Error module main { <nl> } <nl> <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % voidThrowsToInt = function_ref @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) <nl> try_apply % voidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) , normal bb1 , error bb3 <nl> bb5 : <nl> / / CHECK - LL : define hidden swiftcc void @ voidThrowsToInt ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> sil hidden @ voidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) { <nl> bb0 : <nl> - % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int , @ error Error ) <nl> - try_apply % syncVoidThrowsToInt ( ) : $ @ convention ( thin ) ( ) - > ( Int , @ error Error ) , normal bb1 , error bb2 <nl> + % syncVoidThrowsToInt = function_ref @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) <nl> + try_apply % syncVoidThrowsToInt ( ) : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) , normal bb1 , error bb2 <nl> bb1 ( % out : $ Int ) : <nl> return % out : $ Int <nl> bb2 ( % error : $ Error ) : <nl> throw % error : $ Error <nl> } <nl> <nl> - sil hidden @ syncVoidThrowsToInt : $ @ convention ( thin ) ( ) - > ( Int , @ error Error ) { <nl> + sil hidden @ syncVoidThrowsToInt : $ @ async @ convention ( thin ) ( ) - > ( Int , @ error Error ) { <nl> bb0 : <nl> % e_type = metatype $ @ thin E . Type <nl> % int_literal = integer_literal $ Builtin . Int64 , 42 <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : 42 <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - to - existential . sil <nl> ppp b / test / IRGen / async / run - call - void - to - existential . sil <nl> bb0 ( % out : $ * P ) : <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil hidden @ call : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ call : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % existential = alloc_stack $ P <nl> % voidToExistential = function_ref @ voidToExistential : $ @ async @ convention ( thin ) ( ) - > @ out P <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % call = function_ref @ call : $ @ convention ( thin ) ( ) - > ( ) <nl> - % result = apply % call ( ) : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : S ( int : 42 ) <nl> + % call = function_ref @ call : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> + % result = apply % call ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : S ( int : 42 ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call - void - to - struct_large . sil <nl> ppp b / test / IRGen / async / run - call - void - to - struct_large . sil <nl> bb0 : <nl> return % 2 : $ Big <nl> } <nl> <nl> - sil hidden @ printBig : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ printBig : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> % getBig = function_ref @ getBig : $ @ async @ convention ( thin ) ( ) - > Big <nl> % big = apply % getBig ( ) : $ @ async @ convention ( thin ) ( ) - > Big <nl> % big_addr = alloc_stack $ Big <nl> sil hidden @ printBig : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % printBig = function_ref @ printBig : $ @ convention ( thin ) ( ) - > ( ) <nl> - % result = apply % printBig ( ) : $ @ convention ( thin ) ( ) - > ( ) / / CHECK : Big ( i1 : 1 , i2 : 2 , i3 : 3 , i4 : 4 , i5 : 5 , i6 : 6 , i7 : 7 , i8 : 8 , i9 : 9 , i0 : 0 ) <nl> + % printBig = function_ref @ printBig : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> + % result = apply % printBig ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) / / CHECK : Big ( i1 : 1 , i2 : 2 , i3 : 3 , i4 : 4 , i5 : 5 , i6 : 6 , i7 : 7 , i8 : 8 , i9 : 9 , i0 : 0 ) <nl> <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> % 3 = struct $ Int32 ( % 2 : $ Builtin . Int32 ) <nl> mmm a / test / IRGen / async / run - call_generic - protocolwitness_instance - generic - to - int64 - and - generic . sil <nl> ppp b / test / IRGen / async / run - call_generic - protocolwitness_instance - generic - to - int64 - and - generic . sil <nl> bb0 ( % out_addr : $ * τ_0_0 , % in_addr : $ * τ_0_0 , % self_addr : $ * I ) : <nl> return % result : $ Int64 <nl> } <nl> <nl> - sil hidden @ callPrintMe : $ @ convention ( thin ) < T , U where T : P > ( @ in_guaranteed T , @ in_guaranteed U ) - > ( Int64 , @ out U ) { <nl> + sil hidden @ callPrintMe : $ @ async @ convention ( thin ) < T , U where T : P > ( @ in_guaranteed T , @ in_guaranteed U ) - > ( Int64 , @ out U ) { <nl> bb0 ( % out_addr : $ * U , % self_addr : $ * T , % in_addr : $ * U ) : <nl> % I_P_printMe = witness_method $ T , # P . printMe : < Self where Self : P > < T > ( Self ) - > ( T ) async - > ( Int64 , T ) : $ @ convention ( witness_method : P ) @ async < τ_0_0 where τ_0_0 : P > < τ_1_0 > ( @ in_guaranteed τ_1_0 , @ in_guaranteed τ_0_0 ) - > ( Int64 , @ out τ_1_0 ) <nl> % result = apply % I_P_printMe < T , U > ( % out_addr , % in_addr , % self_addr ) : $ @ convention ( witness_method : P ) @ async < τ_0_0 where τ_0_0 : P > < τ_1_0 > ( @ in_guaranteed τ_1_0 , @ in_guaranteed τ_0_0 ) - > ( Int64 , @ out τ_1_0 ) <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < <nl> store % i to % in_addr : $ * I <nl> % i_addr = alloc_stack $ I <nl> store % i to % i_addr : $ * I <nl> - % callPrintMe = function_ref @ callPrintMe : $ @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 , @ in_guaranteed τ_0_1 ) - > ( Int64 , @ out τ_0_1 ) <nl> - % result = apply % callPrintMe < I , I > ( % out_addr , % in_addr , % i_addr ) : $ @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 , @ in_guaranteed τ_0_1 ) - > ( Int64 , @ out τ_0_1 ) <nl> + % callPrintMe = function_ref @ callPrintMe : $ @ async @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 , @ in_guaranteed τ_0_1 ) - > ( Int64 , @ out τ_0_1 ) <nl> + % result = apply % callPrintMe < I , I > ( % out_addr , % in_addr , % i_addr ) : $ @ async @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 , @ in_guaranteed τ_0_1 ) - > ( Int64 , @ out τ_0_1 ) <nl> dealloc_stack % i_addr : $ * I <nl> dealloc_stack % in_addr : $ * I <nl> % out = load % out_addr : $ * I <nl> mmm a / test / IRGen / async / run - call_generic - protocolwitness_instance - void - to - int64 . sil <nl> ppp b / test / IRGen / async / run - call_generic - protocolwitness_instance - void - to - int64 . sil <nl> bb0 ( % self_addr : $ * I ) : <nl> return % result : $ Int64 <nl> } <nl> <nl> - sil hidden @ callPrintMe : $ @ convention ( thin ) < T where T : P > ( @ in_guaranteed T ) - > Int64 { <nl> + sil hidden @ callPrintMe : $ @ async @ convention ( thin ) < T where T : P > ( @ in_guaranteed T ) - > Int64 { <nl> bb0 ( % t : $ * T ) : <nl> % I_P_printMe = witness_method $ T , # P . printMe : < Self where Self : P > ( Self ) - > ( ) async - > Int64 : $ @ convention ( witness_method : P ) @ async < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 <nl> % result = apply % I_P_printMe < T > ( % t ) : $ @ convention ( witness_method : P ) @ async < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 <nl> bb0 ( % 0 : $ Int32 , % 1 : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > <nl> % i = struct $ I ( % i_int : $ Int64 ) <nl> % i_addr = alloc_stack $ I <nl> store % i to % i_addr : $ * I <nl> - % callPrintMe = function_ref @ callPrintMe : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 <nl> - % result = apply % callPrintMe < I > ( % i_addr ) : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 / / users : % 13 , % 11 / / CHECK : I ( int : 99 ) <nl> + % callPrintMe = function_ref @ callPrintMe : $ @ async @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 <nl> + % result = apply % callPrintMe < I > ( % i_addr ) : $ @ async @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ in_guaranteed τ_0_0 ) - > Int64 / / users : % 13 , % 11 / / CHECK : I ( int : 99 ) <nl> dealloc_stack % i_addr : $ * I <nl> % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> % printInt64_result = apply % printInt64 ( % result ) : $ @ convention ( thin ) ( Int64 ) - > ( ) / / CHECK : 99 <nl> mmm a / test / IRGen / async / run - partialapply - capture - inout - generic - and - in - generic - to - generic . sil <nl> ppp b / test / IRGen / async / run - partialapply - capture - inout - generic - and - in - generic - to - generic . sil <nl> entry ( % out : $ * T , % in : $ * T , % inout : $ * T ) : <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil @ partial_apply_open_generic_capture : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T { <nl> + sil @ partial_apply_open_generic_capture : $ @ async @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T { <nl> entry ( % a : $ * T ) : <nl> % f = function_ref @ inGenericAndInoutGenericToGeneric : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> % p = partial_apply % f < T > ( % a ) : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < <nl> store % inout to % inout_addr : $ * Int64 <nl> % result_addr = alloc_stack $ Int64 <nl> <nl> - % partial_apply_open_generic_capture = function_ref @ partial_apply_open_generic_capture : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> - % partiallyApplied = apply % partial_apply_open_generic_capture < Int64 > ( % inout_addr ) : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> + % partial_apply_open_generic_capture = function_ref @ partial_apply_open_generic_capture : $ @ async @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> + % partiallyApplied = apply % partial_apply_open_generic_capture < Int64 > ( % inout_addr ) : $ @ async @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> % void = apply % partiallyApplied ( % result_addr , % in_addr ) : $ @ async @ callee_owned ( @ in Int64 ) - > @ out Int64 <nl> <nl> % result = load % result_addr : $ * Int64 <nl> mmm a / test / IRGen / async / run - partialapply - capture - int64 - int64 - to - int64 . sil <nl> ppp b / test / IRGen / async / run - partialapply - capture - int64 - int64 - to - int64 . sil <nl> import PrintShims <nl> sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> <nl> - sil hidden @ createAndInvokeClosure : $ @ convention ( thin ) ( ) - > ( ) { <nl> + sil hidden @ createAndInvokeClosure : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % captured_literal = integer_literal $ Builtin . Int64 , 783247897 <nl> % captured = struct $ Int64 ( % captured_literal : $ Builtin . Int64 ) <nl> - % createPartialApply = function_ref @ createPartialApply : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> - % partialApply = apply % createPartialApply ( % captured ) : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + % createPartialApply = function_ref @ createPartialApply : $ @ async @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + % partialApply = apply % createPartialApply ( % captured ) : $ @ async @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> strong_retain % partialApply : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> % applied_literal = integer_literal $ Builtin . Int64 , 7823478 <nl> % applied = struct $ Int64 ( % applied_literal : $ Builtin . Int64 ) <nl> bb0 : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % createAndInvokeClosure = function_ref @ createAndInvokeClosure : $ @ convention ( thin ) ( ) - > ( ) <nl> - % createAndInvokeClosure_result = apply % createAndInvokeClosure ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % createAndInvokeClosure = function_ref @ createAndInvokeClosure : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> + % createAndInvokeClosure_result = apply % createAndInvokeClosure ( ) : $ @ async @ convention ( thin ) ( ) - > ( ) <nl> % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> return % out : $ Int32 <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < <nl> <nl> / / CHECK - LL : define internal swiftcc void @ closure ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } <nl> / / CHECK - LL : define internal swiftcc void @ " $ s7closureTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } <nl> - sil hidden @ createPartialApply : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 { <nl> + sil hidden @ createPartialApply : $ @ async @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 { <nl> bb0 ( % captured : $ Int64 ) : <nl> % closure = function_ref @ closure : $ @ async @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> % partialApply = partial_apply [ callee_guaranteed ] % closure ( % captured ) : $ @ async @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> mmm a / test / IRGen / async / run - partialapply - capture - struct_classinstance_classinstance - and - int64 - to - int64 . sil <nl> ppp b / test / IRGen / async / run - partialapply - capture - struct_classinstance_classinstance - and - int64 - to - int64 . sil <nl> entry ( % in : $ Int64 , % s : $ S ) : <nl> return % in : $ Int64 <nl> } <nl> <nl> - sil @ partial_apply_guaranteed_class_pair_param : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 { <nl> + sil @ partial_apply_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 { <nl> bb0 ( % x : $ S ) : <nl> % f = function_ref @ structClassInstanceClassInstanceAndInt64ToInt64 : $ @ async @ convention ( thin ) ( Int64 , @ guaranteed S ) - > Int64 <nl> % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int64 , @ guaranteed S ) - > Int64 <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < <nl> strong_retain % instance2 : $ C <nl> % instance = struct $ S ( % instance1 : $ C , % instance2 : $ C ) <nl> <nl> - % partial_apply_guaranteed_class_pair_param = function_ref @ partial_apply_guaranteed_class_pair_param : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> - % partiallyApplied = apply % partial_apply_guaranteed_class_pair_param ( % instance ) : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> + % partial_apply_guaranteed_class_pair_param = function_ref @ partial_apply_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> + % partiallyApplied = apply % partial_apply_guaranteed_class_pair_param ( % instance ) : $ @ async @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> % result = apply % partiallyApplied ( % int ) : $ @ async @ callee_owned ( Int64 ) - > Int64 <nl> mmm a / test / IRGen / async / run - partialapply - capture - structgeneric_polymorphic_constrained - to - void . sil <nl> ppp b / test / IRGen / async / run - partialapply - capture - structgeneric_polymorphic_constrained - to - void . sil <nl> entry ( % box : $ WeakBox < τ_0_0 > ) : <nl> return % result : $ ( ) <nl> } <nl> <nl> - sil public @ bind_polymorphic_param_from_context : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + sil public @ bind_polymorphic_param_from_context : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> bb0 ( % 0 : $ * τ_0_1 ) : <nl> % 1 = alloc_ref $ WeakBox < BaseProducer < τ_0_1 > > <nl> % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < τ_0_0 where τ_0_0 : Q > ( @ owned WeakBox < τ_0_0 > ) - > ( ) <nl> bb0 ( % 0 : $ * τ_0_1 ) : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % bind_polymorphic_param_from_context = function_ref @ bind_polymorphic_param_from_context : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> + % bind_polymorphic_param_from_context = function_ref @ bind_polymorphic_param_from_context : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> % int_addr = alloc_stack $ Int64 <nl> store % int to % int_addr : $ * Int64 <nl> - % partiallyApplied = apply % bind_polymorphic_param_from_context < Int64 > ( % int_addr ) : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> + % partiallyApplied = apply % bind_polymorphic_param_from_context < Int64 > ( % int_addr ) : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> dealloc_stack % int_addr : $ * Int64 <nl> <nl> % result = apply % partiallyApplied ( ) : $ @ async @ callee_owned ( ) - > ( ) <nl> mmm a / test / IRGen / async / run - partialapply - capture - type_structgeneric_polymorphic_constrained - to - void . sil <nl> ppp b / test / IRGen / async / run - partialapply - capture - type_structgeneric_polymorphic_constrained - to - void . sil <nl> entry ( % box : $ WeakBox < τ_0_0 > ) : <nl> <nl> <nl> / / CHECK - LL : define internal swiftcc void @ " $ s7takingQTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> - sil public @ bind_polymorphic_param_from_forwarder_parameter : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) { <nl> + sil public @ bind_polymorphic_param_from_forwarder_parameter : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) { <nl> bb0 ( % 0 : $ * τ_0_1 ) : <nl> % 1 = alloc_ref $ WeakBox < BaseProducer < τ_0_1 > > <nl> % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < τ_0_0 where τ_0_0 : Q > ( @ owned WeakBox < τ_0_0 > ) - > ( ) <nl> bb0 ( % 0 : $ * τ_0_1 ) : <nl> <nl> sil @ main : $ @ async @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> - % bind_polymorphic_param_from_forwarder_parameter = function_ref @ bind_polymorphic_param_from_forwarder_parameter : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) <nl> + % bind_polymorphic_param_from_forwarder_parameter = function_ref @ bind_polymorphic_param_from_forwarder_parameter : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) <nl> % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> % int_addr = alloc_stack $ Int64 <nl> store % int to % int_addr : $ * Int64 <nl> - % partiallyApplied = apply % bind_polymorphic_param_from_forwarder_parameter < Int64 > ( % int_addr ) : $ @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) <nl> + % partiallyApplied = apply % bind_polymorphic_param_from_forwarder_parameter < Int64 > ( % int_addr ) : $ @ async @ convention ( thin ) < τ_0_1 > ( @ in τ_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < τ_0_1 > > ) - > ( ) <nl> dealloc_stack % int_addr : $ * Int64 <nl> <nl> % box = alloc_ref $ WeakBox < BaseProducer < Int64 > > <nl>
[ Test ] Made async exec tests obey async rule .
apple/swift
c2469fcf90fa733fad1d7a3c4fcef6dc18ead113
2020-10-23T18:08:39Z
mmm a / src / core / surface / call . c <nl> ppp b / src / core / surface / call . c <nl> static void request_more_data ( grpc_call * call ) { <nl> static void lock ( grpc_call * call ) { gpr_mu_lock ( & call - > mu ) ; } <nl> <nl> static void unlock ( grpc_call * call ) { <nl> - send_action sa ; <nl> + send_action sa = SEND_NOTHING ; <nl> completed_request completed_requests [ GRPC_IOREQ_OP_COUNT ] ; <nl> int num_completed_requests = call - > num_completed_requests ; <nl> int i ; <nl>
Fix uninitialized variable
grpc/grpc
2f38be65264bc2e99573b753e6e9cfc498a1d2de
2015-01-29T18:26:22Z
mmm a / utils / swift_build_support / swift_build_support / products / product . py <nl> ppp b / utils / swift_build_support / swift_build_support / products / product . py <nl> def product_source_name ( cls ) : <nl> " " " <nl> return cls . product_name ( ) <nl> <nl> - @ classmethod <nl> - def get_build_directory_name ( cls , host_target ) : <nl> - return " { } - { } " . format ( cls . product_name ( ) , <nl> - host_target . name ) <nl> - <nl> @ classmethod <nl> def is_build_script_impl_product ( cls ) : <nl> " " " is_build_script_impl_product - > bool <nl>
Merge pull request from drodriguez / build - script - remove - unused - method
apple/swift
e6449a13c9f1086c489c3e2695234dc8a81ab59f
2019-04-07T04:05:54Z
mmm a / admin / static / coffee / app . coffee <nl> ppp b / admin / static / coffee / app . coffee <nl> set_progress = ( progress_data_from_server ) - > <nl> clearInterval window . progress_interval <nl> progress_interval_value = progress_interval_default_value <nl> window . progress_interval = setInterval collect_progress , progress_interval_value <nl> + <nl> + # Since backfilling is half working , we want to often check directory / blueprint to give users feedback <nl> + if is_empty is true <nl> + setTimeout collect_server_data_async , 2500 <nl> <nl> set_directory = ( attributes_from_server ) - > <nl> # Convert directory representation from RethinkDB into backbone friendly one <nl> mmm a / admin / static / coffee / namespaces / replicas . coffee <nl> ppp b / admin / static / coffee / namespaces / replicas . coffee <nl> module ' NamespaceView ' , - > <nl> datacenters . on ' reset ' , @ render_list <nl> <nl> @ model . on ' change : primary_uuid ' , @ render_primary_not_found <nl> - <nl> - @ model . on ' change : replica_affinities ' , @ render_acks_greater_than_replicas <nl> + @ model . on ' change : replica_affinities ' , @ global_trigger_for_replica <nl> @ model . on ' change : ack_expectations ' , @ render_acks_greater_than_replicas <nl> + @ model . on ' change : shards ' , @ render_progress_server_update <nl> + progress_list . on ' all ' , @ render_progress <nl> + directory . on ' all ' , @ render_status <nl> <nl> - @ model . on ' change : blueprint ' , @ render_status_from_event <nl> - directory . on ' all ' , @ render_status_from_event <nl> + <nl> + # Initialize @ expected_num_replicas <nl> + num_shards = @ model . get ( ' shards ' ) . length <nl> + num_replicas = 1 # For master <nl> + for datacenter_id of @ model . get ( ' replica_affinities ' ) <nl> + num_replicas + = @ model . get ( ' replica_affinities ' ) [ datacenter_id ] <nl> + @ expected_num_replicas = num_replicas * num_shards # Stores the number of replicas we expect <nl> <nl> @ universe_replicas = new NamespaceView . DatacenterReplicas universe_datacenter . get ( ' id ' ) , @ model <nl> <nl> + # A method that is going to call multiple methods ( triggered when replica_affinities are changed <nl> + global_trigger_for_replica : = > <nl> + @ render_acks_greater_than_replicas ( ) <nl> + @ render_progress_server_update ( ) <nl> + <nl> + # Update the progress bar if the server send us an update ( so we can handle the case something was changed from another place ) <nl> + render_progress_server_update : = > <nl> + @ progress_bar . skip_to_processing ( ) # We set the state to processing <nl> + <nl> + # Compute the number of replicas we require <nl> + new_replicas = @ model . get ( ' replica_affinities ' ) <nl> + replicas_length = 1 # 1 for the master <nl> + for datacenter_id of new_replicas <nl> + replicas_length + = new_replicas [ datacenter_id ] <nl> + <nl> + shards_length = @ model . get ( ' shards ' ) . length <nl> + <nl> + @ render_status <nl> + got_response : true <nl> + replicas_length : replicas_length <nl> + shards_length : shards_length <nl> + <nl> + # Trigger by progress_list <nl> + render_progress : = > <nl> + @ render_status <nl> + backfilling_updated : true <nl> + <nl> + # Compute the status of all replicas <nl> + # - progress_bar_info : optional argument that informs the progress bar backing this status <nl> + render_status : ( progress_bar_info ) = > <nl> + if not progress_bar_info ? or typeof progress_bar_info isnt ' object ' <nl> + progress_bar_info = { } <nl> + <nl> + # If the blueprint is not ready , we just skip it <nl> + blueprint = @ model . get ( ' blueprint ' ) . peers_roles <nl> + if not blueprint ? <nl> + return ' ' <nl> + <nl> + <nl> + # Compute how many replicas are ready according to the blueprint <nl> + num_replicas_not_ready = 0 <nl> + num_replicas_ready = 0 <nl> + for machine_id of blueprint <nl> + for shard of blueprint [ machine_id ] <nl> + found_shard = false <nl> + shard_ready = true <nl> + <nl> + role = blueprint [ machine_id ] [ shard ] <nl> + if role is ' role_nothing ' <nl> + continue <nl> + <nl> + if role is ' role_primary ' <nl> + expected_status = ' primary ' <nl> + else if role is ' role_secondary ' <nl> + expected_status = ' secondary_up_to_date ' <nl> + <nl> + # Loop over directory <nl> + activities = directory . get ( machine_id ) ? . get ( @ model . get ( ' protocol ' ) + ' _namespaces ' ) ? [ ' reactor_bcards ' ] [ @ model . get ( ' id ' ) ] ? [ ' activity_map ' ] <nl> + if activities ? <nl> + for activity_id of activities <nl> + activity = activities [ activity_id ] <nl> + if activity [ 0 ] is shard <nl> + found_shard = true <nl> + if activity [ 1 ] [ ' type ' ] isnt expected_status <nl> + shard_ready = false <nl> + break <nl> + <nl> + if found_shard is false or shard_ready is false <nl> + num_replicas_not_ready + + <nl> + else <nl> + num_replicas_ready + + <nl> + num_replicas = num_replicas_ready + num_replicas_not_ready <nl> + <nl> + # The user just changed the number of replicas <nl> + if progress_bar_info ? . new_value ? <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( 0 , expected_num_replicas , progress_bar_info ) . $ el <nl> + @ expected_num_replicas = progress_bar_info . new_value # Let ' s cache this value for the case when the blueprint was not regenerated ( yet ) <nl> + <nl> + # The server did valid the changes the user just made <nl> + else if progress_bar_info ? . got_response is true <nl> + expected_num_replicas = progress_bar_info . replicas_length * progress_bar_info . shards_length <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( 0 , expected_num_replicas , progress_bar_info ) . $ el <nl> + <nl> + @ expected_num_replicas = expected_num_replicas # Let ' s cache this value for the case when the blueprint was not regenerated ( yet ) <nl> + <nl> + # If we got an update from progress_list <nl> + else if progress_bar_info ? . backfilling_updated is true <nl> + # Make sure we have a match between what we want and what we have ( = blueprints have been regenerated ) <nl> + if num_replicas_ready + num_replicas_not_ready is @ expected_num_replicas <nl> + backfilling_info = DataUtils . get_backfill_progress_agg @ model . get ( ' id ' ) <nl> + <nl> + if backfilling_info is null or backfilling_info . total_blocks is - 1 # If there is no backfilling <nl> + # We don ' t know if the backfilling hasn ' t started yet or is completed , so let ' s check the directory status <nl> + if num_replicas_not_ready is 0 # Well , everything is up to date <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( num_replicas_ready , num_replicas_ready , progress_bar_info ) . $ el <nl> + else # We are going to backfill <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( num_replicas_ready , num_replicas_ready + num_replicas_not_ready , progress_bar_info ) . $ el <nl> + else <nl> + # We can have replicated_blocks > total_blocks sometimes . Need a back end fix . <nl> + progress_bar_info = _ . extend progress_bar_info , <nl> + total_blocks : backfilling_info . total_blocks <nl> + replicated_blocks : if backfilling_info . replicated_blocks > backfilling_info . replicated_blocks then backfilling_info . total_blocks else backfilling_info . replicated_blocks <nl> + <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( num_replicas_ready , num_replicas_ready + num_replicas_not_ready , progress_bar_info ) . $ el <nl> + else <nl> + # Blueprint was regenerated , so we can display the bar <nl> + if num_replicas_ready + num_replicas_not_ready is @ expected_num_replicas <nl> + @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( num_replicas_ready , num_replicas_ready + num_replicas_not_ready , progress_bar_info ) . $ el <nl> + return @ <nl> + <nl> # Render the list of datacenters for MDC <nl> render_list : = > <nl> @ ordered_datacenters = _ . map ( datacenters . models , ( datacenter ) = > <nl> module ' NamespaceView ' , - > <nl> if @ . $ ( ' . no_datacenter_found ' ) . css ( ' display ' ) is ' block ' <nl> @ . $ ( ' . no_datacenter_found ' ) . hide ( ) <nl> <nl> + # While waiting for the back end to create this unsatisfiable goals <nl> render_acks_greater_than_replicas : = > <nl> datacenters_with_issues = [ ] <nl> for datacenter_id of @ model . get ( ' ack_expectations ' ) <nl> module ' NamespaceView ' , - > <nl> @ . $ ( ' . cluster_container ' ) . html @ universe_replicas . render ( ) . $ el <nl> <nl> <nl> - # Wrapper function that responds to Backbone events . Necessary because <nl> - # we want render_status to have a custom parameter for template options <nl> - render_status_from_event : = > @ render_status ( ) <nl> - # Compute the status of all replicas <nl> - # - progress_bar_info : optional argument that informs the progress bar backing this status <nl> - render_status : ( progress_bar_info ) = > <nl> - # If the blueprint is not ready , we just skip it <nl> - blueprint = @ model . get ( ' blueprint ' ) . peers_roles <nl> - if not blueprint ? <nl> - return ' ' <nl> - <nl> - num_replicas_not_ready = 0 <nl> - num_replicas_ready = 0 <nl> <nl> - # Loop over the blueprint <nl> - for machine_id of blueprint <nl> - for shard of blueprint [ machine_id ] <nl> - found_shard = false <nl> - shard_ready = true <nl> - <nl> - role = blueprint [ machine_id ] [ shard ] <nl> - if role is ' role_nothing ' <nl> - continue <nl> - <nl> - if role is ' role_primary ' <nl> - expected_status = ' primary ' <nl> - else if role is ' role_secondary ' <nl> - expected_status = ' secondary_up_to_date ' <nl> - <nl> - # Loop over directory <nl> - activities = directory . get ( machine_id ) ? . get ( @ model . get ( ' protocol ' ) + ' _namespaces ' ) ? [ ' reactor_bcards ' ] [ @ model . get ( ' id ' ) ] ? [ ' activity_map ' ] <nl> - if activities ? <nl> - for activity_id of activities <nl> - activity = activities [ activity_id ] <nl> - if activity [ 0 ] is shard <nl> - found_shard = true <nl> - if activity [ 1 ] [ ' type ' ] isnt expected_status <nl> - shard_ready = false <nl> - break <nl> - <nl> - if found_shard is false or shard_ready is false <nl> - num_replicas_not_ready + + <nl> - else <nl> - num_replicas_ready + + <nl> - <nl> - data = <nl> - num_replicas_not_ready : num_replicas_not_ready <nl> - num_replicas_ready : num_replicas_ready <nl> - num_replicas : num_replicas_ready + num_replicas_not_ready <nl> - <nl> - progress_bar_info = { } if not progress_bar_info ? <nl> - @ . $ ( ' . replica - status ' ) . html @ progress_bar . render ( data . num_replicas_ready , data . num_replicas , progress_bar_info ) . $ el <nl> - <nl> - return @ <nl> render : = > <nl> @ . $ el . html @ template ( ) <nl> <nl> module ' NamespaceView ' , - > <nl> @ model . off ' change : primary_uuid ' , @ render_primary_not_found <nl> @ model . off ' change : replica_affinities ' , @ render_acks_greater_than_replicas <nl> @ model . off ' change : ack_expectations ' , @ render_acks_greater_than_replicas <nl> - @ model . off ' change : blueprint ' , @ render_status <nl> - directory . off ' all ' , @ render_status <nl> - <nl> - <nl> + @ model . on ' change : shards ' , @ render_progress_server_update <nl> + progress_list . on ' all ' , @ render_progress <nl> + directory . on ' all ' , @ render_status <nl> <nl> class @ DatacenterReplicas extends Backbone . View <nl> className : ' datacenter_view ' <nl> module ' NamespaceView ' , - > <nl> <nl> @ model . on ' change : primary_uuid ' , @ render <nl> progress_list . on ' all ' , @ render_progress <nl> + # TODO Clean progress bar from this view <nl> <nl> @ model . on ' change : ack_expectations ' , @ render_acks_replica <nl> @ model . on ' change : replica_affinities ' , @ render_acks_replica <nl> module ' NamespaceView ' , - > <nl> <nl> num_replicas = parseInt @ . $ ( ' # replicas_value ' ) . val ( ) <nl> num_acks = parseInt @ . $ ( ' # acks_value ' ) . val ( ) <nl> + <nl> # adjust the replica count to only include secondaries <nl> if @ model . get ( ' primary_uuid ' ) is @ datacenter . get ( ' id ' ) <nl> num_replicas - = 1 <nl> module ' NamespaceView ' , - > <nl> num_replicas : num_replicas <nl> num_acks : num_acks <nl> <nl> + # Add the progress bar <nl> + # We count master , so we don ' t substract one <nl> + replicas_length = 1 # 1 for the master <nl> + for datacenter_id of replica_affinities_to_send <nl> + replicas_length + = replica_affinities_to_send [ datacenter_id ] <nl> + window . app . current_view . replicas . render_status <nl> + new_value : replicas_length * @ model . get ( ' shards ' ) . length <nl> + <nl> + window . app . current_view . shards . render_status <nl> + new_value : @ model . get ( ' shards ' ) . length <nl> + <nl> + <nl> $ . ajax <nl> processData : false <nl> url : " / ajax / semilattice / # { @ model . get ( " protocol " ) } _namespaces / # { @ model . get ( ' id ' ) } " <nl> module ' NamespaceView ' , - > <nl> @ current_state = @ states [ 0 ] <nl> @ render ( ) <nl> <nl> - @ . $ ( ' . replicas_acks - alert ' ) . html @ replicas_acks_success_template ( ) <nl> - @ . $ ( ' . replicas_acks - alert ' ) . slideDown ' fast ' <nl> + replicas_length = 1 # 1 for the master <nl> + for datacenter_id of new_replicas <nl> + replicas_length + = new_replicas [ datacenter_id ] <nl> + window . app . current_view . replicas . render_status <nl> + got_response : true <nl> + replicas_length : replicas_length <nl> + shards_length : @ model . get ( ' shards ' ) . length <nl> + <nl> + window . app . current_view . replicas <nl> + window . app . current_view . shards . render_status <nl> + got_response : true <nl> + # @ . $ ( ' . replicas_acks - alert ' ) . html @ replicas_acks_success_template ( ) <nl> + # @ . $ ( ' . replicas_acks - alert ' ) . slideDown ' fast ' <nl> # create listener + state <nl> @ replicating = true <nl> @ . $ ( ' . status - alert ' ) . hide ( ) <nl> mmm a / admin / static / coffee / namespaces / replicas . html <nl> ppp b / admin / static / coffee / namespaces / replicas . html <nl> < h2 class = " title " > Replication settings < / h2 > <nl> < / div > <nl> { { # if starting } } <nl> < p > 0 / { { new_value } } replicas completed < / p > <nl> + { { else } } <nl> + < p > <nl> + { { current_value } } / { { max_value } } { { pluralize_noun " replica " num_replicas } } { { # if total_blocks } } , <nl> + { { ! Keep the if above so we do not have an extra space before the comma } } <nl> + { { replicated_blocks } } / { { total_blocks } } blocks copied <nl> { { else } } <nl> - < p > { { current_value } } / { { max_value } } replicas completed < / p > <nl> + up to date <nl> + { { / if } } <nl> + < / p > <nl> { { / if } } <nl> < div class = " progress " > < div class = " bar " style = " width : { { # if starting } } 0 { { else } } { { percent_complete } } { { / if } } % " > < / div > < / div > <nl> < / div > <nl> { { else } } <nl> - < p > < span class = " big " > { { current_value } } / { { max_value } } < / span > replicas reachable < / p > <nl> + < p > < span class = " big " > { { current_value } } / { { max_value } } < / span > { { pluralize_noun " replica " max_value } } reachable < / p > <nl> { { / if } } <nl> < / script > <nl> <nl> mmm a / admin / static / coffee / namespaces / shards . coffee <nl> ppp b / admin / static / coffee / namespaces / shards . coffee <nl> module ' NamespaceView ' , - > <nl> # Forbid changes if issues <nl> @ can_change_shards = false <nl> @ reasons_cannot_shard = { } <nl> + @ expected_num_shards = @ model . get ( ' shards ' ) . length <nl> issues . on ' all ' , @ check_can_change_shards <nl> <nl> # Listeners / cache for the data repartition <nl> @ model . on ' change : key_distr ' , @ render_data_repartition <nl> - @ model . on ' change : shards ' , @ render_data_repartition <nl> <nl> - @ model . on ' change : shards ' , @ render_status_from_event <nl> - @ model . on ' change : ack_expectations ' , @ render_status_from_event <nl> - directory . on ' all ' , @ render_status_from_event <nl> + # Listeners for the progress bar <nl> + @ model . on ' change : shards ' , @ global_trigger_for_shards # This one contains render_data_repartition too <nl> + @ model . on ' change : ack_expectations ' , @ render_status_server_update <nl> + directory . on ' all ' , @ render_status <nl> <nl> @ progress_bar = new UIComponents . OperationProgressBar @ shard_status_template <nl> <nl> module ' NamespaceView ' , - > <nl> @ data_sent = data <nl> <nl> # Indicate that we ' re starting the sharding process - - provide the number of shards requested <nl> + @ expected_num_shards = @ shard_set . length <nl> @ render_status <nl> new_value : @ shard_set . length <nl> <nl> + # Indicate that we ' re going to start replicating on the replication taba <nl> + new_replicas = @ model . get ( ' replica_affinities ' ) <nl> + replicas_length = 1 # 1 for the master <nl> + for datacenter_id of new_replicas <nl> + replicas_length + = new_replicas [ datacenter_id ] <nl> + <nl> + window . app . current_view . replicas . render_status <nl> + new_value : replicas_length * @ model . get ( ' shards ' ) . length <nl> + <nl> $ . ajax <nl> processData : false <nl> url : " / ajax / semilattice / # { @ model . attributes . protocol } _namespaces / # { @ model . get ( ' id ' ) } ? prefer_distribution = 1 " <nl> module ' NamespaceView ' , - > <nl> <nl> @ switch_to_read ( ) <nl> <nl> - # Indicate that we ' ve gotten a response , time to move to the next state <nl> + # Indicate that we ' ve gotten a response , time to move to the next state for both tabs ( shards and replication ) <nl> @ render_status <nl> got_response : true <nl> + # Replicas ' tab turn now <nl> + new_replicas = @ model . get ( ' replica_affinities ' ) <nl> + replicas_length = 1 # 1 for the master <nl> + for datacenter_id of new_replicas <nl> + replicas_length + = new_replicas [ datacenter_id ] <nl> + <nl> + window . app . current_view . replicas . render_status <nl> + got_response : true <nl> + replicas_length : replicas_length <nl> + shards_length : @ model . get ( ' shards ' ) . length <nl> + <nl> + <nl> <nl> on_error : = > <nl> + @ . $ ( ' . rebalance ' ) . removeProp ' disabled ' <nl> + <nl> @ display_msg @ error_ajax_template ( ) <nl> <nl> - # Wrapper function that responds to Backbone events . Necessary because <nl> - # we want render_status to have a custom parameter for template options <nl> - render_status_from_event : = > @ render_status ( ) <nl> + # In case the ajax request failed , we remove the progress bar . <nl> + @ progress_bar . set_none_state ( ) <nl> + @ expected_num_shards = @ model . get ( ' shards ' ) . length <nl> + @ render_status ( ) <nl> + <nl> + # We can add just one method on one listener , so it ' s just a container . Triggered when shards have been changed <nl> + global_trigger_for_shards : = > <nl> + @ render_data_repartition ( ) <nl> + @ render_status_server_update ( ) <nl> + <nl> + # Shards or acks have been change ( probably on another window , so let ' s skip the start and process things <nl> + render_status_server_update : = > <nl> + @ expected_num_shards = @ model . get ( ' shards ' ) . length <nl> + <nl> + @ progress_bar . skip_to_processing ( ) <nl> + @ render_status ( ) <nl> + <nl> # Render the status of sharding <nl> # - pbar_info : optional argument that informs the progress bar backing this status <nl> render_status : ( progress_bar_info ) = > <nl> + # We check for the type because the listener on directory is called with the event type ( which is a string like ' reset ' ) <nl> + if not progress_bar_info ? or typeof progress_bar_info isnt ' object ' <nl> + progress_bar_info = { } <nl> + <nl> # If blueprint not ready , we just skip . It shouldn ' t happen . <nl> blueprint = @ model . get ( ' blueprint ' ) . peers_roles <nl> if not blueprint ? <nl> return ' ' <nl> <nl> - # Compute an object tracking is we have found the master of each shard and if we have enough secondary up to date <nl> + # Initialize an object tracking if for each shards we have found the master and the machines that are not ready / used <nl> + # We will also use it to know if a shard is eventually available or not <nl> shards = { } <nl> - num_shards = 0 <nl> + num_shards = @ model . get ( ' shards ' ) . length <nl> for shard in @ model . get ( ' shards ' ) <nl> - num_shards + + <nl> shards [ shard ] = <nl> - found_master : false <nl> - num_secondaries_left_to_find : @ model . get ( ' ack_expectations ' ) [ @ model . get ( ' primary_uuid ' ) ] <nl> + master : null <nl> + machines_not_ready : { } <nl> + acks_expected : _ . extend { } , @ model . get ( ' ack_expectations ' ) <nl> + if ( not ( shards [ shard ] [ ' acks_expected ' ] [ @ model . get ( ' primary_uuid ' ) ] ? ) ) or shards [ shard ] [ ' acks_expected ' ] [ @ model . get ( ' primary_uuid ' ) ] is 0 <nl> + shards [ shard ] [ ' acks_expected ' ] [ @ model . get ( ' primary_uuid ' ) ] = 1 <nl> + <nl> + # Let ' s make sure that the bluprint has been regenerated . If not we just exit <nl> + for machine_id of blueprint <nl> + num_shards_in_blueprint = 0 <nl> + for shard of blueprint [ machine_id ] <nl> + num_shards_in_blueprint + + <nl> + if num_shards_in_blueprint isnt @ expected_num_shards <nl> + @ . $ ( ' . shard - status ' ) . html @ progress_bar . render ( 0 , @ expected_num_shards , progress_bar_info ) . $ el <nl> + return ' ' <nl> <nl> # Loop over the blueprint <nl> for machine_id of blueprint <nl> for shard of blueprint [ machine_id ] <nl> + # If there is a mismatch in the blueprint , it means that the blueprint has not been regenerated . <nl> if not shards [ shard ] ? <nl> - continue <nl> - if shards [ shard ] . found_master is true and shards [ shard ] . num_secondaries_left_to_find < = 0 <nl> - continue <nl> + @ . $ ( ' . shard - status ' ) . html @ progress_bar . render ( 0 , @ expected_num_shards , progress_bar_info ) . $ el <nl> + return ' ' <nl> <nl> role = blueprint [ machine_id ] [ shard ] <nl> + <nl> + # This machine is doing nothing so let ' s save it <nl> if role is ' role_nothing ' <nl> + shards [ shard ] [ ' machines_not_ready ' ] [ machine_id ] = true <nl> continue <nl> <nl> # Because the back end doesn ' t match the terms in blueprint and directory <nl> module ' NamespaceView ' , - > <nl> for activity_id of activities <nl> activity = activities [ activity_id ] <nl> if activity [ 0 ] is shard <nl> - if activity [ 1 ] [ ' type ' ] is expected_status <nl> + if activity [ 1 ] [ ' type ' ] isnt expected_status # The activity doesn ' t match the blueprint , so the machine is not ready <nl> + shards [ shard ] [ ' machines_not_ready ' ] [ machine_id ] = true <nl> + else <nl> + # The activity matched and it ' s a primary , so let ' s save it <nl> if activity [ 1 ] [ ' type ' ] is ' primary ' <nl> - shards [ shard ] . found_master = true <nl> - shards [ shard ] . num_secondaries_left_to_find - - <nl> - <nl> - if shards [ shard ] . found_master is true and shards [ shard ] . num_secondaries_left_to_find < = 0 <nl> - break <nl> + shards [ shard ] . master = machine_id <nl> + <nl> + # TODO That is approximate since we cannot make sure that a machine is working for a datacenter or for universe <nl> + for shard of shards <nl> + for machine in machines . models <nl> + machine_id = machine . get ( ' id ' ) <nl> + <nl> + # We have one machine up to date <nl> + if not shards [ shard ] [ ' machines_not_ready ' ] [ machine_id ] ? <nl> + datacenter_id = machine . get ( ' datacenter_uuid ' ) <nl> + if ( not shards [ shard ] [ ' acks_expected ' ] [ datacenter_id ] ? ) or shards [ shard ] [ ' acks_expected ' ] [ datacenter_id ] < = 0 <nl> + shards [ shard ] [ ' acks_expected ' ] [ universe_datacenter . get ( ' id ' ) ] - - <nl> + else <nl> + shards [ shard ] [ ' acks_expected ' ] [ datacenter_id ] - - <nl> <nl> # Compute the number of shards that are ready <nl> - num_shards_ready = 0 <nl> - for shard in @ model . get ( ' shards ' ) <nl> - if shards [ shard ] ? . found_master is true and shards [ shard ] . num_secondaries_left_to_find < = 0 <nl> - num_shards_ready + + <nl> + num_shards_not_ready = 0 <nl> + for shard of shards <nl> + master = shards [ shard ] [ ' master ' ] <nl> + if master is null or ( shards [ shard ] [ ' machines_not_ready ' ] [ master ] ? ) # If no master found or if the master is not completly ready yet . <nl> + num_shards_not_ready + + <nl> + continue <nl> + for datacenter_id of shards [ shard ] [ ' acks_expected ' ] <nl> + if shards [ shard ] [ ' acks_expected ' ] [ datacenter_id ] > 0 # We don ' t meeet the number of acks , so the shard is not ready yet <nl> + num_shards_not_ready + + <nl> + break <nl> <nl> - # Render the template <nl> - progress_bar_info = { } if not progress_bar_info ? <nl> + # The blueprint has been regenerated , so let ' s render everything <nl> + num_shards_ready = num_shards - num_shards_not_ready <nl> @ . $ ( ' . shard - status ' ) . html @ progress_bar . render ( num_shards_ready , num_shards , progress_bar_info ) . $ el <nl> <nl> return @ <nl> module ' NamespaceView ' , - > <nl> destroy : = > <nl> issues . off ' all ' , @ check_can_change_shards <nl> @ model . off ' change : key_distr ' , @ render_data_repartition <nl> - @ model . off ' change : shards ' , @ render_data_repartition <nl> - <nl> - @ model . off ' change : shards ' , @ render_status_event <nl> - @ model . off ' change : ack_expectations ' , @ render_status_event <nl> - directory . off ' all ' , @ render_status_event <nl> + @ model . off ' change : shards ' , @ global_trigger_for_shards <nl> + @ model . off ' change : ack_expectations ' , @ render_status_server_update <nl> + directory . off ' all ' , @ render_status <nl> <nl> # Modify replica counts and ack counts in each datacenter <nl> class @ ChangeShardsModal extends UIComponents . AbstractModal <nl> mmm a / admin / static / coffee / ui_components / progressbar . coffee <nl> ppp b / admin / static / coffee / ui_components / progressbar . coffee <nl> <nl> module ' UIComponents ' , - > <nl> # Progress bar that has different states <nl> class @ OperationProgressBar extends Backbone . View <nl> - template : Handlebars . compile $ ( ' # progressbar - template ' ) . html ( ) <nl> # These are the possible states for the ProgressBar <nl> states : [ ' none ' , ' starting ' , ' processing ' , ' finished ' ] <nl> stage : ' none ' <nl> module ' UIComponents ' , - > <nl> # The initialize function takes one optional argument : <nl> # - template : optional custom template <nl> initialize : ( template ) - > <nl> - @ template = template if template ? <nl> + if template ? <nl> + @ template = template <nl> + else <nl> + template = Handlebars . compile $ ( ' # progressbar - template ' ) . html ( ) <nl> <nl> # The render function takes a number of arguments : <nl> # - current_value : current value of the operation or status being monitored <nl> module ' UIComponents ' , - > <nl> if current_value is max_value <nl> percent_complete = 0 <nl> else <nl> - percent_complete = current_value / max_value * 100 <nl> + percent_complete = Math . floor current_value / max_value * 100 <nl> data = _ . extend data , <nl> operation_active : true <nl> processing : true <nl> module ' UIComponents ' , - > <nl> finished : true <nl> percent_complete : 100 <nl> <nl> + <nl> + @ stage = ' none ' <nl> setTimeout = > <nl> @ render current_value , max_value , { } <nl> - @ stage = ' none ' <nl> , 2000 <nl> <nl> @ . $ el . html @ template data <nl> <nl> return @ <nl> + <nl> + skip_to_processing : = > <nl> + @ stage = ' processing ' <nl> + set_none_state : = > <nl> + @ stage = ' none ' <nl>
Add progress bar for shards and replicas
rethinkdb/rethinkdb
48f3a23d9ab6724c973d182b1a4cbb4159f93852
2012-11-02T19:13:57Z
mmm a / dbms / src / DataStreams / ParallelInputsProcessor . h <nl> ppp b / dbms / src / DataStreams / ParallelInputsProcessor . h <nl> class ParallelInputsProcessor <nl> <nl> try <nl> { <nl> - for ( auto & input : inputs ) <nl> - input - > readPrefix ( ) ; <nl> loop ( thread_num ) ; <nl> } <nl> catch ( . . . ) <nl> class ParallelInputsProcessor <nl> { <nl> try <nl> { <nl> - additional_input_at_end - > readPrefix ( ) ; <nl> while ( Block block = additional_input_at_end - > read ( ) ) <nl> publishPayload ( additional_input_at_end , block , thread_num ) ; <nl> } <nl>
Revert " Propagate readPrefix in ParallelInputsProcessor "
ClickHouse/ClickHouse
35ce63a7627c7d5d8f851eb919d163a8f4734989
2017-11-22T02:17:42Z
mmm a / modules / csg / csg_shape . h <nl> ppp b / modules / csg / csg_shape . h <nl> class CSGShape : public GeometryInstance { <nl> <nl> virtual void _validate_property ( PropertyInfo & property ) const ; <nl> <nl> + public : <nl> Array get_meshes ( ) const ; <nl> <nl> - public : <nl> void set_operation ( Operation p_operation ) ; <nl> Operation get_operation ( ) const ; <nl> <nl> mmm a / modules / recast / navigation_mesh_generator . cpp <nl> ppp b / modules / recast / navigation_mesh_generator . cpp <nl> <nl> # include " scene / resources / shape . h " <nl> # include " scene / resources / sphere_shape . h " <nl> <nl> + # ifdef MODULE_CSG_ENABLED <nl> + # include " modules / csg / csg_shape . h " <nl> + # endif <nl> + <nl> EditorNavigationMeshGenerator * EditorNavigationMeshGenerator : : singleton = NULL ; <nl> <nl> void EditorNavigationMeshGenerator : : _add_vertex ( const Vector3 & p_vec3 , Vector < float > & p_verticies ) { <nl> void EditorNavigationMeshGenerator : : _parse_geometry ( Transform p_accumulated_tran <nl> } <nl> } <nl> <nl> + # ifdef MODULE_CSG_ENABLED <nl> + if ( Object : : cast_to < CSGShape > ( p_node ) & & p_generate_from ! = NavigationMesh : : PARSED_GEOMETRY_STATIC_COLLIDERS ) { <nl> + <nl> + CSGShape * csg_shape = Object : : cast_to < CSGShape > ( p_node ) ; <nl> + Array meshes = csg_shape - > get_meshes ( ) ; <nl> + if ( ! meshes . empty ( ) ) { <nl> + Ref < Mesh > mesh = meshes [ 1 ] ; <nl> + if ( mesh . is_valid ( ) ) { <nl> + _add_mesh ( mesh , p_accumulated_transform * csg_shape - > get_transform ( ) , p_verticies , p_indices ) ; <nl> + } <nl> + } <nl> + } <nl> + # endif <nl> + <nl> if ( Object : : cast_to < StaticBody > ( p_node ) & & p_generate_from ! = NavigationMesh : : PARSED_GEOMETRY_MESH_INSTANCES ) { <nl> StaticBody * static_body = Object : : cast_to < StaticBody > ( p_node ) ; <nl> <nl>
Take CSG into account for nav - mesh generation
godotengine/godot
051ef5ead297a577a54b49f2f964144ff8841214
2019-06-13T11:44:41Z
mmm a / docs / tutorial / mac - app - store - submission - guide . md <nl> ppp b / docs / tutorial / mac - app - store - submission - guide . md <nl> If you are new to app sandboxing under OS X , you should also read through <nl> Apple ' s [ Enabling App Sandbox ] [ enable - app - sandbox ] to have a basic idea , then <nl> add keys for the permissions needed by your app to the entitlements files . <nl> <nl> + Apart from manually signing your app , you can also choose to use the <nl> + [ electron - osx - sign ] [ electron - osx - sign ] module to do the job . <nl> + <nl> + # # # # Sign Native Modules <nl> + <nl> + Native modules used in your app also need to be signed . If using <nl> + electron - osx - sign , be sure to include the path to the built binaries in the <nl> + argument list : <nl> + <nl> + ` ` ` bash <nl> + electron - osx - sign YourApp . app YourApp . app / Contents / Resources / app / node_modules / nativemodule / build / release / nativemodule <nl> + ` ` ` <nl> + <nl> + Also note that native modules may have intermediate files produced which should <nl> + not be included ( as they would also need to be signed ) . If you use <nl> + [ electron - packager ] [ electron - packager ] , add ` - - ignore = . + \ . o $ ` to build step to <nl> + ignore these files . <nl> + <nl> # # # Upload Your App <nl> <nl> After signing your app , you can use Application Loader to upload it to iTunes <nl> ERN ) ] [ ern - tutorial ] . <nl> [ nwjs - guide ] : https : / / github . com / nwjs / nw . js / wiki / Mac - App - Store - % 28MAS % 29 - Submission - Guideline # first - steps <nl> [ enable - app - sandbox ] : https : / / developer . apple . com / library / ios / documentation / Miscellaneous / Reference / EntitlementKeyReference / Chapters / EnablingAppSandbox . html <nl> [ create - record ] : https : / / developer . apple . com / library / ios / documentation / LanguagesUtilities / Conceptual / iTunesConnect_Guide / Chapters / CreatingiTunesConnectRecord . html <nl> + [ electron - osx - sign ] : https : / / github . com / electron - userland / electron - osx - sign <nl> + [ electron - packager ] : https : / / github . com / electron - userland / electron - packager <nl> [ submit - for - review ] : https : / / developer . apple . com / library / ios / documentation / LanguagesUtilities / Conceptual / iTunesConnect_Guide / Chapters / SubmittingTheApp . html <nl> [ app - sandboxing ] : https : / / developer . apple . com / app - sandboxing / <nl> [ ern - tutorial ] : https : / / carouselapps . com / 2015 / 12 / 15 / legally - submit - app - apples - app - store - uses - encryption - obtain - ern / <nl> mmm a / docs / tutorial / using - native - node - modules . md <nl> ppp b / docs / tutorial / using - native - node - modules . md <nl> The ` HOME = ~ / . electron - gyp ` changes where to find development headers . The <nl> ` - - target = 0 . 29 . 1 ` is version of Electron . The ` - - dist - url = . . . ` specifies <nl> where to download the headers . The ` - - arch = x64 ` says the module is built for <nl> 64bit system . <nl> - <nl> - # # # Packaging and signing apps with native modules <nl> - <nl> - Native modules need to be signed . If using electron - osx - sign , be sure to include the path to the built binaries in the argument list ( eg electron - osx - sign yourapp / YourApp . app yourapp / YourApp . app / Contents / Resources / app / node_modules / nativemodule / build / release / nativemodule ) . Also note that native modules may have intermediate files produced which should not be included ( as they would also need to be signed ) . Add - - ignore = . + \ . o $ to your electron - packager build step to ignore these files ( their unsigned inclusion will result in the ITMS - 90135 error ) . <nl> - <nl>
Merge pull request from electron / native - module - signing
electron/electron
243052742e35bd0e18665f9904ccb34f5710f838
2016-06-07T01:40:55Z
mmm a / hphp / hack / src / parser / full_fidelity_validated_syntax . ml <nl> ppp b / hphp / hack / src / parser / full_fidelity_validated_syntax . ml <nl> module Make ( Token : TokenType ) ( SyntaxValue : SyntaxValueType ) = struct <nl> ; alternate_loop_statements = validate_list_with ( validate_statement ) x . alternate_loop_statements <nl> ; alternate_loop_opening_colon = validate_token x . alternate_loop_opening_colon <nl> } <nl> - | s - > validation_fail SyntaxKind . AlternateLoopStatement s <nl> + | s - > validation_fail ( Some SyntaxKind . AlternateLoopStatement ) s <nl> and invalidate_alternate_loop_statement : alternate_loop_statement invalidator = fun ( v , x ) - > <nl> { Syntax . syntax = <nl> Syntax . AlternateLoopStatement <nl> mmm a / hphp / hack / src / parser / smart_constructors / smartConstructorsWrappers . ml <nl> ppp b / hphp / hack / src / parser / smart_constructors / smartConstructorsWrappers . ml <nl> module type SyntaxKind_S = sig <nl> val is_inclusion_expression : r - > bool <nl> val is_inclusion_directive : r - > bool <nl> val is_compound_statement : r - > bool <nl> + val is_alternate_loop_statement : r - > bool <nl> val is_expression_statement : r - > bool <nl> val is_markup_section : r - > bool <nl> val is_markup_suffix : r - > bool <nl> module SyntaxKind ( SC : SC_S ) : <nl> let make_inclusion_expression arg0 arg1 state = compose SK . InclusionExpression ( SC . make_inclusion_expression ( snd arg0 ) ( snd arg1 ) state ) <nl> let make_inclusion_directive arg0 arg1 state = compose SK . InclusionDirective ( SC . make_inclusion_directive ( snd arg0 ) ( snd arg1 ) state ) <nl> let make_compound_statement arg0 arg1 arg2 state = compose SK . CompoundStatement ( SC . make_compound_statement ( snd arg0 ) ( snd arg1 ) ( snd arg2 ) state ) <nl> + let make_alternate_loop_statement arg0 arg1 arg2 arg3 state = compose SK . AlternateLoopStatement ( SC . make_alternate_loop_statement ( snd arg0 ) ( snd arg1 ) ( snd arg2 ) ( snd arg3 ) state ) <nl> let make_expression_statement arg0 arg1 state = compose SK . ExpressionStatement ( SC . make_expression_statement ( snd arg0 ) ( snd arg1 ) state ) <nl> let make_markup_section arg0 arg1 arg2 arg3 state = compose SK . MarkupSection ( SC . make_markup_section ( snd arg0 ) ( snd arg1 ) ( snd arg2 ) ( snd arg3 ) state ) <nl> let make_markup_suffix arg0 arg1 state = compose SK . MarkupSuffix ( SC . make_markup_suffix ( snd arg0 ) ( snd arg1 ) state ) <nl> module SyntaxKind ( SC : SC_S ) : <nl> let is_inclusion_expression = has_kind SK . InclusionExpression <nl> let is_inclusion_directive = has_kind SK . InclusionDirective <nl> let is_compound_statement = has_kind SK . CompoundStatement <nl> + let is_alternate_loop_statement = has_kind SK . AlternateLoopStatement <nl> let is_expression_statement = has_kind SK . ExpressionStatement <nl> let is_markup_section = has_kind SK . MarkupSection <nl> let is_markup_suffix = has_kind SK . MarkupSuffix <nl>
Fix for FFP generated code
facebook/hhvm
204592b62758d3b33bec9b0bb340ad2b26d3f681
2018-02-13T17:43:06Z
mmm a / db / namespace . h <nl> ppp b / db / namespace . h <nl> namespace mongo { <nl> if ( _next = = 0 ) return 0 ; <nl> return ( Extra * ) ( ( ( char * ) d ) + _next ) ; <nl> } <nl> - void setNext ( long ofs ) { getDur ( ) . writing ( this ) ; _next = ofs ; } <nl> + void setNext ( long ofs ) { * getDur ( ) . writing ( & _next ) = ofs ; } <nl> void copy ( NamespaceDetails * d , const Extra & e ) { <nl> memcpy ( this , & e , sizeof ( Extra ) ) ; <nl> _next = 0 ; <nl>
dur declare as small a region as possible for the write intent
mongodb/mongo
81bb882b78b3191ecc944302dfafea5afb414b76
2010-12-16T22:28:34Z
mmm a / src / compiler - dispatcher / compiler - dispatcher . cc <nl> ppp b / src / compiler - dispatcher / compiler - dispatcher . cc <nl> CompilerDispatcher : : ~ CompilerDispatcher ( ) { <nl> } <nl> <nl> bool CompilerDispatcher : : Enqueue ( Handle < SharedFunctionInfo > function ) { <nl> + if ( ! IsEnabled ( ) ) return false ; <nl> + <nl> / / We only handle functions ( no eval / top - level code / wasm ) that are <nl> / / attached to a script . <nl> if ( ! function - > script ( ) - > IsScript ( ) | | ! function - > is_function ( ) | | <nl> bool CompilerDispatcher : : Enqueue ( Handle < SharedFunctionInfo > function ) { <nl> return true ; <nl> } <nl> <nl> + bool CompilerDispatcher : : IsEnabled ( ) const { <nl> + v8 : : Isolate * v8_isolate = reinterpret_cast < v8 : : Isolate * > ( isolate_ ) ; <nl> + return FLAG_compiler_dispatcher & & platform_ - > IdleTasksEnabled ( v8_isolate ) ; <nl> + } <nl> + <nl> bool CompilerDispatcher : : IsEnqueued ( Handle < SharedFunctionInfo > function ) const { <nl> return GetJobFor ( function ) ! = jobs_ . end ( ) ; <nl> } <nl> CompilerDispatcher : : JobMap : : const_iterator CompilerDispatcher : : GetJobFor ( <nl> <nl> void CompilerDispatcher : : ScheduleIdleTaskIfNeeded ( ) { <nl> v8 : : Isolate * v8_isolate = reinterpret_cast < v8 : : Isolate * > ( isolate_ ) ; <nl> - if ( ! platform_ - > IdleTasksEnabled ( v8_isolate ) ) return ; <nl> + DCHECK ( platform_ - > IdleTasksEnabled ( v8_isolate ) ) ; <nl> if ( idle_task_scheduled_ ) return ; <nl> if ( jobs_ . empty ( ) ) return ; <nl> idle_task_scheduled_ = true ; <nl> mmm a / src / compiler - dispatcher / compiler - dispatcher . h <nl> ppp b / src / compiler - dispatcher / compiler - dispatcher . h <nl> class V8_EXPORT_PRIVATE CompilerDispatcher { <nl> JobMap ; <nl> class IdleTask ; <nl> <nl> + bool IsEnabled ( ) const ; <nl> JobMap : : const_iterator GetJobFor ( Handle < SharedFunctionInfo > shared ) const ; <nl> void ScheduleIdleTaskIfNeeded ( ) ; <nl> void DoIdleWork ( double deadline_in_seconds ) ; <nl> mmm a / src / flag - definitions . h <nl> ppp b / src / flag - definitions . h <nl> DEFINE_BOOL ( string_slices , true , " use string slices " ) <nl> DEFINE_BOOL ( ignition , false , " use ignition interpreter " ) <nl> DEFINE_BOOL ( ignition_staging , false , " use ignition with all staged features " ) <nl> DEFINE_IMPLICATION ( ignition_staging , ignition ) <nl> + DEFINE_IMPLICATION ( ignition_staging , compiler_dispatcher ) <nl> DEFINE_STRING ( ignition_filter , " * " , " filter for ignition interpreter " ) <nl> DEFINE_BOOL ( ignition_deadcode , true , <nl> " use ignition dead code elimination optimizer " ) <nl> DEFINE_BOOL ( compilation_cache , true , " enable compilation cache " ) <nl> <nl> DEFINE_BOOL ( cache_prototype_transitions , true , " cache prototype transitions " ) <nl> <nl> + / / compiler - dispatcher . cc <nl> + DEFINE_BOOL ( compiler_dispatcher , false , " enable compiler dispatcher " ) <nl> + <nl> / / cpu - profiler . cc <nl> DEFINE_INT ( cpu_profiler_sampling_interval , 1000 , <nl> " CPU profiler sampling interval in microseconds " ) <nl> mmm a / test / unittests / compiler - dispatcher / compiler - dispatcher - unittest . cc <nl> ppp b / test / unittests / compiler - dispatcher / compiler - dispatcher - unittest . cc <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - typedef TestWithContext CompilerDispatcherTest ; <nl> + class CompilerDispatcherTest : public TestWithContext { <nl> + public : <nl> + CompilerDispatcherTest ( ) = default ; <nl> + ~ CompilerDispatcherTest ( ) override = default ; <nl> + <nl> + static void SetUpTestCase ( ) { <nl> + old_flag_ = i : : FLAG_ignition ; <nl> + i : : FLAG_ignition = true ; <nl> + i : : FLAG_compiler_dispatcher = true ; <nl> + TestWithContext : : SetUpTestCase ( ) ; <nl> + } <nl> + <nl> + static void TearDownTestCase ( ) { <nl> + TestWithContext : : TearDownTestCase ( ) ; <nl> + i : : FLAG_ignition = old_flag_ ; <nl> + } <nl> + <nl> + private : <nl> + static bool old_flag_ ; <nl> + <nl> + DISALLOW_COPY_AND_ASSIGN ( CompilerDispatcherTest ) ; <nl> + } ; <nl> + <nl> + bool CompilerDispatcherTest : : old_flag_ ; <nl> <nl> namespace { <nl> <nl>
Disable the CompilerDispatcher if we don ' t have idle time
v8/v8
a0d9eb346bba90aa0b32a2d3184cbbfd6adb243e
2016-12-23T15:11:15Z
mmm a / toolsrc / src / VcpkgPaths . cpp <nl> ppp b / toolsrc / src / VcpkgPaths . cpp <nl> namespace vcpkg <nl> return nullopt ; <nl> } <nl> <nl> - static std : : vector < Toolset > find_toolset_instances ( const VcpkgPaths & paths ) <nl> + static std : : vector < ToolsetArchOption > detect_supported_architectures ( const Files : : Filesystem & fs , <nl> + const fs : : path & vcvarsall_dir ) <nl> { <nl> using CPU = System : : CPUArchitecture ; <nl> + std : : vector < ToolsetArchOption > supported_architectures ; <nl> + <nl> + if ( fs . exists ( vcvarsall_dir / " vcvars32 . bat " ) ) supported_architectures . push_back ( { L " x86 " , CPU : : X86 , CPU : : X86 } ) ; <nl> + if ( fs . exists ( vcvarsall_dir / " vcvars64 . bat " ) ) <nl> + supported_architectures . push_back ( { L " amd64 " , CPU : : X64 , CPU : : X64 } ) ; <nl> + if ( fs . exists ( vcvarsall_dir / " vcvarsx86_amd64 . bat " ) ) <nl> + supported_architectures . push_back ( { L " x86_amd64 " , CPU : : X86 , CPU : : X64 } ) ; <nl> + if ( fs . exists ( vcvarsall_dir / " vcvarsx86_arm . bat " ) ) <nl> + supported_architectures . push_back ( { L " x86_arm " , CPU : : X86 , CPU : : ARM } ) ; <nl> + if ( fs . exists ( vcvarsall_dir / " vcvarsamd64_x86 . bat " ) ) <nl> + supported_architectures . push_back ( { L " amd64_x86 " , CPU : : X64 , CPU : : X86 } ) ; <nl> + if ( fs . exists ( vcvarsall_dir / " vcvarsamd64_arm . bat " ) ) <nl> + supported_architectures . push_back ( { L " amd64_arm " , CPU : : X64 , CPU : : ARM } ) ; <nl> + <nl> + return supported_architectures ; <nl> + } <nl> <nl> + static std : : vector < Toolset > find_toolset_instances ( const VcpkgPaths & paths ) <nl> + { <nl> const auto & fs = paths . get_filesystem ( ) ; <nl> <nl> const std : : vector < std : : string > vs2017_installation_instances = get_vs2017_installation_instances ( paths ) ; <nl> namespace vcpkg <nl> paths_examined . push_back ( vs2015_dumpbin_exe ) ; <nl> <nl> const fs : : path vs2015_bin_dir = vs2015_vcvarsall_bat . parent_path ( ) / " bin " ; <nl> - std : : vector < ToolsetArchOption > supported_architectures ; <nl> - if ( fs . exists ( vs2015_bin_dir / " vcvars32 . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86 " , CPU : : X86 , CPU : : X86 } ) ; <nl> - if ( fs . exists ( vs2015_bin_dir / " amd64 \ \ vcvars64 . bat " ) ) <nl> - supported_architectures . push_back ( { L " x64 " , CPU : : X64 , CPU : : X64 } ) ; <nl> - if ( fs . exists ( vs2015_bin_dir / " x86_amd64 \ \ vcvarsx86_amd64 . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86_amd64 " , CPU : : X86 , CPU : : X64 } ) ; <nl> - if ( fs . exists ( vs2015_bin_dir / " x86_arm \ \ vcvarsx86_arm . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86_arm " , CPU : : X86 , CPU : : ARM } ) ; <nl> - if ( fs . exists ( vs2015_bin_dir / " amd64_x86 \ \ vcvarsamd64_x86 . bat " ) ) <nl> - supported_architectures . push_back ( { L " amd64_x86 " , CPU : : X64 , CPU : : X86 } ) ; <nl> - if ( fs . exists ( vs2015_bin_dir / " amd64_arm \ \ vcvarsamd64_arm . bat " ) ) <nl> - supported_architectures . push_back ( { L " amd64_arm " , CPU : : X64 , CPU : : ARM } ) ; <nl> + const std : : vector < ToolsetArchOption > supported_architectures = <nl> + detect_supported_architectures ( fs , vs2015_bin_dir ) ; <nl> <nl> if ( fs . exists ( vs2015_dumpbin_exe ) ) <nl> { <nl> namespace vcpkg <nl> if ( ! fs . exists ( vcvarsall_bat ) ) continue ; <nl> <nl> / / Get all supported architectures <nl> - std : : vector < ToolsetArchOption > supported_architectures ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvars32 . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86 " , CPU : : X86 , CPU : : X86 } ) ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvars64 . bat " ) ) <nl> - supported_architectures . push_back ( { L " amd64 " , CPU : : X64 , CPU : : X64 } ) ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvarsx86_amd64 . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86_amd64 " , CPU : : X86 , CPU : : X64 } ) ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvarsx86_arm . bat " ) ) <nl> - supported_architectures . push_back ( { L " x86_arm " , CPU : : X86 , CPU : : ARM } ) ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvarsamd64_x86 . bat " ) ) <nl> - supported_architectures . push_back ( { L " amd64_x86 " , CPU : : X64 , CPU : : X86 } ) ; <nl> - if ( fs . exists ( vcvarsall_dir / " vcvarsamd64_arm . bat " ) ) <nl> - supported_architectures . push_back ( { L " amd64_arm " , CPU : : X64 , CPU : : ARM } ) ; <nl> + const std : : vector < ToolsetArchOption > supported_architectures = <nl> + detect_supported_architectures ( fs , vcvarsall_dir ) ; <nl> <nl> / / Locate the " best " MSVC toolchain version <nl> const fs : : path msvc_path = vc_dir / " Tools " / " MSVC " ; <nl>
Extract function for duplicated code
microsoft/vcpkg
eca068e4c5673b888d6470b42d6b5b44b21c4007
2017-09-28T00:22:40Z
mmm a / cocos / editor - support / cocostudio / CCSSceneReader . cpp <nl> ppp b / cocos / editor - support / cocostudio / CCSSceneReader . cpp <nl> Node * SceneReader : : createObject ( const rapidjson : : Value & dict , cocos2d : : Node * par <nl> { <nl> gb - > addComponent ( com ) ; <nl> } <nl> - else <nl> - { <nl> - CC_SAFE_RELEASE_NULL ( com ) ; <nl> - } <nl> + else <nl> + { <nl> + com = nullptr ; <nl> + } <nl> } <nl> if ( _fnSelector ! = nullptr ) <nl> { <nl> mmm a / cocos / editor - support / cocostudio / TriggerObj . cpp <nl> ppp b / cocos / editor - support / cocostudio / TriggerObj . cpp <nl> void TriggerObj : : serialize ( const rapidjson : : Value & val ) <nl> CCASSERT ( con ! = nullptr , " " ) ; <nl> con - > serialize ( subDict ) ; <nl> con - > init ( ) ; <nl> - con - > autorelease ( ) ; <nl> _cons . pushBack ( con ) ; <nl> } <nl> <nl> void TriggerObj : : serialize ( const rapidjson : : Value & val ) <nl> } <nl> act - > serialize ( subDict ) ; <nl> act - > init ( ) ; <nl> - act - > autorelease ( ) ; <nl> _acts . pushBack ( act ) ; <nl> } <nl> <nl>
closed : SceneTest of CocoStudio crashes
cocos2d/cocos2d-x
c6e709327008acaed74d3dd84ba743b117962844
2014-01-24T03:50:58Z
mmm a / android / filament - android / CMakeLists . txt <nl> ppp b / android / filament - android / CMakeLists . txt <nl> set_target_properties ( smol - v PROPERTIES IMPORTED_LOCATION <nl> $ { FILAMENT_DIR } / lib / $ { ANDROID_ABI } / libsmol - v . a ) <nl> <nl> <nl> - include_directories ( . . $ { FILAMENT_DIR } / include ) <nl> - <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - fno - stack - protector " ) <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - fno - exceptions - fno - unwind - tables - fno - asynchronous - unwind - tables - fno - rtti " ) <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - ffast - math - ffp - contract = fast " ) <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - fvisibility - inlines - hid <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - fvisibility = hidden " ) <nl> set ( CMAKE_CXX_FLAGS_RELEASE " $ { CMAKE_CXX_FLAGS_RELEASE } - fomit - frame - pointer - ffunction - sections - fdata - sections " ) <nl> <nl> - set ( CMAKE_SHARED_LINKER_FLAGS " $ { CMAKE_SHARED_LINKER_FLAGS } - Wl , - - gc - sections " ) <nl> - set ( CMAKE_SHARED_LINKER_FLAGS " $ { CMAKE_SHARED_LINKER_FLAGS } - Wl , - Bsymbolic - functions " ) <nl> + set ( CMAKE_SHARED_LINKER_FLAGS " $ { CMAKE_SHARED_LINKER_FLAGS } - Wl , - - gc - sections " ) <nl> + set ( CMAKE_SHARED_LINKER_FLAGS " $ { CMAKE_SHARED_LINKER_FLAGS } - Wl , - Bsymbolic - functions " ) <nl> <nl> - set ( CMAKE_SHARED_LINKER_FLAGS_RELEASE " $ { CMAKE_SHARED_LINKER_FLAGS_RELEASE } - Wl , - - version - script = $ { CMAKE_CURRENT_SOURCE_DIR } / libfilament - jni . map " ) <nl> + set ( VERSION_SCRIPT " $ { CMAKE_CURRENT_SOURCE_DIR } / libfilament - jni . map " ) <nl> + set ( CMAKE_SHARED_LINKER_FLAGS_RELEASE " $ { CMAKE_SHARED_LINKER_FLAGS_RELEASE } - Wl , - - version - script = $ { VERSION_SCRIPT } " ) <nl> <nl> add_library ( filament - jni SHARED <nl> src / main / cpp / Camera . cpp <nl> add_library ( filament - jni SHARED <nl> . . / common / NioUtils . cpp <nl> ) <nl> <nl> + # Ordering is significant in the following list . The PRIVATE qualifier prevents transitive deps . <nl> target_link_libraries ( filament - jni <nl> - filament <nl> - backend <nl> - filaflat <nl> - filabridge <nl> - geometry <nl> - ibl <nl> - utils <nl> - log <nl> - GLESv3 <nl> - EGL <nl> - android <nl> - jnigraphics <nl> + PRIVATE filament <nl> + PRIVATE backend <nl> + PRIVATE filaflat <nl> + PRIVATE filabridge <nl> + PRIVATE geometry <nl> + PRIVATE ibl <nl> + PRIVATE log <nl> + PRIVATE GLESv3 <nl> + PRIVATE EGL <nl> + PRIVATE android <nl> + PRIVATE jnigraphics <nl> + PRIVATE utils <nl> ) <nl> <nl> + target_include_directories ( filament - jni PRIVATE <nl> + . . <nl> + $ { FILAMENT_DIR } / include <nl> + . . / . . / third_party / robin - map <nl> + . . / . . / libs / utils / include ) <nl> + <nl> + # Force a relink when the version script is changed : <nl> + set_target_properties ( filament - jni PROPERTIES LINK_DEPENDS $ { VERSION_SCRIPT } ) <nl> + <nl> option ( FILAMENT_SUPPORTS_VULKAN " Enables Vulkan on Android " OFF ) <nl> <nl> if ( FILAMENT_SUPPORTS_VULKAN ) <nl> mmm a / android / filament - android / libfilament - jni . map <nl> ppp b / android / filament - android / libfilament - jni . map <nl> <nl> LIBFILAMENT { <nl> - global : Java_com_google_android_filament_ * ; JNI * ; <nl> + global : * filament * ; JNI * ; <nl> local : * ; <nl> } ; <nl> \ No newline at end of file <nl> mmm a / android / gltfio - android / CMakeLists . txt <nl> ppp b / android / gltfio - android / CMakeLists . txt <nl> set ( FILAMENT_DIR $ { FILAMENT_DIST_DIR } ) <nl> <nl> add_subdirectory ( $ { CMAKE_CURRENT_SOURCE_DIR } / . . / filament - android $ { CMAKE_CURRENT_BINARY_DIR } / filament - android ) <nl> <nl> + add_library ( utils STATIC IMPORTED ) <nl> + set_target_properties ( utils PROPERTIES IMPORTED_LOCATION <nl> + $ { FILAMENT_DIR } / lib / $ { ANDROID_ABI } / libutils . a ) <nl> + <nl> add_library ( gltfio STATIC IMPORTED ) <nl> set_target_properties ( gltfio PROPERTIES IMPORTED_LOCATION <nl> $ { FILAMENT_DIR } / lib / $ { ANDROID_ABI } / libgltfio_core . a ) <nl> set_target_properties ( gltfio - jni PROPERTIES LINK_DEPENDS <nl> target_link_libraries ( gltfio - jni <nl> filament - jni <nl> gltfio <nl> + utils <nl> gltfio_resources <nl> + log <nl> ) <nl> mmm a / filament / include / filament / Box . h <nl> ppp b / filament / include / filament / Box . h <nl> class UTILS_PUBLIC Box { <nl> / * * <nl> * An axis aligned box represented by its min and max coordinates <nl> * / <nl> - struct Aabb { <nl> + struct UTILS_PUBLIC Aabb { <nl> <nl> / * * min coordinates * / <nl> math : : float3 min = std : : numeric_limits < float > : : max ( ) ; <nl>
gltfio size reduction 2 / 3 : proper shared linking
google/filament
ffff6dd580cf56647a2b2c246010a7037aa5e794
2020-02-14T22:56:38Z
mmm a / tensorflow / compiler / xla / client / xla_builder . cc <nl> ppp b / tensorflow / compiler / xla / client / xla_builder . cc <nl> XlaOp XlaBuilder : : AfterAll ( absl : : Span < const XlaOp > tokens ) { <nl> <nl> XlaOp XlaBuilder : : CustomCall ( const string & call_target_name , <nl> absl : : Span < const XlaOp > operands , <nl> - const Shape & shape ) { <nl> + const Shape & shape , const string & opaque ) { <nl> return ReportErrorOrReturn ( [ & ] ( ) - > StatusOr < XlaOp > { <nl> HloInstructionProto instr ; <nl> if ( absl : : StartsWith ( call_target_name , " $ " ) ) { <nl> XlaOp XlaBuilder : : CustomCall ( const string & call_target_name , <nl> } <nl> * instr . mutable_shape ( ) = shape ; <nl> instr . set_custom_call_target ( call_target_name ) ; <nl> + instr . set_custom_call_opaque ( opaque ) ; <nl> return AddInstruction ( std : : move ( instr ) , HloOpcode : : kCustomCall , operands ) ; <nl> } ) ; <nl> } <nl> XlaOp Call ( XlaBuilder * builder , const XlaComputation & computation , <nl> } <nl> <nl> XlaOp CustomCall ( XlaBuilder * builder , const string & call_target_name , <nl> - absl : : Span < const XlaOp > operands , const Shape & shape ) { <nl> - return builder - > CustomCall ( call_target_name , operands , shape ) ; <nl> + absl : : Span < const XlaOp > operands , const Shape & shape , <nl> + const string & opaque ) { <nl> + return builder - > CustomCall ( call_target_name , operands , shape , opaque ) ; <nl> } <nl> <nl> XlaOp Complex ( const XlaOp & real , const XlaOp & imag , <nl> mmm a / tensorflow / compiler / xla / client / xla_builder . h <nl> ppp b / tensorflow / compiler / xla / client / xla_builder . h <nl> class XlaBuilder { <nl> absl : : Span < const XlaOp > operands ) ; <nl> <nl> / / Enqueues a custom call instruction onto the computation . <nl> - / / During code generation , a call instruction is emitted which targets a <nl> - / / symbol with the name | call_target_name | . The | operands | are passed to the <nl> - / / call instruction . | shape | is the resultant shape . <nl> XlaOp CustomCall ( const string & call_target_name , <nl> - absl : : Span < const XlaOp > operands , const Shape & shape ) ; <nl> + absl : : Span < const XlaOp > operands , const Shape & shape , <nl> + const string & opaque ) ; <nl> <nl> / / The following methods enqueue element - wise binary arithmetic operations <nl> / / onto the computation . The shapes of the operands have to match unless one <nl> class XlaBuilder { <nl> friend XlaOp Call ( XlaBuilder * builder , const XlaComputation & computation , <nl> absl : : Span < const XlaOp > operands ) ; <nl> friend XlaOp CustomCall ( XlaBuilder * builder , const string & call_target_name , <nl> - absl : : Span < const XlaOp > operands , const Shape & shape ) ; <nl> + absl : : Span < const XlaOp > operands , const Shape & shape , <nl> + const string & opaque ) ; <nl> friend XlaOp Complex ( const XlaOp & real , const XlaOp & imag , <nl> absl : : Span < const int64 > broadcast_dimensions ) ; <nl> friend XlaOp Conj ( const XlaOp & operand ) ; <nl> XlaOp OutfeedWithToken ( const XlaOp & operand , const XlaOp & token , <nl> XlaOp Call ( XlaBuilder * builder , const XlaComputation & computation , <nl> absl : : Span < const XlaOp > operands ) ; <nl> <nl> - / / Enqueues a custom call instruction onto the computation . <nl> - / / During code generation , a call instruction is emitted which targets a <nl> - / / symbol with the name | call_target_name | . The | operands | are passed to the <nl> - / / call instruction . | shape | is the resultant shape . <nl> + / / Enqueues a custom call instruction onto the computation . A custom call <nl> + / / invokes code external to XLA . The | operands | are passed to the external code , <nl> + / / and the external code is expected to produce a result of the given <nl> + / / | shape | . The exact mechanism is backend - specific . For example , in the CPU <nl> + / / backend , a call instruction is emitted which targets a symbol with the name <nl> + / / | call_target_name | . | call_target_name | and | opaque | can arbitrary strings , <nl> + / / but | call_target_name | should be short as it may be used in labels . | opaque | <nl> + / / can encode arbitrarily large amounts of information . <nl> XlaOp CustomCall ( XlaBuilder * builder , const string & call_target_name , <nl> - absl : : Span < const XlaOp > operands , const Shape & shape ) ; <nl> + absl : : Span < const XlaOp > operands , const Shape & shape , <nl> + const string & opaque = " " ) ; <nl> <nl> / / The following methods enqueue element - wise binary arithmetic operations <nl> / / onto the computation . The shapes of the operands have to match unless one <nl> mmm a / tensorflow / compiler / xla / service / hlo . proto <nl> ppp b / tensorflow / compiler / xla / service / hlo . proto <nl> import " tensorflow / compiler / xla / xla_data . proto " ; <nl> option cc_enable_arenas = true ; <nl> <nl> / / Serialization of HloInstruction . <nl> - / / Next ID : 53 <nl> + / / Next ID : 54 <nl> message HloInstructionProto { <nl> reserved 10 ; <nl> reserved " parameter_name " ; <nl> message HloInstructionProto { <nl> / / The string representation of the infeed configuration . <nl> bytes infeed_config = 27 ; <nl> <nl> - / / Name of a global symbol to call , only present for kCustomCall . <nl> + / / Name of a external target ( eg , global symbol ) to call , only present for <nl> + / / kCustomCall . <nl> string custom_call_target = 28 ; <nl> <nl> + / / Opaque string , only present for kCustomCall . <nl> + string custom_call_opaque = 53 ; <nl> + <nl> / / Shape of outfeed request . <nl> xla . Shape outfeed_shape = 29 ; <nl> <nl> mmm a / tensorflow / compiler / xla / service / hlo_instruction . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_instruction . cc <nl> StatusOr < std : : unique_ptr < HloInstruction > > HloInstruction : : CreateFromProto ( <nl> break ; <nl> case HloOpcode : : kCustomCall : <nl> instruction = CreateCustomCall ( proto . shape ( ) , all_operands ( ) , <nl> - proto . custom_call_target ( ) ) ; <nl> + proto . custom_call_target ( ) , <nl> + proto . custom_call_opaque ( ) ) ; <nl> if ( proto . has_window ( ) ) { <nl> static_cast < HloCustomCallInstruction * > ( instruction . get ( ) ) <nl> - > set_window ( proto . window ( ) ) ; <nl> bool HloInstruction : : HasSideEffect ( ) const { <nl> <nl> / * static * / std : : unique_ptr < HloInstruction > HloInstruction : : CreateCustomCall ( <nl> const Shape & shape , absl : : Span < HloInstruction * const > operands , <nl> - absl : : string_view custom_call_target ) { <nl> - return absl : : make_unique < HloCustomCallInstruction > ( shape , operands , <nl> - custom_call_target ) ; <nl> + absl : : string_view custom_call_target , absl : : string_view opaque ) { <nl> + return absl : : make_unique < HloCustomCallInstruction > ( <nl> + shape , operands , custom_call_target , opaque ) ; <nl> } <nl> <nl> / * static * / std : : unique_ptr < HloInstruction > HloInstruction : : CreateTuple ( <nl> mmm a / tensorflow / compiler / xla / service / hlo_instruction . h <nl> ppp b / tensorflow / compiler / xla / service / hlo_instruction . h <nl> class HloInstruction { <nl> HloComputation * computation ) ; <nl> <nl> / / Creates a custom call instruction that applies the given custom call target <nl> - / / to the given operands . " shape " is the resultant shape . <nl> + / / to the given operands . " opaque " can be an arbitrary string with a <nl> + / / backend - specific interpretation . " shape " is the resultant shape . <nl> static std : : unique_ptr < HloInstruction > CreateCustomCall ( <nl> const Shape & shape , absl : : Span < HloInstruction * const > operands , <nl> - absl : : string_view custom_call_target ) ; <nl> + absl : : string_view custom_call_target , absl : : string_view opaque = " " ) ; <nl> <nl> / / Creates a tuple instruction with the given elements . This is a convenience <nl> / / wrapper around CreateVariadic . <nl> mmm a / tensorflow / compiler / xla / service / hlo_instructions . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_instructions . cc <nl> HloSelectAndScatterInstruction : : CloneWithNewOperandsImpl ( <nl> <nl> HloCustomCallInstruction : : HloCustomCallInstruction ( <nl> const Shape & shape , absl : : Span < HloInstruction * const > operands , <nl> - absl : : string_view custom_call_target ) <nl> + absl : : string_view custom_call_target , absl : : string_view opaque ) <nl> : HloInstruction ( HloOpcode : : kCustomCall , shape ) , <nl> custom_call_target_ ( custom_call_target . begin ( ) , custom_call_target . end ( ) ) , <nl> + opaque_ ( opaque . begin ( ) , opaque . end ( ) ) , <nl> feature_group_count_ ( 1 ) { <nl> for ( auto operand : operands ) { <nl> AppendOperand ( operand ) ; <nl> HloInstructionProto HloCustomCallInstruction : : ToProto ( ) const { <nl> * convolution_dimension_numbers_ ; <nl> } <nl> proto . set_custom_call_target ( custom_call_target_ ) ; <nl> + proto . set_custom_call_opaque ( opaque_ ) ; <nl> proto . set_feature_group_count ( feature_group_count_ ) ; <nl> return proto ; <nl> } <nl> std : : vector < string > HloCustomCallInstruction : : ExtraAttributesToStringImpl ( <nl> / / an HloComputation . <nl> extra . push_back ( <nl> StrCat ( " custom_call_target = \ " " , CEscape ( custom_call_target_ ) , " \ " " ) ) ; <nl> + / / If the opaque string becomes enormous we may want to reconsider printing <nl> + / / this inline and consider other options . <nl> + if ( ! opaque_ . empty ( ) ) { <nl> + extra . push_back ( StrCat ( " opaque = \ " " , CEscape ( opaque_ ) , " \ " " ) ) ; <nl> + } <nl> return extra ; <nl> } <nl> <nl> bool HloCustomCallInstruction : : IdenticalSlowPath ( <nl> if ( feature_group_count_ ! = casted_other . feature_group_count_ ) { <nl> return false ; <nl> } <nl> - return custom_call_target_ = = casted_other . custom_call_target_ ; <nl> + return custom_call_target_ = = casted_other . custom_call_target_ & & <nl> + opaque_ = = casted_other . opaque_ ; <nl> } <nl> <nl> std : : unique_ptr < HloInstruction > <nl> HloCustomCallInstruction : : CloneWithNewOperandsImpl ( <nl> const Shape & shape , absl : : Span < HloInstruction * const > new_operands , <nl> HloCloneContext * context ) const { <nl> auto cloned = absl : : make_unique < HloCustomCallInstruction > ( <nl> - shape , new_operands , custom_call_target ( ) ) ; <nl> + shape , new_operands , custom_call_target ( ) , opaque ( ) ) ; <nl> if ( window_ ! = nullptr ) { <nl> cloned - > set_window ( * window_ ) ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_instructions . h <nl> ppp b / tensorflow / compiler / xla / service / hlo_instructions . h <nl> class HloCustomCallInstruction : public HloInstruction { <nl> public : <nl> explicit HloCustomCallInstruction ( const Shape & shape , <nl> absl : : Span < HloInstruction * const > operands , <nl> - absl : : string_view custom_call_target ) ; <nl> + absl : : string_view custom_call_target , <nl> + absl : : string_view opaque ) ; <nl> const Window & window ( ) const override { <nl> CHECK ( window_ ! = nullptr ) ; <nl> return * window_ ; <nl> class HloCustomCallInstruction : public HloInstruction { <nl> convolution_dimension_numbers_ = <nl> absl : : make_unique < ConvolutionDimensionNumbers > ( dnums ) ; <nl> } <nl> + const string & opaque ( ) const { return opaque_ ; } <nl> const string & custom_call_target ( ) const { return custom_call_target_ ; } <nl> void set_feature_group_count ( int64 feature_group_count ) { <nl> feature_group_count_ = feature_group_count ; <nl> class HloCustomCallInstruction : public HloInstruction { <nl> std : : unique_ptr < HloInstruction > CloneWithNewOperandsImpl ( <nl> const Shape & shape , absl : : Span < HloInstruction * const > new_operands , <nl> HloCloneContext * context ) const override ; <nl> - / / Name of a global symbol to call , only present for kCustomCall . <nl> + / / Name of a global symbol to call . <nl> string custom_call_target_ ; <nl> + / / Opaque string interpreted by the backend . <nl> + string opaque_ ; <nl> / / Describes the window in a windowed operation such as convolution . <nl> std : : unique_ptr < Window > window_ ; <nl> / / Describes the dimension numbers used for a convolution . <nl> mmm a / tensorflow / compiler / xla / service / hlo_parser . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_parser . cc <nl> bool HloParser : : ParseInstruction ( HloComputation : : Builder * builder , <nl> } <nl> case HloOpcode : : kCustomCall : { <nl> optional < string > custom_call_target ; <nl> + optional < string > opaque ; <nl> optional < Window > window ; <nl> optional < ConvolutionDimensionNumbers > dnums ; <nl> optional < int64 > feature_group_count ; <nl> attrs [ " custom_call_target " ] = { / * required = * / true , AttrTy : : kString , <nl> & custom_call_target } ; <nl> + attrs [ " opaque " ] = { / * required = * / false , AttrTy : : kString , & opaque } ; <nl> attrs [ " window " ] = { / * required = * / false , AttrTy : : kWindow , & window } ; <nl> attrs [ " dim_labels " ] = { / * required = * / false , <nl> AttrTy : : kConvolutionDimensionNumbers , & dnums } ; <nl> bool HloParser : : ParseInstruction ( HloComputation : : Builder * builder , <nl> if ( ! ParseOperands ( & operands ) | | ! ParseAttributes ( attrs ) ) { <nl> return false ; <nl> } <nl> - instruction = builder - > AddInstruction ( HloInstruction : : CreateCustomCall ( <nl> - shape , operands , * custom_call_target ) ) ; <nl> + instruction = builder - > AddInstruction ( <nl> + HloInstruction : : CreateCustomCall ( shape , operands , * custom_call_target , <nl> + opaque . has_value ( ) ? * opaque : " " ) ) ; <nl> if ( window . has_value ( ) ) { <nl> instruction - > set_window ( * window ) ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_parser_test . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_parser_test . cc <nl> ENTRY CustomCall { <nl> ROOT custom - call = f32 [ 1 , 2 , 3 ] { 0 , 2 , 1 } custom - call ( constant ) , custom_call_target = " foo \ " bar " <nl> } <nl> <nl> + ) " <nl> + } , <nl> + / / CustomCall with opaque value . <nl> + { <nl> + " CustomCallWithOpaque " , <nl> + R " ( HloModule custom_call <nl> + <nl> + ENTRY CustomCall { <nl> + constant = f32 [ 1 ] { 0 } constant ( { 12345 } ) <nl> + ROOT custom - call = f32 [ 1 , 2 , 3 ] { 0 , 2 , 1 } custom - call ( constant ) , custom_call_target = " foo \ " bar " , opaque = " this string is opaque " <nl> + } <nl> + <nl> ) " <nl> } , <nl> / / Variables with non - default names <nl>
Add opaque field to custom call .
tensorflow/tensorflow
6d41787c32483b28f8c93973f28d4d078ea0b37e
2018-09-27T17:56:27Z
mmm a / xbmc / guilib / Texture . cpp <nl> ppp b / xbmc / guilib / Texture . cpp <nl> bool CBaseTexture : : LoadFromFile ( const CStdString & texturePath , unsigned int maxW <nl> return false ; <nl> } <nl> <nl> + if ( originalWidth ) <nl> + * originalWidth = image . originalwidth ; <nl> + if ( originalHeight ) <nl> + * originalHeight = image . originalheight ; <nl> + <nl> + LoadFromImage ( image , autoRotate ) ; <nl> + dll . ReleaseImage ( & image ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CBaseTexture : : LoadFromImage ( ImageInfo & image , bool autoRotate ) <nl> + { <nl> m_hasAlpha = NULL ! = image . alpha ; <nl> <nl> Allocate ( image . width , image . height , XB_FMT_A8R8G8B8 ) ; <nl> if ( autoRotate & & image . exifInfo . Orientation ) <nl> m_orientation = image . exifInfo . Orientation - 1 ; <nl> - if ( originalWidth ) <nl> - * originalWidth = image . originalwidth ; <nl> - if ( originalHeight ) <nl> - * originalHeight = image . originalheight ; <nl> <nl> unsigned int dstPitch = GetPitch ( ) ; <nl> unsigned int srcPitch = ( ( image . width + 1 ) * 3 / 4 ) * 4 ; / / bitmap row length is aligned to 4 bytes <nl> bool CBaseTexture : : LoadFromFile ( const CStdString & texturePath , unsigned int maxW <nl> dst + = dstPitch ; <nl> } <nl> } <nl> - dll . ReleaseImage ( & image ) ; <nl> - <nl> ClampToEdge ( ) ; <nl> - <nl> - return true ; <nl> } <nl> <nl> bool CBaseTexture : : LoadFromMemory ( unsigned int width , unsigned int height , unsigned int pitch , unsigned int format , bool hasAlpha , unsigned char * pixels ) <nl> mmm a / xbmc / guilib / Texture . h <nl> ppp b / xbmc / guilib / Texture . h <nl> struct COLOR { unsigned char b , g , r , x ; } ; / / Windows GDI expects 4bytes per color <nl> class CTexture ; <nl> class CGLTexture ; <nl> class CDXTexture ; <nl> + struct ImageInfo ; <nl> <nl> / * ! <nl> \ ingroup textures <nl> class CBaseTexture <nl> bool SwapBlueRed ( unsigned char * pixels , unsigned int height , unsigned int pitch , unsigned int elements = 4 , unsigned int offset = 0 ) ; <nl> <nl> protected : <nl> + void LoadFromImage ( ImageInfo & image , bool autoRotate = false ) ; <nl> / / helpers for computation of texture parameters for compressed textures <nl> unsigned int GetPitch ( unsigned int width ) const ; <nl> unsigned int GetRows ( unsigned int height ) const ; <nl>
[ imageloader ] factor out LoadFromImage
xbmc/xbmc
55db267497fca66ab6fabd6507611d17094d9b35
2012-07-03T23:54:56Z
mmm a / depends / packages / native_cdrkit . mk <nl> ppp b / depends / packages / native_cdrkit . mk <nl> <nl> package = native_cdrkit <nl> $ ( package ) _version = 1 . 1 . 11 <nl> - $ ( package ) _download_path = http : / / distro . ibiblio . org / fatdog / source / c <nl> + $ ( package ) _download_path = http : / / distro . ibiblio . org / fatdog / source / 600 / c <nl> $ ( package ) _file_name = cdrkit - $ ( $ ( package ) _version ) . tar . bz2 <nl> $ ( package ) _sha256_hash = b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564 <nl> $ ( package ) _patches = cdrkit - deterministic . patch <nl>
Fix download link for gitian builds
bitcoin/bitcoin
164a45f57a8a7367e67a5e65b9e938844730cd87
2014-12-13T09:03:33Z
mmm a / src / s390 / disasm - s390 . cc <nl> ppp b / src / s390 / disasm - s390 . cc <nl> bool Decoder : : DecodeFourByte ( Instruction * instr ) { <nl> Format ( instr , " llghr \ t ' r5 , ' r6 " ) ; <nl> break ; <nl> case LOCR : <nl> - Format ( instr , " locr \ t ' m1 , ' r5 , ' r6 " ) ; <nl> + Format ( instr , " locr \ t ' r5 , ' r6 , ' m2 " ) ; <nl> break ; <nl> case LOCGR : <nl> - Format ( instr , " locgr \ t ' m1 , ' r5 , ' r6 " ) ; <nl> + Format ( instr , " locgr \ t ' r5 , ' r6 , ' m2 " ) ; <nl> break ; <nl> case LNGR : <nl> Format ( instr , " lngr \ t ' r5 , ' r6 " ) ; <nl>
s390 : Fix LOCR / LOCGR disassembly
v8/v8
7ea34a90f5d1f81b3bfa10866eac66f02869d7c2
2018-06-07T18:55:17Z
mmm a / arangod / Aql / Functions . cpp <nl> ppp b / arangod / Aql / Functions . cpp <nl> static inline Json ExpandShapedJson ( VocShaper * shaper , <nl> static inline void ExpandShapedJson ( <nl> VocShaper * shaper , CollectionNameResolver const * resolver , <nl> TRI_voc_cid_t const & cid , TRI_doc_mptr_t const * mptr , VPackBuilder & b , <nl> - bool keepTopLevelOpen = false , <nl> - std : : unordered_set < std : : string > const & forbidden = { } ) { <nl> + bool keepTopLevelOpen , <nl> + std : : unordered_set < std : : string > const & forbidden ) { <nl> b . add ( VPackValue ( VPackValueType : : Object ) ) ; <nl> <nl> TRI_df_marker_t const * marker = <nl> static void ReadDocument ( arangodb : : AqlTransaction * trx , <nl> if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> result . add ( VPackValue ( VPackValueType : : Null ) ) ; <nl> } else { <nl> + std : : unordered_set < std : : string > unused ; <nl> ExpandShapedJson ( collection - > _collection - > _collection - > getShaper ( ) , <nl> - resolver , cid , & mptr , result ) ; <nl> + resolver , cid , & mptr , result , false , unused ) ; <nl> } <nl> } <nl> <nl> static void RequestEdges ( VPackSlice const & vertexSlice , <nl> for ( size_t i = 0 ; i < resultCount ; + + i ) { <nl> VPackObjectBuilder guard ( & result ) ; <nl> result . add ( VPackValue ( " edge " ) ) ; <nl> - ExpandShapedJson ( shaper , resolver , cid , & ( edges [ i ] ) , result ) ; <nl> + std : : unordered_set < std : : string > unused ; <nl> + ExpandShapedJson ( shaper , resolver , cid , & ( edges [ i ] ) , result , false , unused ) ; <nl> char const * targetKey = nullptr ; <nl> TRI_voc_cid_t targetCid = 0 ; <nl> <nl> static void RequestEdges ( VPackSlice const & vertexSlice , <nl> } <nl> } else { <nl> for ( size_t i = 0 ; i < resultCount ; + + i ) { <nl> - ExpandShapedJson ( shaper , resolver , cid , & ( edges [ i ] ) , result ) ; <nl> + std : : unordered_set < std : : string > unused ; <nl> + ExpandShapedJson ( shaper , resolver , cid , & ( edges [ i ] ) , result , false , unused ) ; <nl> } <nl> } <nl> } <nl> static void VertexIdToVPack ( arangodb : : AqlTransaction * trx , <nl> THROW_ARANGO_EXCEPTION ( res ) ; <nl> } <nl> <nl> + std : : unordered_set < std : : string > unused ; <nl> ExpandShapedJson ( collection - > _collection - > _collection - > getShaper ( ) , resolver , <nl> - id . cid , & mptr , b ) ; <nl> + id . cid , & mptr , b , false , unused ) ; <nl> } <nl> <nl> <nl> static void getDocumentByIdentifier ( arangodb : : AqlTransaction * trx , <nl> return ; <nl> } <nl> <nl> + std : : unordered_set < std : : string > unused ; <nl> ExpandShapedJson ( collection - > _collection - > _collection - > getShaper ( ) , resolver , <nl> - cid , & mptr , result ) ; <nl> + cid , & mptr , result , false , unused ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static void getDocumentByIdentifier ( arangodb : : AqlTransaction * trx , <nl> return ; <nl> } <nl> <nl> + std : : unordered_set < std : : string > unused ; <nl> ExpandShapedJson ( collection - > _collection - > _collection - > getShaper ( ) , resolver , <nl> - cid , & mptr , result ) ; <nl> + cid , & mptr , result , false , unused ) ; <nl> } <nl> <nl> <nl> AqlValue $ Functions : : FulltextVPack ( arangodb : : aql : : Query * query , <nl> VPackArrayBuilder guard ( b . get ( ) ) ; <nl> <nl> for ( size_t i = 0 ; i < numResults ; + + i ) { <nl> + std : : unordered_set < std : : string > unused ; <nl> ExpandShapedJson ( shaper , resolver , cid , <nl> - ( TRI_doc_mptr_t const * ) queryResult - > _documents [ i ] , * b ) ; <nl> + ( TRI_doc_mptr_t const * ) queryResult - > _documents [ i ] , * b , <nl> + false , unused ) ; <nl> } <nl> } catch ( . . . ) { <nl> TRI_FreeResultFulltextIndex ( queryResult ) ; <nl>
Fixed a linux compile bug with default parameters . Now they have no defaults any more .
arangodb/arangodb
835e077836c3e823116932754bb31d51e9f75389
2016-02-15T09:51:12Z
mmm a / tensorflow / python / distribute / tpu_strategy . py <nl> ppp b / tensorflow / python / distribute / tpu_strategy . py <nl> def replicated_fn ( replica_id , replica_args , replica_kwargs ) : <nl> if tensor_util . is_tensor ( input_tensor ) : <nl> rank = input_tensor . get_shape ( ) . rank <nl> else : <nl> - rank = np . rank ( input_tensor ) <nl> + rank = np . ndim ( input_tensor ) <nl> maximum_shape = tensor_shape . TensorShape ( [ None ] * rank ) <nl> maximum_shapes . append ( maximum_shape ) <nl> maximum_shapes = nest . pack_sequence_as ( replicate_inputs [ 0 ] , <nl>
Merge pull request from SwapnilDreams100 : master
tensorflow/tensorflow
19f4ac7694e1e66d6a5dc6098cf1bc548122276d
2020-05-22T19:20:01Z
mmm a / tests / swoole_redis_coro / timeout . phpt <nl> ppp b / tests / swoole_redis_coro / timeout . phpt <nl> go ( function ( ) { <nl> assert ( ! $ res ) ; <nl> assert ( $ redis - > errCode = = = SOCKET_ETIMEDOUT ) ; <nl> $ s = microtime ( true ) - $ s ; <nl> - assert ( $ s > 0 . 45 & & $ s < 0 . 55 ) ; / / would not retry after timeout <nl> + time_approximate ( 0 . 5 , $ s ) ; / / would not retry after timeout <nl> <nl> $ s = microtime ( true ) ; <nl> $ res = $ redis - > brpoplpush ( ' test ' , ' test2 ' , 3 ) ; <nl> assert ( ! $ res ) ; <nl> assert ( $ redis - > errCode = = = SOCKET_ETIMEDOUT ) ; <nl> $ s = microtime ( true ) - $ s ; <nl> - assert ( $ s > 0 . 45 & & $ s < 0 . 55 ) ; / / would not retry after timeout <nl> + time_approximate ( 0 . 5 , $ s ) ; / / would not retry after timeout <nl> <nl> / / right way : no timeout <nl> $ redis - > setOptions ( [ ' timeout ' = > - 1 ] ) ; <nl> go ( function ( ) { <nl> assert ( $ res = = = null ) ; <nl> assert ( $ redis - > errCode = = = 0 ) ; <nl> $ s = microtime ( true ) - $ s ; <nl> - assert ( $ s > 0 . 9 & & $ s < 1 . 1 ) ; <nl> + time_approximate ( 1 , $ s ) ; <nl> <nl> $ s = microtime ( true ) ; <nl> $ res = $ redis - > brpoplpush ( ' test ' , ' test2 ' , 1 ) ; <nl> assert ( $ res = = = null ) ; <nl> assert ( $ redis - > errCode = = = 0 ) ; <nl> $ s = microtime ( true ) - $ s ; <nl> - assert ( $ s > 0 . 9 & & $ s < 1 . 1 ) ; <nl> + time_approximate ( 1 , $ s ) ; <nl> } ) ; <nl> swoole_event_wait ( ) ; <nl> echo " DONE \ n " ; <nl>
Use time_approximate .
swoole/swoole-src
782393c848807da43f0720fb8a54d03f4f8533ad
2019-01-11T04:22:02Z
mmm a / tensorflow / python / data / benchmarks / list_files_benchmark . py <nl> ppp b / tensorflow / python / data / benchmarks / list_files_benchmark . py <nl> <nl> # See the License for the specific language governing permissions and <nl> # limitations under the License . <nl> # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - " " " Benchmarks for ` tf . data . Dataset . batch ( ) ` . " " " <nl> + " " " Benchmarks for ` tf . data . Dataset . list_files ( ) ` . " " " <nl> from __future__ import absolute_import <nl> from __future__ import division <nl> from __future__ import print_function <nl> def benchmarkNestedDirectories ( self ) : <nl> ( len ( median_deltas ) - 2 ) : <nl> np . average ( median_deltas [ 2 : ] ) <nl> } , <nl> - name = ' benchmark_list_files_dataset_nesteddirectory ( % d * % d ) ' % <nl> + name = ' nested_directory ( % d * % d ) ' % <nl> ( width , depth ) ) <nl> shutil . rmtree ( tmp_dir , ignore_errors = True ) <nl> <nl>
Change the function and variable names
tensorflow/tensorflow
5a253d2f476ac5a722fcb67c2c9fa1aaf87ab4db
2018-12-02T20:24:13Z
mmm a / samples / HelloCpp / Resources / iphonehd / HelloWorld . png . REMOVED . git - id <nl> ppp b / samples / HelloCpp / Resources / iphonehd / HelloWorld . png . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - e35126a63c774b4967e6b0e31082d7a32f58ed02 <nl> \ No newline at end of file <nl> + 6b7a2544be32ce26e75737865743649598d83bdf <nl> \ No newline at end of file <nl> mmm a / samples / SimpleGame / Classes / AppDelegate . cpp <nl> ppp b / samples / SimpleGame / Classes / AppDelegate . cpp <nl> bool AppDelegate : : applicationDidFinishLaunching ( ) { <nl> } <nl> else if ( target = = kTargetIphone ) <nl> { <nl> - if ( CCEGLView : : sharedOpenGLView ( ) - > enableRetina ( ) ) <nl> + if ( CCDirector : : sharedDirector ( ) - > enableRetinaDisplay ( true ) ) <nl> { <nl> - / / well , it ' s a iPhone 4 and above , with 960x480 Retina resolution <nl> + / / well , it ' s a iPhone 4 , iPhone 4S or iPhone 5 <nl> CCFileUtils : : sharedFileUtils ( ) - > setResourceDirectory ( " hd " ) ; <nl> - CCEGLView : : sharedOpenGLView ( ) - > setDesignResolutionSize ( 960 , 640 , kResolutionNoBorder ) ; <nl> } <nl> else <nl> { <nl> / / iPhone 3GS and before , with 480x320 resolution <nl> CCFileUtils : : sharedFileUtils ( ) - > setResourceDirectory ( " sd " ) ; <nl> - CCEGLView : : sharedOpenGLView ( ) - > setDesignResolutionSize ( 480 , 320 , kResolutionNoBorder ) ; <nl> } <nl> } <nl> else <nl> mmm a / samples / SimpleGame / Classes / HelloWorldScene . cpp <nl> ppp b / samples / SimpleGame / Classes / HelloWorldScene . cpp <nl> <nl> <nl> using namespace cocos2d ; <nl> <nl> - extern float g_scaleRatio ; <nl> - <nl> HelloWorld : : ~ HelloWorld ( ) <nl> { <nl> if ( _targets ) <nl> HelloWorld : : HelloWorld ( ) <nl> : _targets ( NULL ) <nl> , _projectiles ( NULL ) <nl> , _projectilesDestroyed ( 0 ) <nl> - , _scaleRatio ( 1 . 0 ) <nl> { <nl> - if ( 0 = = strcmp ( CCFileUtils : : sharedFileUtils ( ) - > getResourceDirectory ( ) , " hd / " ) ) <nl> - { <nl> - / / AppDelegate . cpp used hd resource & 960x640 design resolution <nl> - _scaleRatio = 2 . 0 ; <nl> - } <nl> - else <nl> - { <nl> - / / sd <nl> - _scaleRatio = 1 . 0 ; <nl> - } <nl> } <nl> <nl> CCScene * HelloWorld : : scene ( ) <nl> bool HelloWorld : : init ( ) <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / 2 . add your codes below . . . <nl> - CCSprite * player = CCSprite : : create ( " Player . png " , CCRectMake ( 0 , 0 , 27 * _scaleRatio , 40 * _scaleRatio ) ) ; <nl> + CCSprite * player = CCSprite : : create ( " Player . png " , CCRectMake ( 0 , 0 , 27 , 40 ) ) ; <nl> <nl> player - > setPosition ( ccp ( origin . x + player - > getContentSize ( ) . width / 2 , <nl> origin . y + visibleSize . height / 2 ) ) ; <nl> void HelloWorld : : menuCloseCallback ( CCObject * pSender ) <nl> / / cpp with cocos2d - x <nl> void HelloWorld : : addTarget ( ) <nl> { <nl> - CCSprite * target = CCSprite : : create ( " Target . png " , CCRectMake ( 0 , 0 , 27 * _scaleRatio , 40 * _scaleRatio ) ) ; <nl> + CCSprite * target = CCSprite : : create ( " Target . png " , CCRectMake ( 0 , 0 , 27 , 40 ) ) ; <nl> <nl> / / Determine where to spawn the target along the Y axis <nl> CCSize winSize = CCDirector : : sharedDirector ( ) - > getVisibleSize ( ) ; <nl> void HelloWorld : : ccTouchesEnded ( CCSet * touches , CCEvent * event ) <nl> <nl> / / Set up initial location of projectile <nl> CCSize winSize = CCDirector : : sharedDirector ( ) - > getVisibleSize ( ) ; <nl> - CCSprite * projectile = CCSprite : : create ( " Projectile . png " , CCRectMake ( 0 , 0 , 20 * _scaleRatio , 20 * _scaleRatio ) ) ; <nl> + CCSprite * projectile = CCSprite : : create ( " Projectile . png " , CCRectMake ( 0 , 0 , 20 , 20 ) ) ; <nl> projectile - > setPosition ( ccp ( 20 , winSize . height / 2 ) ) ; <nl> <nl> / / Determinie offset of location to projectile <nl> mmm a / samples / SimpleGame / Classes / HelloWorldScene . h <nl> ppp b / samples / SimpleGame / Classes / HelloWorldScene . h <nl> class HelloWorld : public cocos2d : : CCLayerColor <nl> cocos2d : : CCArray * _targets ; <nl> cocos2d : : CCArray * _projectiles ; <nl> int _projectilesDestroyed ; <nl> - float _scaleRatio ; <nl> <nl> void addTarget ( ) ; <nl> <nl>
revert back SimpleGame to enableRetinaDisplay approach . Update background image of HelloCpp to 640x1136 .
cocos2d/cocos2d-x
609c4b12f9520151da4575efde1839fe4ba79eb4
2012-09-24T13:14:08Z
mmm a / src / python / turicreate / toolkits / activity_classifier / _activity_classifier . py <nl> ppp b / src / python / turicreate / toolkits / activity_classifier / _activity_classifier . py <nl> def create ( dataset , session_id , target , features = None , prediction_window = 100 , <nl> mmmmmm - - <nl> ActivityClassifier , util . random_split_by_session <nl> " " " <nl> - _tkutl . _raise_error_if_not_sframe ( dataset , " dataset " ) <nl> from . . _mxnet import _mxnet_utils <nl> from . _mx_model_architecture import _net_params <nl> from . _sframe_sequence_iterator import SFrameSequenceIter as _SFrameSequenceIter <nl> def create ( dataset , session_id , target , features = None , prediction_window = 100 , <nl> ac_weights_mps_to_mxnet as _ac_weights_mps_to_mxnet ) <nl> <nl> <nl> + _tkutl . _raise_error_if_not_sframe ( dataset , " dataset " ) <nl> if not isinstance ( target , str ) : <nl> raise _ToolkitError ( ' target must be of type str ' ) <nl> if not isinstance ( session_id , str ) : <nl> def create ( dataset , session_id , target , features = None , prediction_window = 100 , <nl> # Define model architecture <nl> context = _mxnet_utils . get_mxnet_context ( max_devices = num_sessions ) <nl> <nl> - # Always create MXnet models , as the pred_model is later saved to the state <nl> + # Always create MXNet models , as the pred_model is later saved to the state <nl> # If MPS is used - the loss_model will be overwritten <nl> loss_model , pred_model = _define_model_mxnet ( len ( target_map ) , prediction_window , <nl> predictions_in_chunk , context ) <nl> def predict ( self , dataset , output_type = ' class ' , output_frequency = ' per_row ' ) : <nl> vector with probabilities for each class . <nl> <nl> The activity classifier generates a single prediction for each <nl> - ` ` prediction_window ` ` rows in ` ` dataset ` ` , per ` ` session_id ` ` . Thus the <nl> - number of predictions is smaller than the length of ` ` dataset ` ` . By <nl> - default each prediction is replicated by ` ` prediction_window ` ` to return <nl> - a prediction for each row of ` ` dataset ` ` . Use ` ` output_frequency ` ` to <nl> + ` ` prediction_window ` ` rows in ` ` dataset ` ` , per ` ` session_id ` ` . The number <nl> + of these predictions is smaller than the length of ` ` dataset ` ` . By default , <nl> + when ` ` output_frequency = ' per_row ' ` ` , each prediction is repeated ` ` prediction_window ` ` to return <nl> + a prediction for each row of ` ` dataset ` ` . Use ` ` output_frequency = per_window ` ` to <nl> get the unreplicated predictions . <nl> <nl> Parameters <nl> mmm a / src / python / turicreate / toolkits / activity_classifier / util . py <nl> ppp b / src / python / turicreate / toolkits / activity_classifier / util . py <nl> <nl> def random_split_by_session ( dataset , session_id , fraction = 0 . 9 , seed = None ) : <nl> " " " <nl> Randomly split an SFrame into two SFrames based on the ` session_id ` such <nl> - that one split contains data for a ` fraction ` of the sessions while the <nl> - second split contains all data for the rest of the sessions . <nl> + that one split contains all data for a ` fraction ` of the sessions while <nl> + the second split contains all data for the rest of the sessions . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> mmm a / userguide / activity_classifier / README . md <nl> ppp b / userguide / activity_classifier / README . md <nl> import turicreate as tc <nl> data = tc . SFrame ( ' hapt_data . sframe ' ) <nl> <nl> # Train / test split by recording sessions <nl> - train , test = tc . activity_classifier . util . random_split_by_session ( data , session_id = ' exp_id ' , fraction = 0 . 8 ) <nl> + train , test = tc . activity_classifier . util . random_split_by_session ( data , <nl> + session_id = ' exp_id ' , <nl> + fraction = 0 . 8 ) <nl> <nl> # Create an activity classifier <nl> - model = tc . activity_classifier . create ( train , session_id = ' exp_id ' , target = ' activity ' , prediction_window = 50 ) <nl> + model = tc . activity_classifier . create ( train , session_id = ' exp_id ' , target = ' activity ' , <nl> + prediction_window = 50 ) <nl> <nl> # Evaluate the model and save the results into a dictionary <nl> metrics = model . evaluate ( test ) <nl> mmm a / userguide / activity_classifier / data - preparation . md <nl> ppp b / userguide / activity_classifier / data - preparation . md <nl> def find_label_for_containing_interval ( intervals , index ) : <nl> return containing_interval [ 0 ] <nl> <nl> # Load labels <nl> - labels = tc . SFrame . read_csv ( data_dir + ' labels . txt ' , delimiter = ' ' , header = False , verbose = False ) <nl> - labels = labels . rename ( { ' X1 ' : ' exp_id ' , ' X2 ' : ' user_id ' , ' X3 ' : ' activity_id ' , ' X4 ' : ' start ' , ' X5 ' : ' end ' } ) <nl> + labels = tc . SFrame . read_csv ( data_dir + ' labels . txt ' , delimiter = ' ' , header = False , <nl> + verbose = False ) <nl> + labels = labels . rename ( { ' X1 ' : ' exp_id ' , ' X2 ' : ' user_id ' , ' X3 ' : ' activity_id ' , <nl> + ' X4 ' : ' start ' , ' X5 ' : ' end ' } ) <nl> labels <nl> ` ` ` <nl> <nl> target_map = { <nl> } <nl> <nl> # Use the same labels used in the experiment <nl> - data = data . filter_by ( target_map . keys ( ) , ' activity_id ' ) <nl> + data = data . filter_by ( list ( target_map . keys ( ) ) , ' activity_id ' ) <nl> data [ ' activity ' ] = data [ ' activity_id ' ] . apply ( lambda x : target_map [ x ] ) <nl> data = data . remove_column ( ' activity_id ' ) <nl> <nl> mmm a / userguide / drawing_classifier / data - preparation . md <nl> ppp b / userguide / drawing_classifier / data - preparation . md <nl> cd . . / strokes <nl> # Stroke data ( around 200 MB each ) <nl> curl https : / / storage . googleapis . com / quickdraw_dataset / full / raw / square . ndjson > square . ndjson <nl> curl https : / / storage . googleapis . com / quickdraw_dataset / full / raw / triangle . ndjson > triangle . ndjson <nl> + <nl> + cd . . / . . <nl> ` ` ` <nl> <nl> After running the above script , you should have a directory structure like this : <nl>
Minor updates ( )
apple/turicreate
ce07aedd0e6353eb67469c230209fc2c9d758a00
2019-08-12T16:21:31Z
mmm a / fdbserver / ClusterController . actor . cpp <nl> ppp b / fdbserver / ClusterController . actor . cpp <nl> ACTOR Future < Void > clusterWatchDatabase ( ClusterControllerData * cluster , Cluster <nl> dbInfo . clusterInterface = db - > serverInfo - > get ( ) . read ( ) . clusterInterface ; <nl> dbInfo . distributor = db - > serverInfo - > get ( ) . read ( ) . distributor ; <nl> dbInfo . ratekeeper = db - > serverInfo - > get ( ) . read ( ) . ratekeeper ; <nl> + dbInfo . latencyBandConfig = db - > serverInfo - > get ( ) . read ( ) . latencyBandConfig ; <nl> <nl> TraceEvent ( " CCWDB " , cluster - > id ) . detail ( " Lifetime " , dbInfo . masterLifetime . toString ( ) ) . detail ( " ChangeID " , dbInfo . id ) ; <nl> db - > serverInfo - > set ( cachedInfo ) ; <nl> mmm a / fdbserver / MasterProxyServer . actor . cpp <nl> ppp b / fdbserver / MasterProxyServer . actor . cpp <nl> struct ProxyCommitData { <nl> return tags ; <nl> } <nl> <nl> + void updateLatencyBandConfig ( Optional < LatencyBandConfig > newLatencyBandConfig ) { <nl> + if ( newLatencyBandConfig . present ( ) ! = latencyBandConfig . present ( ) <nl> + | | ( newLatencyBandConfig . present ( ) & & newLatencyBandConfig . get ( ) . grvConfig ! = latencyBandConfig . get ( ) . grvConfig ) ) <nl> + { <nl> + TraceEvent ( " LatencyBandGrvUpdatingConfig " ) . detail ( " Present " , newLatencyBandConfig . present ( ) ) ; <nl> + stats . grvLatencyBands . clearBands ( ) ; <nl> + if ( newLatencyBandConfig . present ( ) ) { <nl> + for ( auto band : newLatencyBandConfig . get ( ) . grvConfig . bands ) { <nl> + stats . grvLatencyBands . addThreshold ( band ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( newLatencyBandConfig . present ( ) ! = latencyBandConfig . present ( ) <nl> + | | ( newLatencyBandConfig . present ( ) & & newLatencyBandConfig . get ( ) . commitConfig ! = latencyBandConfig . get ( ) . commitConfig ) ) <nl> + { <nl> + TraceEvent ( " LatencyBandCommitUpdatingConfig " ) . detail ( " Present " , newLatencyBandConfig . present ( ) ) ; <nl> + stats . commitLatencyBands . clearBands ( ) ; <nl> + if ( newLatencyBandConfig . present ( ) ) { <nl> + for ( auto band : newLatencyBandConfig . get ( ) . commitConfig . bands ) { <nl> + stats . commitLatencyBands . addThreshold ( band ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + latencyBandConfig = newLatencyBandConfig ; <nl> + } <nl> + <nl> ProxyCommitData ( UID dbgid , MasterInterface master , RequestStream < GetReadVersionRequest > getConsistentReadVersion , Version recoveryTransactionVersion , RequestStream < CommitTransactionRequest > commit , Reference < AsyncVar < ServerDBInfo > > db , bool firstProxy ) <nl> : dbgid ( dbgid ) , stats ( dbgid , & version , & committedVersion , & commitBatchesMemBytesCount ) , master ( master ) , <nl> logAdapter ( NULL ) , txnStateStore ( NULL ) , popRemoteTxs ( false ) , <nl> ACTOR Future < Void > masterProxyServerCore ( <nl> commitData . txnStateStore = keyValueStoreLogSystem ( commitData . logAdapter , proxy . id ( ) , 2e9 , true , true , true ) ; <nl> createWhitelistBinPathVec ( whitelistBinPaths , commitData . whitelistedBinPathVec ) ; <nl> <nl> + commitData . updateLatencyBandConfig ( commitData . db - > get ( ) . latencyBandConfig ) ; <nl> + <nl> / / ( ( SERVER_MEM_LIMIT * COMMIT_BATCHES_MEM_FRACTION_OF_TOTAL ) / COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR ) is only a approximate formula for limiting the memory used . <nl> / / COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR is an estimate based on experiments and not an accurate one . <nl> state int64_t commitBatchesMemoryLimit = std : : min ( SERVER_KNOBS - > COMMIT_BATCHES_MEM_BYTES_HARD_LIMIT , static_cast < int64_t > ( ( SERVER_KNOBS - > SERVER_MEM_LIMIT * SERVER_KNOBS - > COMMIT_BATCHES_MEM_FRACTION_OF_TOTAL ) / SERVER_KNOBS - > COMMIT_BATCHES_MEM_TO_TOTAL_MEM_SCALE_FACTOR ) ) ; <nl> ACTOR Future < Void > masterProxyServerCore ( <nl> commitData . logSystem - > popTxs ( commitData . lastTxsPop , tagLocalityRemoteLog ) ; <nl> } <nl> <nl> - Optional < LatencyBandConfig > newLatencyBandConfig = commitData . db - > get ( ) . latencyBandConfig ; <nl> - <nl> - if ( newLatencyBandConfig . present ( ) ! = commitData . latencyBandConfig . present ( ) <nl> - | | ( newLatencyBandConfig . present ( ) & & newLatencyBandConfig . get ( ) . grvConfig ! = commitData . latencyBandConfig . get ( ) . grvConfig ) ) <nl> - { <nl> - TraceEvent ( " LatencyBandGrvUpdatingConfig " ) . detail ( " Present " , newLatencyBandConfig . present ( ) ) ; <nl> - commitData . stats . grvLatencyBands . clearBands ( ) ; <nl> - if ( newLatencyBandConfig . present ( ) ) { <nl> - for ( auto band : newLatencyBandConfig . get ( ) . grvConfig . bands ) { <nl> - commitData . stats . grvLatencyBands . addThreshold ( band ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( newLatencyBandConfig . present ( ) ! = commitData . latencyBandConfig . present ( ) <nl> - | | ( newLatencyBandConfig . present ( ) & & newLatencyBandConfig . get ( ) . commitConfig ! = commitData . latencyBandConfig . get ( ) . commitConfig ) ) <nl> - { <nl> - TraceEvent ( " LatencyBandCommitUpdatingConfig " ) . detail ( " Present " , newLatencyBandConfig . present ( ) ) ; <nl> - commitData . stats . commitLatencyBands . clearBands ( ) ; <nl> - if ( newLatencyBandConfig . present ( ) ) { <nl> - for ( auto band : newLatencyBandConfig . get ( ) . commitConfig . bands ) { <nl> - commitData . stats . commitLatencyBands . addThreshold ( band ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - commitData . latencyBandConfig = newLatencyBandConfig ; <nl> + commitData . updateLatencyBandConfig ( commitData . db - > get ( ) . latencyBandConfig ) ; <nl> } <nl> when ( wait ( onError ) ) { } <nl> when ( std : : pair < vector < CommitTransactionRequest > , int > batchedRequests = waitNext ( batchedCommits . getFuture ( ) ) ) { <nl>
Fix cases where latency band config could be discarded during recovery or process start .
apple/foundationdb
7c801513e2f6a07bec8d3037a01a4a8eeadb4957
2019-11-20T19:44:18Z
mmm a / scene / gui / text_edit . cpp <nl> ppp b / scene / gui / text_edit . cpp <nl> void TextEdit : : _notification ( int p_what ) { <nl> <nl> int ascent = cache . font - > get_ascent ( ) ; <nl> <nl> - int visible_rows = get_visible_rows ( ) ; <nl> + int visible_rows = get_visible_rows ( ) + 1 ; <nl> <nl> int tab_w = cache . font - > get_char_size ( ' ' ) . width * indent_size ; <nl> <nl> int TextEdit : : get_visible_rows ( ) const { <nl> int total = cache . size . height ; <nl> total - = cache . style_normal - > get_minimum_size ( ) . height ; <nl> total / = get_row_height ( ) ; <nl> - return total + 1 ; <nl> + return total ; <nl> } <nl> void TextEdit : : adjust_viewport_to_cursor ( ) { <nl> <nl> void TextEdit : : adjust_viewport_to_cursor ( ) { <nl> visible_rows - = ( ( h_scroll - > get_combined_minimum_size ( ) . height - 1 ) / get_row_height ( ) ) ; <nl> <nl> if ( cursor . line > = ( cursor . line_ofs + visible_rows ) ) <nl> - cursor . line_ofs = cursor . line - visible_rows + 1 ; <nl> + cursor . line_ofs = cursor . line - visible_rows ; <nl> if ( cursor . line < cursor . line_ofs ) <nl> cursor . line_ofs = cursor . line ; <nl> <nl>
Merge pull request from Paulb23 / fix_not_scrolling_eof
godotengine/godot
9720e94dce358391ec532cbc1ba379b2fcf571a4
2017-08-20T13:25:46Z
mmm a / mypy . ini <nl> ppp b / mypy . ini <nl> ignore_errors = True <nl> [ mypy - torch . nn . intrinsic . qat . modules . conv_fused ] <nl> ignore_errors = True <nl> <nl> + [ mypy - torch . onnx . operators ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_opset8 ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_opset9 ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_opset11 ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_caffe2 ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_helper ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . symbolic_registry ] <nl> + ignore_errors = True <nl> + <nl> + [ mypy - torch . onnx . utils ] <nl> + ignore_errors = True <nl> + <nl> [ mypy - torch . multiprocessing . pool ] <nl> ignore_errors = True <nl> <nl> mmm a / torch / _C / __init__ . pyi . in <nl> ppp b / torch / _C / __init__ . pyi . in <nl> def wait ( fut : Future ) - > Any : . . . <nl> def _collect_all ( futures : List [ Future ] ) - > Future : . . . <nl> <nl> def unify_type_list ( types : List [ JitType ] ) - > JitType : . . . <nl> - def _freeze_module ( module : ScriptModule , preserved_attrs : List [ str ] = [ ] , freeze_interfaces : _bool = True ) - > ScriptModule : . . . <nl> + def _freeze_module ( module : ScriptModule , preserved_attrs : List [ str ] , freeze_interfaces : _bool = True ) - > ScriptModule : . . . <nl> def _is_tracing ( ) - > _bool : . . . <nl> def _jit_init ( ) - > _bool : . . . <nl> def _jit_flatten ( arg : Any ) - > Tuple [ List [ Tensor ] , IODescriptor ] : . . . <nl> def _jit_get_trigger_value ( trigger_name : str ) - > _int : . . . <nl> # Defined in torch / csrc / jit / python / script_init . cpp <nl> ResolutionCallback = Callable [ [ str ] , Callable [ . . . , Any ] ] <nl> <nl> - # Defined in torch / csrc / jit / python / script_init . cpp <nl> - # and torch / csrc / jit / python / init . cpp <nl> def _create_function_from_graph ( qualname : str , graph : Graph ) - > Graph : . . . <nl> def _debug_set_autodiff_subgraph_inlining ( disabled : _bool ) - > None : . . . <nl> def _ivalue_tags_match ( lhs : ScriptModule , rhs : ScriptModule ) - > _bool : . . . <nl> def _resolve_type_from_object ( obj : Any , range : SourceRange , rcb : ResolutionCallb <nl> def _create_module_with_type ( ty : JitType ) - > ScriptModule : . . . <nl> def _run_emit_module_hook ( m : ScriptModule ) : . . . <nl> def _replace_overloaded_method_decl ( overload_decl : Decl , implementation_def : Def , new_name : str ) - > Def : . . . <nl> - <nl> - def _jit_pass_lower_all_tuples ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_set_dynamic_input_shape ( graph : Graph , dynamic_axes : Dict [ str , Dict [ _int , str ] ] , input_names : List [ str ] ) - > None : . . . <nl> - def _jit_pass_onnx_graph_shape_type_inference ( graph : Graph , opset_version : _int ) - > None : . . . <nl> - def _jit_pass_onnx_assign_output_shape ( graph : Graph , tensors : List [ Tensor ] , onnx_shape_inference : _bool = False ) - > None : . . . <nl> - def _jit_pass_fixup_onnx_loop_node_inputs ( n : Node ) - > None : . . . <nl> - def _jit_pass_onnx_remove_inplace_ops_for_onnx ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_remove_inplace_ops ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_canonicalize_graph_fuser_ops ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_peephole ( graph : Graph , addmm_fusion_enabled : _bool ) - > None : . . . <nl> - def _jit_pass_fuse_addmm ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_preprocess ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_prepare_inplace_ops_for_onnx ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_prepare_division_for_onnx ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_remove_print ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_preprocess_caffe2 ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_unpack_quantized_weights ( <nl> - graph : Graph , <nl> - paramsDict : Dict [ str , IValue ] <nl> - ) - > Dict [ str , IValue ] : . . . <nl> - def _jit_pass_onnx_quantization_insert_permutes ( <nl> - graph : Graph , <nl> - paramsDict : Dict [ str , IValue ] <nl> - ) - > Dict [ str , IValue ] : . . . <nl> - def _jit_pass_custom_pattern_based_rewrite_graph ( pattern : str , fused_node_name : str , graph : Graph ) - > None : . . . <nl> - def _jit_pass_erase_number_types ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx ( graph : Graph , _jit_pass_onnx : _onnx . OperatorExportTypes ) - > Graph : . . . <nl> - def _jit_pass_onnx_scalar_type_analysis ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_peephole ( graph : Graph , opset_version : _int , fixed_batch_size : _bool ) - > None : . . . <nl> - def _jit_pass_dce_allow_deleting_nodes_with_side_effects ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_function_substitution ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_lower_graph ( graph : Graph , m : Module ) - > Tuple [ Graph , List [ IValue ] ] : . . . <nl> - def _jit_pass_inline_fork_wait ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_eval_peephole ( graph : Graph , paramsDict : Dict [ str , IValue ] ) - > Dict [ str , IValue ] : . . . <nl> - def _jit_pass_onnx_constant_fold ( graph : Graph , paramsDict : Dict [ str , IValue ] , opset_version : _int ) - > Dict [ str , IValue ] : . . . <nl> - def _jit_pass_onnx_eliminate_unused_items ( graph : Graph , paramsDict : Dict [ str , IValue ] ) - > Dict [ str , IValue ] : . . . <nl> - def _jit_pass_onnx_cast_all_constant_to_floating ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_filter_non_tensor_arguments ( params : Dict [ str , IValue ] ) - > Dict [ str , Tensor ] : . . . <nl> - def _jit_decay_packed_param_input_types ( graph : Graph ) - > None : . . . <nl> - def _jit_pass_onnx_node_shape_type_inference ( n : Node , opset_version : _int ) - > None : . . . <nl> - def _jit_pass_onnx_block ( <nl> - old_block : Block , <nl> - new_block : Block , <nl> - operator_export_type : _onnx . OperatorExportTypes , <nl> - env : Dict [ Value , Value ] <nl> - ) - > None : . . . <nl> - def _jit_pass_fixup_onnx_controlflow_node ( n : Node , opset_version : _int ) - > Node : . . . <nl> - <nl> def _jit_script_interface_compile ( name : str , class_def : ClassDef , rcb : ResolutionCallback , is_module : _bool ) : . . . <nl> def _jit_script_compile_overload ( <nl> qualname : str , <nl> def import_ir_module_from_buffer ( <nl> extra_files : Dict [ str , Any ] <nl> ) - > ScriptModule : . . . <nl> <nl> - def _assign_output_shapes ( graph : Graph , inputs : List [ Tensor ] ) - > Graph : . . . <nl> - def _check_onnx_proto ( proto : str ) - > None : . . . <nl> - def _propagate_and_assign_input_shapes ( <nl> - graph : Graph , <nl> - inputs : Tuple [ Tensor , . . . ] , <nl> - with_grad : _bool , <nl> - propagate : _bool <nl> - ) - > Graph : . . . <nl> - <nl> # Defined in torch / torch / csrc / jit / ir / ir . h <nl> class Graph : <nl> - def eraseInput ( self , i : _int ) - > None : . . . <nl> . . . <nl> <nl> # Defined in torch / csrc / jit / ir / ir . h <nl> class ScriptFunction : <nl> def qualified_name ( self ) - > str : . . . <nl> <nl> class ScriptMethod : <nl> - graph : Graph <nl> . . . <nl> + <nl> class ModuleDict : <nl> def __init__ ( self , mod : ScriptModule ) - > None : . . . <nl> def items ( self ) - > List [ Tuple [ str , Any ] ] : . . . <nl> class ParameterDict : <nl> class BufferDict : <nl> def __init__ ( self , mod : ScriptModule ) - > None : . . . <nl> <nl> - # Defined in torch / csrc / jit / api / module . h <nl> - class Module : <nl> - . . . <nl> - <nl> # Defined in torch / csrc / Module . cpp <nl> def _initExtension ( shm_manager_path : str ) - > None : . . . # THPModule_initExtension <nl> def _autograd_init ( ) - > _bool : . . . # THPAutograd_initExtension <nl> mmm a / torch / _C / _onnx . pyi <nl> ppp b / torch / _C / _onnx . pyi <nl> class OperatorExportTypes ( Enum ) : <nl> ONNX_ATEN = . . . <nl> ONNX_ATEN_FALLBACK = . . . <nl> RAW = . . . <nl> - ONNX_FALLTHROUGH = . . . <nl> <nl> class TrainingMode ( Enum ) : <nl> EVAL = . . . <nl> mmm a / torch / onnx / symbolic_helper . py <nl> ppp b / torch / onnx / symbolic_helper . py <nl> <nl> import torch <nl> import warnings <nl> from sys import maxsize as maxsize <nl> - from typing import Set <nl> <nl> import torch . onnx <nl> # This import monkey - patches graph manipulation methods on Graph , used for the <nl> def decorator ( fn ) : <nl> def wrapper ( g , * args , * * kwargs ) : <nl> # some args may be optional , so the length may be smaller <nl> assert len ( arg_descriptors ) > = len ( args ) <nl> - args = [ _parse_arg ( arg , arg_desc ) for arg , arg_desc in zip ( args , arg_descriptors ) ] # type : ignore <nl> + args = [ _parse_arg ( arg , arg_desc ) for arg , arg_desc in zip ( args , arg_descriptors ) ] <nl> # only support _outputs in kwargs <nl> assert len ( kwargs ) < = 1 <nl> if len ( kwargs ) = = 1 : <nl> def _select_helper ( g , self , dim , index , apply_reshape = True ) : <nl> <nl> def _slice_helper ( g , input , axes , starts , ends , steps = None , dynamic_slice = False ) : <nl> if _export_onnx_opset_version < = 9 : <nl> - from torch . onnx . symbolic_opset9 import _slice as _slice9 <nl> - return _slice9 ( g , input , axes , starts , ends ) <nl> + from torch . onnx . symbolic_opset9 import _slice <nl> + return _slice ( g , input , axes , starts , ends ) <nl> else : <nl> - from torch . onnx . symbolic_opset10 import _slice as _slice10 <nl> - return _slice10 ( g , input , axes , starts , ends , steps , dynamic_slice ) <nl> + from torch . onnx . symbolic_opset10 import _slice <nl> + return _slice ( g , input , axes , starts , ends , steps , dynamic_slice ) <nl> <nl> def _hardtanh_helper ( g , input , min_val , max_val ) : <nl> if _export_onnx_opset_version < = 10 : <nl> def _interpolate_get_scales_and_mode ( g , input , size , scale_factor , mode , align_ <nl> size = g . op ( " Concat " , * size , axis_i = 0 ) <nl> scale_factor = _interpolate_size_to_scales ( g , input , size , dim ) <nl> else : <nl> - return _unimplemented ( " interpolate " , " Both size and scales are None in __interpolate " ) <nl> + return _unimplemented ( " Both size and scales are None in __interpolate " ) <nl> return scale_factor , mode <nl> <nl> <nl> def _unbind_helper ( g , self , dim , _outputs ) : <nl> if _export_onnx_opset_version < = 9 : <nl> from torch . onnx . symbolic_opset9 import unbind <nl> else : <nl> - from torch . onnx . symbolic_opset11 import unbind # type : ignore [ no - redef ] <nl> + from torch . onnx . symbolic_opset11 import unbind <nl> return unbind ( g , self , dim , _outputs ) <nl> <nl> <nl> def _scatter_helper ( g , self , dim , index , src ) : <nl> if _export_onnx_opset_version < = 10 : <nl> from torch . onnx . symbolic_opset9 import scatter <nl> else : <nl> - # for mypy , scatter was imported two lines above <nl> - from torch . onnx . symbolic_opset11 import scatter # type : ignore <nl> + from torch . onnx . symbolic_opset11 import scatter <nl> return scatter ( g , self , dim , index , src ) <nl> <nl> <nl> def _index_fill_reshape_helper ( g , self , dim , index ) : <nl> if _export_onnx_opset_version < = 10 : <nl> from torch . onnx . symbolic_opset9 import scatter <nl> else : <nl> - # for mypy , scatter was imported two lines above <nl> - from torch . onnx . symbolic_opset11 import scatter # type : ignore <nl> + from torch . onnx . symbolic_opset11 import scatter <nl> <nl> if self . type ( ) . dim ( ) is None : <nl> return _unimplemented ( " index_fill " , " input rank not accesible " ) <nl> def _cast_func_template ( to_i , g , input , non_blocking ) : <nl> <nl> # Global set to store the list of quantized operators in the network . <nl> # This is currently only used in the conversion of quantized ops from PT - > C2 via ONNX . <nl> - _quantized_ops : Set [ int ] = set ( ) <nl> + _quantized_ops = set ( ) <nl> mmm a / torch / onnx / symbolic_opset8 . py <nl> ppp b / torch / onnx / symbolic_opset8 . py <nl> <nl> import torch . onnx . symbolic_opset9 as sym_opset9 <nl> <nl> from torch . onnx . symbolic_helper import parse_args , _unimplemented , _block_list_in_opset , _try_get_scalar_type <nl> - from torch . onnx . symbolic_opset9 import _cast_Float # type : ignore <nl> + from torch . onnx . symbolic_opset9 import _cast_Float <nl> <nl> import warnings <nl> <nl> mmm a / torch / onnx / symbolic_opset9 . py <nl> ppp b / torch / onnx / symbolic_opset9 . py <nl> <nl> import torch . onnx . symbolic_helper as sym_help <nl> from torch . onnx . symbolic_helper import parse_args , _parse_arg , _unimplemented <nl> <nl> - from typing import Optional <nl> - <nl> import numpy <nl> import math <nl> import warnings <nl> def _maybe_cast_reduce_op_input ( g , self ) : <nl> if dtype is not None : <nl> # pytorch reduce - ops cast all other integral types to int64 <nl> if not sym_help . _is_fp ( self ) and not ( dtype = = ' Long ' ) : <nl> - self = _cast_Long ( g , self , False ) # type : ignore <nl> + self = _cast_Long ( g , self , False ) <nl> return self <nl> <nl> <nl> def _pack_padded_sequence ( g , input , lengths , batch_first ) : <nl> # It ' s really only necessary because those operators expand to something that <nl> # only works with int32 types in Caffe2 . . . <nl> if lengths . type ( ) . scalarType ( ) ! = ' Int ' : <nl> - lengths = _cast_Int ( g , lengths , False ) # type : ignore <nl> + lengths = _cast_Int ( g , lengths , False ) <nl> return g . op ( " prim : : PackPadded " , input , lengths , outputs = 2 ) <nl> <nl> <nl> def _get_arange_dtype ( dtype ) : <nl> <nl> <nl> def masked_fill ( g , self , mask , value ) : <nl> - mask = _cast_Bool ( g , mask , False ) # type : ignore <nl> + mask = _cast_Bool ( g , mask , False ) <nl> value = sym_help . _maybe_get_scalar ( value ) <nl> return g . op ( ' Where ' , mask , sym_help . _if_scalar_type_as ( g , value , self ) , self ) <nl> <nl> def as_strided ( g , self , sizes , strides , offset = None ) : <nl> sizes = sym_help . _maybe_get_const ( sizes , ' is ' ) <nl> rank = len ( strides ) <nl> self_1d = g . op ( " Reshape " , self , g . op ( " Constant " , value_t = torch . tensor ( [ - 1 ] , dtype = torch . int64 ) ) ) <nl> - ind : Optional [ torch . Tensor ] <nl> if not sym_help . _is_value ( sizes ) : <nl> ind = torch . tensor ( [ 0 ] , dtype = torch . long ) <nl> for i , ( size , stride ) in enumerate ( zip ( sizes , strides ) ) : <nl> mmm a / torch / onnx / symbolic_registry . py <nl> ppp b / torch / onnx / symbolic_registry . py <nl> <nl> import warnings <nl> import importlib <nl> from inspect import getmembers , isfunction <nl> - from typing import Dict , Tuple , Any , Union <nl> <nl> # The symbolic registry " _registry " is a dictionary that maps operators <nl> # ( for a specific domain and opset version ) to their symbolic functions . <nl> <nl> # The keys are tuples ( domain , version ) , ( where domain is a string , and version is an int ) , <nl> # and the operator ' s name ( string ) . <nl> # The map ' s entries are as follows : _registry [ ( domain , version ) ] [ op_name ] = op_symbolic <nl> - _registry : Dict [ Tuple [ str , int ] , Dict ] = { } <nl> + _registry = { } <nl> <nl> - _symbolic_versions : Dict [ Union [ int , str ] , Any ] = { } <nl> + _symbolic_versions = { } <nl> from torch . onnx . symbolic_helper import _onnx_stable_opsets <nl> for opset_version in _onnx_stable_opsets : <nl> module = importlib . import_module ( ' torch . onnx . symbolic_opset { } ' . format ( opset_version ) ) <nl> mmm a / torch / onnx / utils . py <nl> ppp b / torch / onnx / utils . py <nl> <nl> from torch . jit import _unique_state_dict <nl> from torch . onnx import ONNX_ARCHIVE_MODEL_PROTO_NAME , ExportTypes , OperatorExportTypes , TrainingMode <nl> from torch . _C import ListType , OptionalType , _propagate_and_assign_input_shapes , _check_onnx_proto <nl> - from typing import Union , Tuple , List <nl> <nl> <nl> # the flag to tell the user whether it ' s in the middle of ONNX export or not <nl> def export ( model , args , f , export_params = True , verbose = False , training = None , <nl> if aten or export_raw_ir : <nl> assert operator_export_type is None <nl> assert aten ^ export_raw_ir <nl> - operator_export_type = OperatorExportTypes . ONNX_ATEN if aten else OperatorExportTypes . RAW <nl> + operator_export_type = OperatorExportTypes . ATEN if aten else OperatorExportTypes . RAW <nl> elif operator_export_type is None : <nl> if torch . onnx . PYTORCH_ONNX_CAFFE2_BUNDLE : <nl> operator_export_type = OperatorExportTypes . ONNX_ATEN_FALLBACK <nl> def _trace_and_get_graph_from_model ( model , args ) : <nl> <nl> def _create_jit_graph ( model , args , _retain_param_name , use_new_jit_passes ) : <nl> torch_out = None <nl> - params : Union [ List , Tuple ] <nl> if isinstance ( model , torch . jit . ScriptModule ) : <nl> try : <nl> graph = model . forward . graph <nl> def _model_to_graph ( model , args , verbose = False , <nl> param_names = input_and_param_names [ len ( input_and_param_names ) - len ( params ) : ] <nl> params_dict = dict ( zip ( param_names , params ) ) <nl> <nl> - if training is None or training = = TrainingMode . EVAL : <nl> + if training is None or training = = TrainingMode . EVAL or ( training = = TrainingMode . PRESERVE and not is_originally_training ) : <nl> params_dict = torch . _C . _jit_pass_onnx_eval_peephole ( graph , params_dict ) <nl> <nl> if do_constant_folding and _export_onnx_opset_version in torch . onnx . constant_folding_opset_versions : <nl> def export_to_pretty_string ( model , args , f , export_params = True , verbose = False , t <nl> if aten or export_raw_ir : <nl> assert operator_export_type is None <nl> assert aten ^ export_raw_ir <nl> - operator_export_type = OperatorExportTypes . ONNX_ATEN if aten else OperatorExportTypes . RAW <nl> + operator_export_type = OperatorExportTypes . ATEN if aten else OperatorExportTypes . RAW <nl> elif operator_export_type is None : <nl> operator_export_type = OperatorExportTypes . ONNX <nl> return _export_to_pretty_string ( model , args , f , export_params , verbose , training , <nl> def _graph_constant ( g , value , dims , type , * args , * * kwargs ) : <nl> dims = [ 1 ] <nl> isscalar = True <nl> type = type . lower ( ) <nl> - tensor : Union [ torch . CharTensor , torch . ShortTensor , <nl> - torch . IntTensor , torch . LongTensor , <nl> - torch . HalfTensor , torch . FloatTensor , <nl> - torch . DoubleTensor ] <nl> if type = = " char " : <nl> tensor = torch . CharTensor ( * dims ) <nl> elif type = = " short " : <nl> def _graph_constant ( g , value , dims , type , * args , * * kwargs ) : <nl> else : <nl> raise ValueError ( " Unknown type , type should be one of the following strings : " <nl> " char , short , int , long , half , float , double " ) <nl> - tensor . fill_ ( value ) # type : ignore <nl> + tensor . fill_ ( value ) <nl> if isscalar : <nl> return g . op ( " Constant " , * args , value_z = tensor , * * kwargs ) <nl> return g . op ( " Constant " , * args , value_t = tensor , * * kwargs ) <nl> def _validate_dynamic_axes ( dynamic_axes , model , input_names , output_names ) : <nl> dynamic_axes [ key ] = value_dict <nl> <nl> <nl> - torch . _C . Graph . op = _graph_op # type : ignore <nl> - torch . _C . Graph . at = _graph_at # type : ignore <nl> - torch . _C . Block . op = _block_op # type : ignore <nl> - torch . _C . Graph . constant = _graph_constant # type : ignore <nl> - torch . _C . Node . __getitem__ = _node_getitem # type : ignore <nl> + torch . _C . Graph . op = _graph_op <nl> + torch . _C . Graph . at = _graph_at <nl> + torch . _C . Block . op = _block_op <nl> + torch . _C . Graph . constant = _graph_constant <nl> + torch . _C . Node . __getitem__ = _node_getitem <nl>
Revert D25304229 : [ pytorch ] [ PR ] Add type annotations to torch . onnx . * modules
pytorch/pytorch
88ebf6f894a61039d2ac0077438b0ad3637c7a71
2020-12-07T19:58:03Z
mmm a / addons / resource . language . en_gb / resources / strings . po <nl> ppp b / addons / resource . language . en_gb / resources / strings . po <nl> msgstr " " <nl> <nl> # : system / settings / settings . xml <nl> msgctxt " # 36560 " <nl> - msgid " Color management " <nl> + msgid " Colour management " <nl> msgstr " " <nl> <nl> - # . Description of setting " System - > Video output - > Color management " with label # 36560 <nl> + # . Description of setting " System - > Video output - > Colour management " with label # 36560 <nl> # : system / settings / settings . xml <nl> msgctxt " # 36561 " <nl> - msgid " Reproduce video colors accurately using a display profile or a 3D lookup table . " <nl> + msgid " Reproduce video colours accurately using a display profile or a 3D lookup table . " <nl> msgstr " " <nl> <nl> # : system / settings / settings . xml <nl> msgctxt " # 36562 " <nl> - msgid " Color management mode " <nl> + msgid " Colour management mode " <nl> msgstr " " <nl> <nl> - # . Description of setting " System - > Video output - > Color management mode " with label # 36562 <nl> + # . Description of setting " System - > Video output - > Colour management mode " with label # 36562 <nl> # : system / settings / settings . xml <nl> msgctxt " # 36563 " <nl> - msgid " Use a precalculated 3D lookup table for video color correction , or calculate the transformation for each video from a profile of your display . A precalculated 3D lookup table is preferred as it allows you to take advantage of the advanced features and high precision in ArgyllCMS . Display profile based correction is useful for testing different parameters , or emulating display settings that you don ' t have a 3D LUT prepared for . " <nl> + msgid " Use a precalculated 3D lookup table for video colour correction , or calculate the transformation for each video from a profile of your display . A precalculated 3D lookup table is preferred as it allows you to take advantage of the advanced features and high precision in ArgyllCMS . Display profile based correction is useful for testing different parameters , or emulating display settings that you don ' t have a 3D LUT prepared for . " <nl> msgstr " " <nl> <nl> # : system / settings / settings . xml <nl>
settings : color - > colour for proper English
xbmc/xbmc
7b46053a779a05a93ae87c7d9dcac9749c6657e0
2016-06-23T02:29:18Z
deleted file mode 100644 <nl> index e69de29b . . 00000000 <nl>
Dro empty debian / docs
uglide/RedisDesktopManager
4edfcc5b689f4fa6bfaac73449ef41794131bbf4
2015-02-11T19:15:50Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> elseif ( " $ { CMAKE_SYSTEM_NAME } " STREQUAL " Darwin " ) <nl> IOS_SIMULATOR - R " iOS Release " IOS_SIMULATOR R " Release " ) <nl> endif ( ) <nl> <nl> + is_sdk_requested ( TVOS swift_build_tvos ) <nl> + if ( swift_build_tvos AND $ { swift_can_crosscompile_stdlib } ) <nl> + configure_sdk_darwin ( TVOS " tvOS " " 9 . 0 " appletvos tvos tvos " armv7 ; arm64 " TRUE ) <nl> + configure_target_variant ( TVOS - DA " tvOS Debug + Asserts " TVOS DA " Debug + Asserts " ) <nl> + configure_target_variant ( TVOS - RA " tvOS Release + Asserts " TVOS RA " Release + Asserts " ) <nl> + configure_target_variant ( TVOS - R " tvOS Release " TVOS R " Release " ) <nl> + endif ( ) <nl> + <nl> + is_sdk_requested ( TVOS_SIMULATOR swift_build_tvos_simulator ) <nl> + if ( swift_build_tvos_simulator AND $ { swift_can_crosscompile_stdlib } ) <nl> + configure_sdk_darwin ( TVOS_SIMULATOR " tvOS Simulator " " 9 . 0 " appletvsimulator tvos - simulator tvos " i386 ; x86_64 " FALSE ) <nl> + configure_target_variant ( <nl> + TVOS_SIMULATOR - DA " tvOS Debug + Asserts " TVOS_SIMULATOR DA " Debug + Asserts " ) <nl> + configure_target_variant ( <nl> + TVOS_SIMULATOR - RA " tvOS Release + Asserts " TVOS_SIMULATOR RA " Release + Asserts " ) <nl> + configure_target_variant ( <nl> + TVOS_SIMULATOR - R " tvOS Release " TVOS_SIMULATOR R " Release " ) <nl> + endif ( ) <nl> + <nl> + is_sdk_requested ( WATCHOS swift_build_watchos ) <nl> + if ( swift_build_watchos AND $ { swift_can_crosscompile_stdlib } ) <nl> + configure_sdk_darwin ( WATCHOS " watchOS " " 2 . 0 " watchos watchos watchos " armv7 ; arm64 " TRUE ) <nl> + configure_target_variant ( WATCHOS - DA " watchOS Debug + Asserts " WATCHOS DA " Debug + Asserts " ) <nl> + configure_target_variant ( WATCHOS - RA " watchOS Release + Asserts " WATCHOS RA " Release + Asserts " ) <nl> + configure_target_variant ( WATCHOS - R " watchOS Release " WATCHOS R " Release " ) <nl> + endif ( ) <nl> + <nl> + is_sdk_requested ( WATCHOS_SIMULATOR swift_build_watchos_simulator ) <nl> + if ( swift_build_watchos_simulator AND $ { swift_can_crosscompile_stdlib } ) <nl> + configure_sdk_darwin ( WATCHOS_SIMULATOR " watchOS Simulator " " 2 . 0 " watchsimulator watchos - simulator watchos " i386 ; x86_64 " FALSE ) <nl> + configure_target_variant ( <nl> + WATCHOS_SIMULATOR - DA " watchOS Debug + Asserts " WATCHOS_SIMULATOR DA " Debug + Asserts " ) <nl> + configure_target_variant ( <nl> + WATCHOS_SIMULATOR - RA " watchOS Release + Asserts " WATCHOS_SIMULATOR RA " Release + Asserts " ) <nl> + configure_target_variant ( <nl> + WATCHOS_SIMULATOR - R " watchOS Release " WATCHOS_SIMULATOR R " Release " ) <nl> + endif ( ) <nl> + <nl> # FIXME : guess target variant based on the host . <nl> # if ( SWIFT_HOST_VARIANT MATCHES " ^ macosx " ) <nl> # set ( SWIFT_PRIMARY_VARIANT_GUESS " OSX - R " ) <nl> mmm a / cmake / modules / SwiftConfigureSDK . cmake <nl> ppp b / cmake / modules / SwiftConfigureSDK . cmake <nl> macro ( configure_sdk_darwin <nl> endif ( ) <nl> <nl> # Determine the SDK version we found . <nl> - string ( REGEX MATCH " / [ A - Za - z ] + [ 0 - 9 ] + \ \ . [ 0 - 9 ] + ( \ \ . Internal ) ? \ \ . sdk " <nl> - SCRATCH $ { SWIFT_SDK_ $ { prefix } _PATH } ) <nl> - string ( REGEX MATCH " [ 0 - 9 ] + \ \ . [ 0 - 9 ] + " <nl> - SWIFT_SDK_ $ { prefix } _VERSION $ { SCRATCH } ) <nl> + execute_process ( <nl> + COMMAND " defaults " " read " " $ { SWIFT_SDK_ $ { prefix } _PATH } / SDKSettings . plist " " Version " <nl> + OUTPUT_VARIABLE SWIFT - SDK_ $ { prefix } _VERSION <nl> + OUTPUT_STRIP_TRAILING_WHITESPACE ) <nl> <nl> # Set other variables . <nl> set ( SWIFT_SDK_ $ { prefix } _NAME " $ { name } " ) <nl> mmm a / include / swift / AST / PlatformKinds . def <nl> ppp b / include / swift / AST / PlatformKinds . def <nl> <nl> <nl> / / Reordering these platforms will break serialization . <nl> AVAILABILITY_PLATFORM ( iOS , " iOS " ) <nl> + AVAILABILITY_PLATFORM ( tvOS , " tvOS " ) <nl> + AVAILABILITY_PLATFORM ( watchOS , " watchOS " ) <nl> AVAILABILITY_PLATFORM ( OSX , " OS X " ) <nl> AVAILABILITY_PLATFORM ( iOSApplicationExtension , " iOS application extension " ) <nl> + AVAILABILITY_PLATFORM ( tvOSApplicationExtension , " tvOS application extension " ) <nl> + AVAILABILITY_PLATFORM ( watchOSApplicationExtension , " watchOS application extension " ) <nl> AVAILABILITY_PLATFORM ( OSXApplicationExtension , " OS X application extension " ) <nl> <nl> # undef AVAILABILITY_PLATFORM <nl> mmm a / include / swift / Basic / LangOptions . h <nl> ppp b / include / swift / Basic / LangOptions . h <nl> namespace swift { <nl> Target . getMacOSXVersion ( major , minor , revision ) ; <nl> } else if ( Target . isiOS ( ) ) { <nl> Target . getiOSVersion ( major , minor , revision ) ; <nl> + } else if ( Target . isWatchOS ( ) ) { <nl> + Target . getOSVersion ( major , minor , revision ) ; <nl> } else if ( Target . isOSLinux ( ) | | Target . getTriple ( ) . empty ( ) ) { <nl> major = minor = revision = 0 ; <nl> } else { <nl> mmm a / include / swift / Basic / Platform . h <nl> ppp b / include / swift / Basic / Platform . h <nl> namespace swift { <nl> / / / Returns true if the given triple represents iOS running in a simulator . <nl> bool tripleIsiOSSimulator ( const llvm : : Triple & triple ) ; <nl> <nl> + / / / Returns true if the given triple represents AppleTV running in a simulator . <nl> + bool tripleIsAppleTVSimulator ( const llvm : : Triple & triple ) ; <nl> + <nl> + / / / Returns true if the given triple represents watchOS running in a simulator . <nl> + bool tripleIsWatchSimulator ( const llvm : : Triple & triple ) ; <nl> + <nl> / / / Returns the platform name for a given target triple . <nl> / / / <nl> / / / For example , the iOS simulator has the name " iphonesimulator " , while real <nl> mmm a / lib / AST / PlatformKind . cpp <nl> ppp b / lib / AST / PlatformKind . cpp <nl> bool swift : : isPlatformActive ( PlatformKind Platform , LangOptions & LangOpts ) { <nl> return LangOpts . Target . isMacOSX ( ) ; <nl> case PlatformKind : : iOS : <nl> case PlatformKind : : iOSApplicationExtension : <nl> + case PlatformKind : : tvOS : <nl> + case PlatformKind : : tvOSApplicationExtension : <nl> return LangOpts . Target . isiOS ( ) ; <nl> + case PlatformKind : : watchOS : <nl> + case PlatformKind : : watchOSApplicationExtension : <nl> + return LangOpts . Target . isWatchOS ( ) ; <nl> case PlatformKind : : none : <nl> llvm_unreachable ( " handled above " ) ; <nl> } <nl> mmm a / lib / Basic / LangOptions . cpp <nl> ppp b / lib / Basic / LangOptions . cpp <nl> void LangOptions : : setTarget ( llvm : : Triple triple ) { <nl> / / Set the " os " target configuration . <nl> if ( Target . isMacOSX ( ) ) <nl> addTargetConfigOption ( " os " , " OSX " ) ; <nl> - else if ( Target . isiOS ( ) ) <nl> + else if ( triple . isiOS ( ) ) { <nl> addTargetConfigOption ( " os " , " iOS " ) ; <nl> - else if ( Target . isOSLinux ( ) ) <nl> + if ( triple . isTvOS ( ) ) <nl> + addTargetConfigOption ( " os " , " tvOS " ) ; <nl> + } <nl> + else if ( triple . isWatchOS ( ) ) <nl> + addTargetConfigOption ( " os " , " watchOS " ) ; <nl> + else if ( triple . isOSLinux ( ) ) <nl> addTargetConfigOption ( " os " , " Linux " ) ; <nl> else <nl> llvm_unreachable ( " Unsupported target OS " ) ; <nl> mmm a / lib / Basic / Platform . cpp <nl> ppp b / lib / Basic / Platform . cpp <nl> bool swift : : tripleIsiOSSimulator ( const llvm : : Triple & triple ) { <nl> ( arch = = llvm : : Triple : : x86 | | arch = = llvm : : Triple : : x86_64 ) ) ; <nl> } <nl> <nl> + bool swift : : tripleIsAppleTVSimulator ( const llvm : : Triple & triple ) { <nl> + llvm : : Triple : : ArchType arch = triple . getArch ( ) ; <nl> + return ( triple . isTvOS ( ) & & <nl> + ( arch = = llvm : : Triple : : x86 | | arch = = llvm : : Triple : : x86_64 ) ) ; <nl> + } <nl> + <nl> + bool swift : : tripleIsWatchSimulator ( const llvm : : Triple & triple ) { <nl> + llvm : : Triple : : ArchType arch = triple . getArch ( ) ; <nl> + return ( triple . isWatchOS ( ) & & <nl> + ( arch = = llvm : : Triple : : x86 | | arch = = llvm : : Triple : : x86_64 ) ) ; <nl> + } <nl> + <nl> StringRef swift : : getPlatformNameForTriple ( const llvm : : Triple & triple ) { <nl> if ( triple . isiOS ( ) ) { <nl> + if ( triple . isTvOS ( ) ) { <nl> + if ( tripleIsAppleTVSimulator ( triple ) ) <nl> + return " appletvsimulator " ; <nl> + return " appletvos " ; <nl> + } <nl> + <nl> if ( tripleIsiOSSimulator ( triple ) ) <nl> return " iphonesimulator " ; <nl> return " iphoneos " ; <nl> } <nl> <nl> + if ( triple . isWatchOS ( ) ) { <nl> + if ( tripleIsWatchSimulator ( triple ) ) <nl> + return " watchsimulator " ; <nl> + return " watchos " ; <nl> + } <nl> + <nl> if ( triple . isMacOSX ( ) ) <nl> return " macosx " ; <nl> <nl> mmm a / lib / ClangImporter / ClangImporter . cpp <nl> ppp b / lib / ClangImporter / ClangImporter . cpp <nl> ClangImporter : : create ( ASTContext & ctx , <nl> llvm : : raw_string_ostream minVersionOpt { minVersionBuf } ; <nl> unsigned major , minor , micro ; <nl> if ( triple . isiOS ( ) ) { <nl> - if ( swift : : tripleIsiOSSimulator ( triple ) ) <nl> - minVersionOpt < < " - mios - simulator - version - min = " ; <nl> - else <nl> - minVersionOpt < < " - mios - version - min = " ; <nl> + bool isiOSSimulator = swift : : tripleIsiOSSimulator ( triple ) ; <nl> + if ( triple . isTvOS ( ) ) { <nl> + if ( isiOSSimulator ) <nl> + minVersionOpt < < " - mtvos - simulator - version - min = " ; <nl> + else <nl> + minVersionOpt < < " - mtvos - version - min = " ; <nl> + } else { <nl> + if ( isiOSSimulator ) <nl> + minVersionOpt < < " - mios - simulator - version - min = " ; <nl> + else <nl> + minVersionOpt < < " - mios - version - min = " ; <nl> + } <nl> <nl> triple . getiOSVersion ( major , minor , micro ) ; <nl> + } else if ( triple . isWatchOS ( ) ) { <nl> + if ( tripleIsWatchSimulator ( triple ) ) <nl> + minVersionOpt < < " - mwatchos - simulator - version - min = " ; <nl> + else <nl> + minVersionOpt < < " - mwatchos - version - min = " ; <nl> + triple . getOSVersion ( major , minor , micro ) ; <nl> } else { <nl> assert ( triple . isMacOSX ( ) ) ; <nl> minVersionOpt < < " - mmacosx - version - min = " ; <nl> mmm a / lib / Driver / Driver . cpp <nl> ppp b / lib / Driver / Driver . cpp <nl> static void validateArgs ( DiagnosticEngine & diags , const ArgList & Args ) { <nl> diags . diagnose ( SourceLoc ( ) , diag : : error_os_minimum_deployment , <nl> " OS X 10 . 9 " ) ; <nl> } else if ( triple . isiOS ( ) ) { <nl> + if ( triple . isTvOS ( ) ) { <nl> + if ( triple . isOSVersionLT ( 9 , 0 ) ) { <nl> + diags . diagnose ( SourceLoc ( ) , diag : : error_os_minimum_deployment , <nl> + " tvOS 9 . 0 " ) ; <nl> + return ; <nl> + } <nl> + } <nl> if ( triple . isOSVersionLT ( 7 ) ) <nl> diags . diagnose ( SourceLoc ( ) , diag : : error_os_minimum_deployment , <nl> " iOS 7 " ) ; <nl> + } else if ( triple . isWatchOS ( ) ) { <nl> + if ( triple . isOSVersionLT ( 2 , 0 ) ) { <nl> + diags . diagnose ( SourceLoc ( ) , diag : : error_os_minimum_deployment , <nl> + " watchOS 2 . 0 " ) ; <nl> + return ; <nl> + } <nl> } <nl> } <nl> } <nl> static bool isSDKTooOld ( StringRef sdkPath , const llvm : : Triple & target ) { <nl> return version < clang : : VersionTuple ( 10 , 10 ) ; <nl> <nl> } else if ( target . isiOS ( ) ) { <nl> + if ( target . isTvOS ( ) ) <nl> + return sdkPath . find ( " OS8 " ) ! = StringRef : : npos | | <nl> + sdkPath . find ( " Simulator8 " ) ! = StringRef : : npos ; <nl> / / iOS SDKs don ' t always have the version number in the name , but <nl> / / fortunately that started with the first version that supports Swift . <nl> / / Just check for one version before that , just in case . <nl> return sdkPath . find ( " OS7 " ) ! = StringRef : : npos | | <nl> sdkPath . find ( " Simulator7 " ) ! = StringRef : : npos ; <nl> <nl> + } else if ( target . isWatchOS ( ) ) { <nl> + return sdkPath . find ( " OS1 " ) ! = StringRef : : npos | | <nl> + sdkPath . find ( " Simulator1 " ) ! = StringRef : : npos ; <nl> } else { <nl> return false ; <nl> } <nl> const ToolChain * Driver : : getToolChain ( const ArgList & Args , <nl> case llvm : : Triple : : Darwin : <nl> case llvm : : Triple : : MacOSX : <nl> case llvm : : Triple : : IOS : <nl> + case llvm : : Triple : : TvOS : <nl> + case llvm : : Triple : : WatchOS : <nl> TC = new toolchains : : Darwin ( * this , Target ) ; <nl> break ; <nl> # if defined ( SWIFT_ENABLE_TARGET_LINUX ) <nl> mmm a / lib / Driver / Tools . cpp <nl> ppp b / lib / Driver / Tools . cpp <nl> Job * darwin : : Linker : : constructJob ( const JobAction & JA , <nl> } <nl> <nl> assert ( Triple . isOSDarwin ( ) ) ; <nl> - bool wantsObjCRuntime = <nl> - Triple . isiOS ( ) ? Triple . isOSVersionLT ( 8 ) : Triple . isMacOSXVersionLT ( 10 , 10 ) ; <nl> + bool wantsObjCRuntime = false ; <nl> + if ( Triple . isiOS ( ) ) <nl> + wantsObjCRuntime = Triple . isOSVersionLT ( 8 ) ; <nl> + else if ( Triple . isWatchOS ( ) ) <nl> + wantsObjCRuntime = Triple . isOSVersionLT ( 2 ) ; <nl> + else if ( Triple . isMacOSX ( ) ) <nl> + wantsObjCRuntime = Triple . isMacOSXVersionLT ( 10 , 10 ) ; <nl> + <nl> if ( Args . hasFlag ( options : : OPT_link_objc_runtime , <nl> options : : OPT_no_link_objc_runtime , <nl> / * default = * / wantsObjCRuntime ) ) { <nl> Job * darwin : : Linker : : constructJob ( const JobAction & JA , <nl> llvm : : sys : : path : : remove_filename ( LibProfile ) ; / / remove platform name <nl> llvm : : sys : : path : : append ( LibProfile , " clang " , CLANG_VERSION_STRING ) ; <nl> <nl> - StringRef RT = Triple . isiOS ( ) ? " ios " : " osx " ; <nl> + StringRef RT ; <nl> + if ( Triple . isiOS ( ) ) { <nl> + if ( Triple . isTvOS ( ) ) <nl> + RT = " tvos " ; <nl> + else <nl> + RT = " ios " ; <nl> + } <nl> + else if ( Triple . isWatchOS ( ) ) <nl> + RT = " watchos " ; <nl> + else <nl> + RT = " osx " ; <nl> llvm : : sys : : path : : append ( LibProfile , " lib " , " darwin " , <nl> " libclang_rt . profile_ " + RT + " . a " ) ; <nl> Arguments . push_back ( Args . MakeArgString ( LibProfile ) ) ; <nl> Job * darwin : : Linker : : constructJob ( const JobAction & JA , <nl> Arguments . push_back ( Args . MakeArgString ( RuntimeLibPath ) ) ; <nl> <nl> / / FIXME : Properly handle deployment targets . <nl> - assert ( Triple . isiOS ( ) | | Triple . isMacOSX ( ) ) ; <nl> + assert ( Triple . isiOS ( ) | | Triple . isWatchOS ( ) | | Triple . isMacOSX ( ) ) ; <nl> if ( Triple . isiOS ( ) ) { <nl> - if ( tripleIsiOSSimulator ( Triple ) ) <nl> - Arguments . push_back ( " - ios_simulator_version_min " ) ; <nl> - else <nl> - Arguments . push_back ( " - iphoneos_version_min " ) ; <nl> + bool isiOSSimulator = tripleIsiOSSimulator ( Triple ) ; <nl> + if ( Triple . isTvOS ( ) ) { <nl> + if ( isiOSSimulator ) <nl> + Arguments . push_back ( " - tvos_simulator_version_min " ) ; <nl> + else <nl> + Arguments . push_back ( " - tvos_version_min " ) ; <nl> + } else { <nl> + if ( isiOSSimulator ) <nl> + Arguments . push_back ( " - ios_simulator_version_min " ) ; <nl> + else <nl> + Arguments . push_back ( " - iphoneos_version_min " ) ; <nl> + } <nl> unsigned major , minor , micro ; <nl> Triple . getiOSVersion ( major , minor , micro ) ; <nl> addVersionString ( Args , Arguments , major , minor , micro ) ; <nl> + } else if ( Triple . isWatchOS ( ) ) { <nl> + if ( tripleIsWatchSimulator ( Triple ) ) <nl> + Arguments . push_back ( " - watchos_simulator_version_min " ) ; <nl> + else <nl> + Arguments . push_back ( " - watchos_version_min " ) ; <nl> + unsigned major , minor , micro ; <nl> + Triple . getOSVersion ( major , minor , micro ) ; <nl> + addVersionString ( Args , Arguments , major , minor , micro ) ; <nl> } else { <nl> Arguments . push_back ( " - macosx_version_min " ) ; <nl> unsigned major , minor , micro ; <nl> mmm a / stdlib / private / StdlibUnittest / StdlibUnittest . swift . gyb <nl> ppp b / stdlib / private / StdlibUnittest / StdlibUnittest . swift . gyb <nl> import SwiftPrivate <nl> import SwiftPrivatePthreadExtras <nl> import SwiftPrivateDarwinExtras <nl> <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> import Darwin <nl> # elseif os ( Linux ) <nl> import Glibc <nl> public class TestSuite { <nl> var _testNameToIndex : [ String : Int ] = [ : ] <nl> } <nl> <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> @ asmname ( " swift_stdlib_getSystemVersionPlistProperty " ) <nl> func _stdlib_getSystemVersionPlistPropertyImpl ( <nl> propertyName : UnsafePointer < CChar > ) - > UnsafePointer < CChar > <nl> mmm a / stdlib / private / SwiftPrivateDarwinExtras / Subprocess . swift <nl> ppp b / stdlib / private / SwiftPrivateDarwinExtras / Subprocess . swift <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> import SwiftPrivate <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> import Darwin <nl> # elseif os ( Linux ) <nl> import Glibc <nl> public func runChild ( args : _UnitTestArray < String > ) <nl> return ( stdout , stderr , status ) <nl> } <nl> <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> @ asmname ( " _NSGetEnviron " ) <nl> func _NSGetEnviron ( ) - > UnsafeMutablePointer < UnsafeMutablePointer < UnsafeMutablePointer < CChar > > > <nl> # endif <nl> <nl> internal func _getEnviron ( ) - > UnsafeMutablePointer < UnsafeMutablePointer < CChar > > { <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> return _NSGetEnviron ( ) . memory <nl> # else <nl> return __environ <nl> mmm a / stdlib / private / SwiftPrivateDarwinExtras / SwiftPrivateDarwinExtras . swift <nl> ppp b / stdlib / private / SwiftPrivateDarwinExtras / SwiftPrivateDarwinExtras . swift <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> import SwiftPrivate <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> import Darwin <nl> # elseif os ( Linux ) <nl> import Glibc <nl> mmm a / stdlib / private / SwiftPrivatePthreadExtras / PthreadBarriers . swift <nl> ppp b / stdlib / private / SwiftPrivatePthreadExtras / PthreadBarriers . swift <nl> <nl> / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> import Darwin <nl> # elseif os ( Linux ) <nl> import Glibc <nl> mmm a / stdlib / private / SwiftPrivatePthreadExtras / SwiftPrivatePthreadExtras . swift <nl> ppp b / stdlib / private / SwiftPrivatePthreadExtras / SwiftPrivatePthreadExtras . swift <nl> <nl> / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - # if os ( OSX ) | | os ( iOS ) <nl> + # if os ( OSX ) | | os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> import Darwin <nl> # elseif os ( Linux ) <nl> import Glibc <nl> mmm a / stdlib / public / SDK / SpriteKit / SpriteKitMirrors . swift . gyb <nl> ppp b / stdlib / public / SDK / SpriteKit / SpriteKitMirrors . swift . gyb <nl> $ { MirrorDecl } { <nl> / / send that <nl> # if os ( OSX ) <nl> let img = NSImage ( data : data ) <nl> - # elseif os ( iOS ) <nl> + # elseif os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> let img = UIImage ( data : data ) <nl> # endif <nl> return . Some ( . Sprite ( img ) ) <nl> new file mode 100644 <nl> index 000000000000 . . 9e905270edc5 <nl> mmm / dev / null <nl> ppp b / test / BuildConfigurations / arm64AppleTVOSTarget . swift <nl> <nl> + / / RUN : % swift - parse % s - verify - D FOO - D BAR - target arm64 - apple - tvos9 . 0 - D FOO - parse - stdlib <nl> + / / RUN : % swift - ide - test - test - input - complete - source - filename = % s - target arm64 - apple - tvos9 . 0 <nl> + <nl> + # if arch ( arm64 ) & & os ( tvOS ) & & _runtime ( _ObjC ) <nl> + class C { } <nl> + var x = C ( ) <nl> + # endif <nl> + var y = x <nl> new file mode 100644 <nl> index 000000000000 . . e39e8a37878a <nl> mmm / dev / null <nl> ppp b / test / BuildConfigurations / armWatchOSTarget . swift <nl> <nl> + / / RUN : % swift - parse % s - verify - D FOO - D BAR - target arm - apple - watchos2 . 0 - D FOO - parse - stdlib <nl> + / / RUN : % swift - ide - test - test - input - complete - source - filename = % s - target arm - apple - watchos2 . 0 <nl> + <nl> + # if arch ( arm ) & & os ( watchOS ) & & _runtime ( _ObjC ) <nl> + class C { } <nl> + var x = C ( ) <nl> + # endif <nl> + var y = x <nl> new file mode 100644 <nl> index 000000000000 . . b9d3ca2ddfef <nl> mmm / dev / null <nl> ppp b / test / BuildConfigurations / i386AppleTVOSTarget . swift <nl> <nl> + / / RUN : % swift - parse % s - verify - D FOO - D BAR - target i386 - apple - tvos9 . 0 - D FOO - parse - stdlib <nl> + / / RUN : % swift - ide - test - test - input - complete - source - filename = % s - target i386 - apple - tvos9 . 0 <nl> + <nl> + # if arch ( i386 ) & & os ( tvOS ) & & _runtime ( _ObjC ) <nl> + class C { } <nl> + var x = C ( ) <nl> + # endif <nl> + var y = x <nl> new file mode 100644 <nl> index 000000000000 . . efd4f0081277 <nl> mmm / dev / null <nl> ppp b / test / BuildConfigurations / i386WatchOSTarget . swift <nl> <nl> + / / RUN : % swift - parse % s - verify - D FOO - D BAR - target i386 - apple - watchos2 . 0 - D FOO - parse - stdlib <nl> + / / RUN : % swift - ide - test - test - input - complete - source - filename = % s - target i386 - apple - watchos2 . 0 <nl> + <nl> + # if arch ( i386 ) & & os ( watchOS ) & & _runtime ( _ObjC ) <nl> + class C { } <nl> + var x = C ( ) <nl> + # endif <nl> + var y = x <nl> new file mode 100644 <nl> index 000000000000 . . 0711bfb87451 <nl> mmm / dev / null <nl> ppp b / test / BuildConfigurations / x64AppleTVOSTarget . swift <nl> <nl> + / / RUN : % swift - parse % s - verify - D FOO - D BAR - target x86_64 - apple - tvos9 . 0 - D FOO - parse - stdlib <nl> + / / RUN : % swift - ide - test - test - input - complete - source - filename = % s - target x86_64 - apple - tvos9 . 0 <nl> + <nl> + # if arch ( x86_64 ) & & os ( tvOS ) & & _runtime ( _ObjC ) <nl> + class C { } <nl> + var x = C ( ) <nl> + # endif <nl> + var y = x <nl> mmm a / test / Driver / linker . swift <nl> ppp b / test / Driver / linker . swift <nl> <nl> / / RUN : % swiftc_driver - driver - print - jobs - target x86_64 - apple - ios7 . 1 % s 2 > & 1 > % t . simple . txt <nl> / / RUN : FileCheck - check - prefix IOS_SIMPLE % s < % t . simple . txt <nl> <nl> + / / RUN : % swiftc_driver - driver - print - jobs - target x86_64 - apple - tvos9 . 0 % s 2 > & 1 > % t . simple . txt <nl> + / / RUN : FileCheck - check - prefix tvOS_SIMPLE % s < % t . simple . txt <nl> + <nl> + / / RUN : % swiftc_driver - driver - print - jobs - target i386 - apple - watchos2 . 0 % s 2 > & 1 > % t . simple . txt <nl> + / / RUN : FileCheck - check - prefix watchOS_SIMPLE % s < % t . simple . txt <nl> + <nl> / / RUN : % swiftc_driver - driver - print - jobs - target x86_64 - unknown - linux - gnu - Ffoo - framework bar - Lbaz - lboo - Xlinker - undefined % s 2 > & 1 > % t . linux . txt <nl> / / RUN : FileCheck - check - prefix LINUX % s < % t . linux . txt <nl> <nl> <nl> / / IOS_SIMPLE - DAG : - ios_simulator_version_min 7 . 1 . { { [ 0 - 9 ] + } } <nl> / / IOS_SIMPLE : - o linker <nl> <nl> + <nl> + / / tvOS_SIMPLE : swift <nl> + / / tvOS_SIMPLE : - o [ [ OBJECTFILE : . * ] ] <nl> + <nl> + / / tvOS_SIMPLE : bin / ld { { " ? } } <nl> + / / tvOS_SIMPLE - DAG : [ [ OBJECTFILE ] ] <nl> + / / tvOS_SIMPLE - DAG : - L { { [ ^ ] + / lib / swift / appletvsimulator } } <nl> + / / tvOS_SIMPLE - DAG : - lSystem <nl> + / / tvOS_SIMPLE - DAG : - arch x86_64 <nl> + / / tvOS_SIMPLE - DAG : - tvos_simulator_version_min 9 . 0 . { { [ 0 - 9 ] + } } <nl> + / / tvOS_SIMPLE : - o linker <nl> + <nl> + <nl> + / / watchOS_SIMPLE : swift <nl> + / / watchOS_SIMPLE : - o [ [ OBJECTFILE : . * ] ] <nl> + <nl> + / / watchOS_SIMPLE : bin / ld { { " ? } } <nl> + / / watchOS_SIMPLE - DAG : [ [ OBJECTFILE ] ] <nl> + / / watchOS_SIMPLE - DAG : - L { { [ ^ ] + / lib / swift / watchsimulator } } <nl> + / / watchOS_SIMPLE - DAG : - lSystem <nl> + / / watchOS_SIMPLE - DAG : - arch i386 <nl> + / / watchOS_SIMPLE - DAG : - watchos_simulator_version_min 2 . 0 . { { [ 0 - 9 ] + } } <nl> + / / watchOS_SIMPLE : - o linker <nl> + <nl> + <nl> / / LINUX : swift <nl> / / LINUX : - o [ [ OBJECTFILE : . * ] ] <nl> <nl> mmm a / test / Driver / os - deployment . swift <nl> ppp b / test / Driver / os - deployment . swift <nl> <nl> / / RUN : not % swiftc_driver - target x86_64 - apple - macosx10 . 8 % s 2 > & 1 | FileCheck - - check - prefix = CHECK - OSX % s <nl> / / RUN : not % swiftc_driver - target x86_64 - apple - ios6 . 0 % s 2 > & 1 | FileCheck - - check - prefix = CHECK - IOS % s <nl> + / / RUN : not % swiftc_driver - target x86_64 - apple - tvos8 . 0 % s 2 > & 1 | FileCheck - - check - prefix = CHECK - tvOS % s <nl> + / / RUN : not % swiftc_driver - target x86_64 - apple - watchos1 . 0 % s 2 > & 1 | FileCheck - - check - prefix = CHECK - watchOS % s <nl> <nl> <nl> / / CHECK - OSX : Swift requires a minimum deployment target of OS X 10 . 9 <nl> / / CHECK - IOS : Swift requires a minimum deployment target of iOS 7 <nl> + / / CHECK - tvOS : Swift requires a minimum deployment target of tvOS 9 . 0 <nl> + / / CHECK - watchOS : Swift requires a minimum deployment target of watchOS 2 . 0 <nl> mmm a / test / Driver / profiling . swift <nl> ppp b / test / Driver / profiling . swift <nl> <nl> <nl> / / RUN : % swiftc_driver - driver - print - jobs - profile - generate - target x86_64 - apple - ios7 . 1 % s | FileCheck - check - prefix = CHECK - check - prefix = IOS % s <nl> <nl> + / / RUN : % swiftc_driver - driver - print - jobs - profile - generate - target x86_64 - apple - tvos9 . 0 % s | FileCheck - check - prefix = CHECK - check - prefix = tvOS % s <nl> + <nl> + / / RUN : % swiftc_driver - driver - print - jobs - profile - generate - target x86_64 - apple - watchos2 . 0 % s | FileCheck - check - prefix = CHECK - check - prefix = watchOS % s <nl> + <nl> / / RUN : % swiftc_driver - driver - print - jobs - profile - generate - target x86_64 - unknown - linux - gnu % s | FileCheck - check - prefix = CHECK - check - prefix = LINUX % s <nl> <nl> / / CHECK : swift <nl> <nl> / / IOS : bin / ld { { " ? } } <nl> / / IOS : lib / swift / clang / { { [ ^ ] * } } / lib / darwin / libclang_rt . profile_ios . a <nl> <nl> + / / tvOS : bin / ld { { " ? } } <nl> + / / tvOS : lib / swift / clang / { { [ ^ ] * } } / lib / darwin / libclang_rt . profile_tvos . a <nl> + <nl> + / / watchOS : bin / ld { { " ? } } <nl> + / / watchOS : lib / swift / clang / { { [ ^ ] * } } / lib / darwin / libclang_rt . profile_watchos . a <nl> + <nl> / / LINUX : clang + + { { " ? } } <nl> / / LINUX : lib / swift / clang / { { [ ^ ] * } } / lib / linux / libclang_rt . profile - x86_64 . a <nl> mmm a / test / Driver / sdk . swift <nl> ppp b / test / Driver / sdk . swift <nl> <nl> <nl> / / RUN : mkdir % t / iPhoneOS7 . 0 . sdk & & not % swift_driver - sdk % t / iPhoneOS7 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : mkdir % t / iPhoneOS7 . 0 . Internal . sdk & & not % swift_driver - sdk % t / iPhoneOS7 . 0 . Internal . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / tvOS8 . 0 . sdk & & not % swift_driver - sdk % t / tvOS8 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / tvOS8 . 0 . Internal . sdk & & not % swift_driver - sdk % t / tvOS8 . 0 . Internal . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / watchOSOS1 . 0 . sdk & & not % swift_driver - sdk % t / watchOSOS1 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / watchOSOS1 . 0 . Internal . sdk & & not % swift_driver - sdk % t / watchOSOS1 . 0 . Internal . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : mkdir % t / iPhoneSimulator7 . 0 . sdk & & not % swift_driver - sdk % t / iPhoneSimulator7 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / AppleTVSimulator8 . 0 . sdk & & not % swift_driver - sdk % t / AppleTVSimulator8 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : mkdir % t / WatchSimulator1 . 0 . sdk & & not % swift_driver - sdk % t / WatchSimulator1 . 0 . sdk - target i386 - apple - watchos2 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : mkdir % t / iPhoneOS8 . 0 . sdk & & % swift_driver - sdk % t / iPhoneOS8 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : mkdir % t / tvOS9 . 0 . sdk & & % swift_driver - sdk % t / tvOS9 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : mkdir % t / watchOS2 . 0 . sdk & & % swift_driver - sdk % t / watchOS2 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> / / RUN : mkdir % t / iPhoneOS . sdk & & % swift_driver - sdk % t / iPhoneOS . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : mkdir % t / tvOS . sdk & & % swift_driver - sdk % t / tvOS . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : mkdir % t / watchOS . sdk & & % swift_driver - sdk % t / watchOS . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : mkdir % t / custom - sdk & & % swift_driver - sdk % t / custom - sdk - # # # 2 > & 1 | FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> mmm a / test / IRGen / generic_metatypes . swift <nl> ppp b / test / IRGen / generic_metatypes . swift <nl> <nl> / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> / / RUN : % swift - target i386 - apple - ios7 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> / / RUN : % swift - target x86_64 - apple - ios7 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> + / / RUN : % swift - target i386 - apple - tvos9 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> + / / RUN : % swift - target x86_64 - apple - tvos9 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> + / / RUN : % swift - target i386 - apple - watchos2 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> / / RUN : % swift - target armv7 - apple - ios7 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> / / RUN : % swift - target arm64 - apple - ios7 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> + / / RUN : % swift - target armv7 - apple - tvos9 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> + / / RUN : % swift - target arm64 - apple - tvos9 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> + / / RUN : % swift - target armv7 - apple - watchos2 . 0 - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 32 % s <nl> / / RUN : % swift - target x86_64 - unknown - linux - gnu - disable - objc - interop - emit - ir - parse - stdlib - primary - file % s | FileCheck - - check - prefix = CHECK - - check - prefix = CHECK - 64 % s <nl> <nl> / / REQUIRES : X86 <nl> func genericMetatype < A > ( x : A . Type ) { } <nl> func makeGenericMetatypes ( ) { <nl> / / CHECK : call % swift . type * @ _TMaGV17generic_metatypes6OneArgVS_3Foo_ ( ) [ [ NOUNWIND_READNONE : # [ 0 - 9 ] + ] ] <nl> genericMetatype ( OneArg < Foo > . self ) <nl> - <nl> + <nl> / / CHECK : call % swift . type * @ _TMaGV17generic_metatypes7TwoArgsVS_3FooCS_3Bar_ ( ) [ [ NOUNWIND_READNONE ] ] <nl> genericMetatype ( TwoArgs < Foo , Bar > . self ) <nl> <nl> mmm a / test / Misc / target - cpu . swift <nl> ppp b / test / Misc / target - cpu . swift <nl> <nl> / / RUN : not % swift - parse - target arm64 - apple - ios7 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = TARGETCPU1 % s <nl> / / TARGETCPU1 : " - target - cpu " " cyclone " <nl> <nl> + / / RUN : not % swift - parse - target arm64 - apple - tvos9 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = APPLETVTARGETCPU1 % s <nl> + / / APPLETVTARGETCPU1 : " - target - cpu " " cyclone " <nl> + <nl> + / / RUN : not % swift - parse - target armv7s - apple - tvos9 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = APPLETVTARGETCPU2 % s <nl> + / / APPLETVTARGETCPU2 : " - target - cpu " " swift " <nl> + <nl> + / / RUN : not % swift - parse - target armv7 - apple - tvos9 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = APPLETVTARGETCPU3 % s <nl> + / / APPLETVTARGETCPU3 : " - target - cpu " " cortex - a8 " <nl> + <nl> + / / RUN : not % swift - parse - target armv7 - apple - watchos2 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = WATCHTARGETCPU1 % s <nl> + / / WATCHTARGETCPU1 : " - target - cpu " " cortex - a8 " <nl> + <nl> + / / RUN : not % swift - parse - target arm64 - apple - watchos2 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = WATCHTARGETCPU2 % s <nl> + / / WATCHTARGETCPU2 : " - target - cpu " " cyclone " <nl> + <nl> / / RUN : not % swift - parse - target armv7s - apple - ios7 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = TARGETCPU2 % s <nl> / / TARGETCPU2 : " - target - cpu " " swift " <nl> <nl> <nl> / / RUN : not % swift - parse - target i386 - apple - ios7 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = SIMULATOR_CPU % s <nl> / / SIMULATOR_CPU : " - target - cpu " " yonah " <nl> <nl> + / / RUN : not % swift - parse - target i386 - apple - watchos2 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = WATCHSIMULATOR_CPU % s <nl> + / / WATCHSIMULATOR_CPU : " - target - cpu " " yonah " <nl> + <nl> / / RUN : not % swift - parse - target x86_64 - apple - ios7 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = SIMULATOR64_CPU % s <nl> / / SIMULATOR64_CPU : " - target - cpu " " core2 " <nl> + <nl> + / / RUN : not % swift - parse - target x86_64 - apple - tvos9 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = APPLETVSIMULATOR64_CPU % s <nl> + / / APPLETVSIMULATOR64_CPU : " - target - cpu " " core2 " <nl> + <nl> + / / RUN : not % swift - parse - target x86_64 - apple - watchos2 - Xcc - # # # % s 2 > & 1 | FileCheck - check - prefix = WATCHSIMULATOR64_CPU % s <nl> + / / WATCHSIMULATOR64_CPU : " - target - cpu " " core2 " <nl> + <nl> mmm a / tools / driver / CMakeLists . txt <nl> ppp b / tools / driver / CMakeLists . txt <nl> endif ( ) <nl> include ( SwiftDarwin ) <nl> if ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " macosx " <nl> OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphoneos " <nl> - OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphonesimulator " ) <nl> + OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphonesimulator " <nl> + OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " appletvos " <nl> + OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " appletvsimulator " <nl> + OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " watchos " <nl> + OR " $ { SWIFT_HOST_VARIANT } " STREQUAL " watchsimulator " ) <nl> # Link in CoreFoundation on Darwin . <nl> find_library ( CORE_FOUNDATION NAMES CoreFoundation ) <nl> target_link_libraries ( swift $ { CORE_FOUNDATION } ) <nl> mmm a / unittests / runtime / CMakeLists . txt <nl> ppp b / unittests / runtime / CMakeLists . txt <nl> if ( ( " $ { SWIFT_HOST_VARIANT_SDK } " STREQUAL " $ { SWIFT_PRIMARY_VARIANT_SDK } " ) AND <nl> set ( PLATFORM_TARGET_LINK_LIBRARIES ) <nl> if ( ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " macosx " ) OR <nl> ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphoneos " ) OR <nl> - ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphonesimulator " ) ) <nl> + ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " iphonesimulator " ) OR <nl> + ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " appletvos " ) OR <nl> + ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " appletvsimulator " ) OR <nl> + ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " watchos " ) OR <nl> + ( " $ { SWIFT_HOST_VARIANT } " STREQUAL " watchsimulator " ) ) <nl> find_library ( FOUNDATION_LIBRARY Foundation ) <nl> list ( APPEND PLATFORM_SOURCES <nl> weak . mm <nl>
Merge tvOS and watchOS Support
apple/swift
544ef4002daf686648bc9d955457f537d988e36b
2015-03-18T21:35:07Z
mmm a / tensorflow / tools / ci_build / release / windows / gpu_py35_full / nightly . bat <nl> ppp b / tensorflow / tools / ci_build / release / windows / gpu_py35_full / nightly . bat <nl> SET PYTHON_DIRECTORY = Python35 <nl> <nl> CALL tensorflow \ tools \ ci_build \ release \ common_win . bat <nl> <nl> - call tensorflow \ tools \ ci_build \ windows \ gpu \ pip \ run . bat - - extra_build_flags " - - config = v2 " - - extra_test_flags " - - test_env = TF2_BEHAVIOR = 1 " - - project_name " tensorflow " <nl> - <nl> - for % % a in ( " % ~ dp0 \ . " ) do set " PARENT_DIR = % % ~ nxa " <nl> - bash - l tensorflow \ tools \ ci_build \ release \ windows \ % PARENT_DIR % \ release_pip_rename . sh <nl> \ No newline at end of file <nl> + call tensorflow \ tools \ ci_build \ windows \ gpu \ pip \ run . bat - - extra_build_flags " - - config = v2 " - - extra_test_flags " - - test_env = TF2_BEHAVIOR = 1 " <nl> mmm a / tensorflow / tools / ci_build / release / windows / gpu_py35_full / release . bat <nl> ppp b / tensorflow / tools / ci_build / release / windows / gpu_py35_full / release . bat <nl> SET PYTHON_DIRECTORY = Python35 <nl> <nl> CALL tensorflow \ tools \ ci_build \ release \ common_win . bat <nl> <nl> - call tensorflow \ tools \ ci_build \ windows \ gpu \ pip \ run . bat - - release_build - - extra_build_flags " - - config = v2 " - - extra_test_flags " - - test_env = TF2_BEHAVIOR = 1 " <nl> + call tensorflow \ tools \ ci_build \ windows \ gpu \ pip \ run . bat - - release_build - - extra_build_flags " - - config = v2 " - - extra_test_flags " - - test_env = TF2_BEHAVIOR = 1 " - - project_name " tensorflow " <nl> + <nl> + for % % a in ( " % ~ dp0 \ . " ) do set " PARENT_DIR = % % ~ nxa " <nl> + bash - l tensorflow \ tools \ ci_build \ release \ windows \ % PARENT_DIR % \ release_pip_rename . sh <nl>
Move gpu script update to the correct file .
tensorflow/tensorflow
9c7afff5ba6cce49132c3b1646f716bd2514a927
2019-11-26T23:06:43Z
mmm a / dbms / src / Storages / StorageMergeTree . cpp <nl> ppp b / dbms / src / Storages / StorageMergeTree . cpp <nl> void StorageMergeTree : : alter ( <nl> storage_ast . set ( storage_ast . primary_key , new_primary_key_ast ) ; <nl> <nl> if ( new_indexes_ast . get ( ) ! = data . skip_indexes_ast . get ( ) ) <nl> - storage_ast . set ( storage_ast . indexes , new_indexes_ast ) ; <nl> + { <nl> + if ( new_indexes_ast & & ! new_indexes_ast - > children . empty ( ) ) <nl> + storage_ast . set ( storage_ast . indexes , new_indexes_ast ) ; <nl> + else <nl> + storage_ast . set ( storage_ast . indexes , nullptr ) ; <nl> + } <nl> } ; <nl> <nl> context . getDatabase ( current_database_name ) - > alterTable ( context , current_table_name , new_columns , storage_modifier ) ; <nl> mmm a / dbms / src / Storages / StorageReplicatedMergeTree . cpp <nl> ppp b / dbms / src / Storages / StorageReplicatedMergeTree . cpp <nl> void StorageReplicatedMergeTree : : alter ( const AlterCommands & params , <nl> if ( new_order_by_ast . get ( ) ! = data . order_by_ast . get ( ) ) <nl> new_metadata . sorting_key = serializeAST ( * MergeTreeData : : extractKeyExpressionList ( new_order_by_ast ) ) ; <nl> if ( new_indexes_ast . get ( ) ! = data . skip_indexes_ast . get ( ) ) <nl> - new_metadata . skip_indexes = serializeAST ( * new_indexes_ast . get ( ) ) ; <nl> + { <nl> + if ( new_indexes_ast & & ! new_indexes_ast - > children . empty ( ) ) <nl> + new_metadata . skip_indexes = serializeAST ( * new_indexes_ast . get ( ) ) ; <nl> + else <nl> + new_metadata . skip_indexes = { } ; <nl> + } <nl> <nl> String new_metadata_str = new_metadata . toString ( ) ; <nl> if ( new_metadata_str ! = ReplicatedMergeTreeTableMetadata ( data ) . toString ( ) ) <nl> mmm a / dbms / tests / queries / 0_stateless / 00824_indices_alter . sql <nl> ppp b / dbms / tests / queries / 0_stateless / 00824_indices_alter . sql <nl> ORDER BY u64 ; <nl> INSERT INTO test . minmax_idx VALUES ( 1 , 2 ) ; <nl> <nl> ALTER TABLE test . minmax_idx ADD INDEX idx1 BY u64 * i32 TYPE minmax GRANULARITY 10 ; <nl> - ALTER TABLE test . minmax_idx ADD INDEX idx2 BY u64 * i32 TYPE minmax GRANULARITY 10 ; <nl> - ALTER TABLE test . minmax_idx ADD INDEX idx3 BY u64 * i32 TYPE minmax GRANULARITY 10 AFTER idx1 ; <nl> + ALTER TABLE test . minmax_idx ADD INDEX idx2 BY u64 + i32 TYPE minmax GRANULARITY 10 ; <nl> + ALTER TABLE test . minmax_idx ADD INDEX idx3 BY u64 - i32 TYPE minmax GRANULARITY 10 AFTER idx1 ; <nl> <nl> SHOW CREATE TABLE test . minmax_idx ; <nl> <nl> INSERT INTO test . minmax_idx VALUES ( 1 , 2 ) ; <nl> <nl> SELECT * FROM test . minmax_idx WHERE u64 * i32 = 3 ; <nl> <nl> - ALTER TABLE test . minmax_idx DROP INDEX idx1 <nl> + ALTER TABLE test . minmax_idx DROP INDEX idx1 ; <nl> <nl> SHOW CREATE TABLE test . minmax_idx ; <nl> <nl> CREATE TABLE test . minmax_idx2 <nl> u64 UInt64 , <nl> i32 Int32 <nl> ) ENGINE = MergeTree ( ) <nl> - idx2 BY u64 * i32 TYPE minmax GRANULARITY 10 <nl> - INDEXES idx1 BY u64 * i32 TYPE minmax GRANULARITY 10 , <nl> - ORDER BY u64 ; <nl> + ORDER BY u64 <nl> + INDEXES idx1 BY u64 + i32 TYPE minmax GRANULARITY 10 , <nl> + idx2 BY u64 * i32 TYPE minmax GRANULARITY 10 ; <nl> <nl> INSERT INTO test . minmax_idx2 VALUES ( 1 , 2 ) ; <nl> INSERT INTO test . minmax_idx2 VALUES ( 1 , 2 ) ; <nl>
fixes
ClickHouse/ClickHouse
08d23c16d10c2edd2306359481ce9fb316ee0919
2019-01-16T18:24:38Z
mmm a / Code / CryEngine / CryAction / FlowSystem / FlowSystem . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / FlowSystem . cpp <nl> <nl> # include " Nodes / FlowStartNode . h " <nl> # include " Nodes / FlowTrackEventNode . h " <nl> # include " Nodes / FlowDelayNode . h " <nl> - # include " Nodes / FlowConditionNode . h " <nl> <nl> # include " Nodes / FlowScriptedNode . h " <nl> # include " Nodes / FlowCompositeNode . h " <nl> void CFlowSystem : : RegisterAllNodeTypes ( ) <nl> / / register all types <nl> TFlowNodeTypeId typeId = RegisterType ( " InvalidType " , 0 ) ; <nl> assert ( typeId = = InvalidFlowNodeTypeId ) ; <nl> - RegisterType ( " Log " , new CSingletonFlowFactory < CFlowLogNode > ( ) ) ; <nl> - RegisterType ( " Start " , new CAutoFlowFactory < CFlowStartNode > ( ) ) ; <nl> + RegisterType ( " Debug : Log " , new CSingletonFlowFactory < CFlowLogNode > ( ) ) ; <nl> + RegisterType ( " Game : Start " , new CAutoFlowFactory < CFlowStartNode > ( ) ) ; <nl> RegisterType ( " TrackEvent " , new CAutoFlowFactory < CFlowTrackEventNode > ( ) ) ; <nl> <nl> RegisterAutoTypes ( ) ; <nl> deleted file mode 100644 <nl> index 12607c61d6 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / AngularInterpolatorNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include < CrySystem / ISystem . h > <nl> - # include " FlowBaseNode . h " <nl> - <nl> - class CRotateTo_Node : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - Vec3 m_currentRotation ; <nl> - Vec3 m_destinationRotation ; <nl> - Vec3 m_currentRotationStep ; / / per ms <nl> - float m_lastTime ; <nl> - float m_timeRemaining ; / / in ms <nl> - <nl> - public : <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - CRotateTo_Node ( SActivationInfo * pActInfo ) <nl> - : m_currentRotation ( ZERO ) , <nl> - m_destinationRotation ( ZERO ) , <nl> - m_currentRotationStep ( ZERO ) , <nl> - m_lastTime ( 0 . 0f ) , <nl> - m_timeRemaining ( 0 . 0f ) <nl> - { <nl> - } ; <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CRotateTo_Node ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - ser . BeginGroup ( " Local " ) ; <nl> - ser . Value ( " m_currentRotation " , m_currentRotation ) ; <nl> - ser . Value ( " m_destinationRotation " , m_destinationRotation ) ; <nl> - ser . Value ( " m_currentRotationStep " , m_currentRotationStep ) ; <nl> - ser . Value ( " m_lastTime " , m_lastTime ) ; <nl> - ser . Value ( " m_timeRemaining " , m_timeRemaining ) ; <nl> - / / the regular update is taken care of by the FlowGraph itself <nl> - ser . EndGroup ( ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < Vec3 > ( " Destination " , _HELP ( " Destination " ) ) , <nl> - InputPortConfig < float > ( " Time " , _HELP ( " Duration in seconds " ) ) , <nl> - InputPortConfig < bool > ( " Trigger " , _HELP ( " Starts the rotation when triggered " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " Current " , _HELP ( " Current Rotation " ) ) , <nl> - OutputPortConfig < bool > ( " Done " , _HELP ( " Goes to TRUE when the destination is reached " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Rotates between two angles during a defined period of time " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - { <nl> - if ( ! IsPortActive ( pActInfo , 2 ) ) return ; <nl> - <nl> - m_lastTime = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - m_timeRemaining = GetPortFloat ( pActInfo , 1 ) * 1000 . 0f ; <nl> - m_destinationRotation = GetPortVec3 ( pActInfo , 0 ) ; <nl> - <nl> - / / snap angles <nl> - m_destinationRotation . x = Snap_s360 ( m_destinationRotation . x ) ; <nl> - m_destinationRotation . y = Snap_s360 ( m_destinationRotation . y ) ; <nl> - m_destinationRotation . z = Snap_s360 ( m_destinationRotation . z ) ; <nl> - <nl> - m_currentRotation . x = Snap_s360 ( m_currentRotation . x ) ; <nl> - m_currentRotation . y = Snap_s360 ( m_currentRotation . y ) ; <nl> - m_currentRotation . z = Snap_s360 ( m_currentRotation . z ) ; <nl> - <nl> - / / do we have to do anything . <nl> - if ( m_timeRemaining > = 0 . 0f ) <nl> - { <nl> - float x = Snap_s360 ( m_destinationRotation . x - m_currentRotation . x ) ; <nl> - float y = Snap_s360 ( m_destinationRotation . y - m_currentRotation . y ) ; <nl> - float z = Snap_s360 ( m_destinationRotation . z - m_currentRotation . z ) ; <nl> - <nl> - m_currentRotationStep . x = ( ( x < 360 . 0f - x ) ? x : x - 360 . 0f ) / m_timeRemaining ; <nl> - m_currentRotationStep . y = ( ( y < 360 . 0f - y ) ? y : y - 360 . 0f ) / m_timeRemaining ; <nl> - m_currentRotationStep . z = ( ( z < 360 . 0f - z ) ? z : z - 360 . 0f ) / m_timeRemaining ; <nl> - } <nl> - else <nl> - { <nl> - m_currentRotationStep . x = 0 . 0f ; <nl> - m_currentRotationStep . y = 0 . 0f ; <nl> - m_currentRotationStep . z = 0 . 0f ; <nl> - <nl> - } <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Initialize : <nl> - { <nl> - m_lastTime = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - m_timeRemaining = GetPortFloat ( pActInfo , 1 ) ; <nl> - m_currentRotation = GetPortVec3 ( pActInfo , 0 ) ; <nl> - m_destinationRotation = GetPortVec3 ( pActInfo , 0 ) ; <nl> - m_currentRotationStep . x = 0 . 0f ; <nl> - m_currentRotationStep . y = 0 . 0f ; <nl> - m_currentRotationStep . z = 0 . 0f ; <nl> - ActivateOutput ( pActInfo , 0 , m_currentRotation ) ; <nl> - ActivateOutput ( pActInfo , 1 , false ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - / / let ' s compute the movement now <nl> - float time = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - float timeDifference = time - m_lastTime ; <nl> - m_lastTime = time ; <nl> - if ( m_timeRemaining - timeDifference < = 0 . 0f ) <nl> - { <nl> - m_timeRemaining = 0 . 0f ; <nl> - m_currentRotation = m_destinationRotation ; <nl> - ActivateOutput ( pActInfo , 1 , true ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - else <nl> - { <nl> - m_timeRemaining - = timeDifference ; <nl> - m_currentRotation + = m_currentRotationStep * timeDifference ; <nl> - } <nl> - ActivateOutput ( pActInfo , 0 , m_currentRotation ) ; <nl> - break ; <nl> - } <nl> - } <nl> - ; <nl> - } ; <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Movement : RotateTo " , CRotateTo_Node ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowCVarsNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowCVarsNode . cpp <nl> class CFlowNode_CVar : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " System : ConsoleVariable " , CFlowNode_CVar ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : ConsoleVariable " , CFlowNode_CVar ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowCameraNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowCameraNodes . cpp <nl> <nl> # include " StdAfx . h " <nl> # include " FlowBaseNode . h " <nl> <nl> - class CFlowNode_Camera : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_Camera ( SActivationInfo * pActInfo ) <nl> - { <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < Vec3 > ( " pos " , " Input camera position . " ) , <nl> - InputPortConfig < Vec3 > ( " dir " , " Input camera direction . " ) , <nl> - InputPortConfig < float > ( " roll " , " Input camera roll . " ) , <nl> - InputPortConfig < bool > ( " active " , true , " While false , the node wont output any value " ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " pos " , " Current camera position . " ) , <nl> - OutputPortConfig < Vec3 > ( " dir " , " Current camera direction . " ) , <nl> - OutputPortConfig < float > ( " roll " , " Current camera roll . " ) , <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - CCamera camera ( gEnv - > pSystem - > GetViewCamera ( ) ) ; <nl> - Vec3 pos ( camera . GetPosition ( ) ) ; <nl> - Vec3 dir ( camera . GetViewdir ( ) ) ; <nl> - float roll ( camera . GetAngles ( ) . z ) ; / / GetAngles ( ) returns YPR angles - roll is in z component <nl> - <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , GetPortBool ( pActInfo , 3 ) ) ; <nl> - break ; <nl> - case eFE_Activate : <nl> - { <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , 0 ) ) <nl> - pos = GetPortVec3 ( pActInfo , 0 ) ; <nl> - if ( IsPortActive ( pActInfo , 1 ) ) <nl> - dir = GetPortVec3 ( pActInfo , 1 ) ; <nl> - if ( IsPortActive ( pActInfo , 2 ) ) <nl> - roll = GetPortFloat ( pActInfo , 2 ) ; <nl> - <nl> - if ( IsPortActive ( pActInfo , 3 ) ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , GetPortBool ( pActInfo , 3 ) ) ; <nl> - } <nl> - <nl> - if ( dir . len2 ( ) > 0 . 0f ) <nl> - { <nl> - dir . Normalize ( ) ; <nl> - camera . SetMatrix ( CCamera : : CreateOrientationYPR ( CCamera : : CreateAnglesYPR ( dir , roll ) ) ) ; <nl> - camera . SetPosition ( pos ) ; <nl> - gEnv - > pSystem - > SetViewCamera ( camera ) ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - case eFE_Update : <nl> - { <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , pos ) ; <nl> - ActivateOutput ( pActInfo , 1 , dir ) ; <nl> - ActivateOutput ( pActInfo , 2 , roll ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static const int FLOWGRAPH_SHAKE_ID = 24 ; <nl> <nl> - class CFlowNode_CameraViewShake : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_CameraViewShake ( SActivationInfo * pActInfo ) <nl> - { <nl> - } ; <nl> - <nl> - enum Restriction <nl> - { <nl> - ER_None = 0 , <nl> - ER_NoVehicle , <nl> - ER_InVehicle , <nl> - } ; <nl> - <nl> - enum Inputs <nl> - { <nl> - EIP_Trigger = 0 , <nl> - EIP_Restriction , <nl> - EIP_ViewType , <nl> - EIP_GroundOnly , <nl> - EIP_Angle , <nl> - EIP_Shift , <nl> - EIP_Duration , <nl> - EIP_Frequency , <nl> - EIP_Randomness , <nl> - EIP_Distance , <nl> - EIP_RangeMin , <nl> - EIP_RangeMax , <nl> - / / EIP_Flip , <nl> - } ; <nl> - <nl> - enum ViewType <nl> - { <nl> - VT_FirstPerson = 0 , <nl> - VT_Current = 1 <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Trigger to start shaking " ) ) , <nl> - InputPortConfig < int > ( " Restrict " , ER_None , _HELP ( " Restriction " ) , 0 , _UICONFIG ( " enum_int : None = 0 , NoVehicle = 1 , InVehicle = 2 " ) ) , <nl> - InputPortConfig < int > ( " View " , VT_FirstPerson , _HELP ( " Which view to use . FirstPerson or Current ( might be Trackview ) . " ) , 0 , _UICONFIG ( " enum_int : FirstPerson = 0 , Current = 1 " ) ) , <nl> - InputPortConfig < bool > ( " GroundOnly " , false , _HELP ( " Apply shake only when the player is standing on the ground " ) ) , <nl> - InputPortConfig < Vec3 > ( " Angle " , Vec3 ( ZERO ) , _HELP ( " Shake Angles " ) ) , <nl> - InputPortConfig < Vec3 > ( " Shift " , Vec3 ( ZERO ) , _HELP ( " Shake shifting " ) ) , <nl> - InputPortConfig < float > ( " Duration " , 1 . 0f , _HELP ( " Duration " ) ) , <nl> - InputPortConfig < float > ( " Frequency " , 10 . 0f , _HELP ( " Frequency . Can be changed dynamically . " ) , 0 , _UICONFIG ( " v_min = 1 , v_max = 100 " ) ) , <nl> - InputPortConfig < float > ( " Randomness " , 0 . 1f , _HELP ( " Randomness " ) ) , <nl> - InputPortConfig < float > ( " Distance " , 0 . 0f , _HELP ( " Distance to effect source " ) ) , <nl> - InputPortConfig < float > ( " RangeMin " , 0 . 0f , _HELP ( " Maximum strength effect range " ) ) , <nl> - InputPortConfig < float > ( " RangeMax " , 30 . 0f , _HELP ( " Effect range " ) ) , <nl> - / / InputPortConfig < bool > ( " Flip " , true , _HELP ( " Flip " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . sDescription = _HELP ( " Camera View Shake node " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - if ( ! InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - return ; <nl> - <nl> - const bool bTriggered = IsPortActive ( pActInfo , EIP_Trigger ) ; <nl> - const bool bFreqTriggered = IsPortActive ( pActInfo , EIP_Frequency ) ; <nl> - if ( bTriggered = = false & & bFreqTriggered = = false ) <nl> - return ; <nl> - <nl> - IGameFramework * pGF = gEnv - > pGame - > GetIGameFramework ( ) ; <nl> - IView * pView = 0 ; <nl> - IView * pActiveView = pGF - > GetIViewSystem ( ) - > GetActiveView ( ) ; <nl> - int viewType = GetPortInt ( pActInfo , EIP_ViewType ) ; <nl> - if ( viewType = = VT_FirstPerson ) / / use player ' s view <nl> - { <nl> - IActor * pActor = pGF - > GetClientActor ( ) ; <nl> - if ( pActor = = 0 ) <nl> - return ; <nl> - <nl> - const int restriction = GetPortInt ( pActInfo , EIP_Restriction ) ; <nl> - if ( restriction ! = ER_None ) <nl> - { <nl> - IVehicle * pVehicle = pActor - > GetLinkedVehicle ( ) ; <nl> - if ( restriction = = ER_InVehicle & & pVehicle = = 0 ) <nl> - return ; <nl> - if ( restriction = = ER_NoVehicle & & pVehicle ! = 0 / * & & pVehicle - > GetSeatForPassenger ( entityId ) ! = 0 * / ) <nl> - return ; <nl> - } <nl> - <nl> - EntityId entityId = pActor - > GetEntityId ( ) ; <nl> - pView = pGF - > GetIViewSystem ( ) - > GetViewByEntityId ( entityId ) ; <nl> - } <nl> - else / / active view <nl> - { <nl> - pView = pActiveView ; <nl> - } <nl> - if ( pView = = 0 | | pView ! = pActiveView ) <nl> - return ; <nl> - <nl> - const bool bGroundOnly = GetPortBool ( pActInfo , EIP_GroundOnly ) ; <nl> - Ang3 angles = Ang3 ( DEG2RAD ( GetPortVec3 ( pActInfo , EIP_Angle ) ) ) ; <nl> - Vec3 shift = GetPortVec3 ( pActInfo , EIP_Shift ) ; <nl> - const float duration = GetPortFloat ( pActInfo , EIP_Duration ) ; <nl> - float freq = GetPortFloat ( pActInfo , EIP_Frequency ) ; <nl> - if ( iszero ( freq ) = = false ) <nl> - freq = 1 . 0f / freq ; <nl> - const float randomness = GetPortFloat ( pActInfo , EIP_Randomness ) ; <nl> - static const bool bFlip = true ; / / GetPortBool ( pActInfo , EIP_Flip ) ; <nl> - const bool bUpdateOnly = ! bTriggered & & bFreqTriggered ; / / it ' s an update if and only if Frequency has been changed <nl> - <nl> - const float distance = GetPortFloat ( pActInfo , EIP_Distance ) ; <nl> - const float rangeMin = GetPortFloat ( pActInfo , EIP_RangeMin ) ; <nl> - const float rangeMax = GetPortFloat ( pActInfo , EIP_RangeMax ) ; <nl> - float amount = min ( 1 . f , max ( 0 . f , ( rangeMax - distance ) / ( rangeMax - rangeMin ) ) ) ; <nl> - <nl> - angles * = amount ; <nl> - shift * = amount ; <nl> - <nl> - pView - > SetViewShake ( angles , shift , duration , freq , randomness , FLOWGRAPH_SHAKE_ID , bFlip , bUpdateOnly , bGroundOnly ) ; <nl> - } <nl> - <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_CameraViewShakeEx : public CFlowBaseNode < eNCT_Instanced > <nl> { <nl> class CFlowNode_CameraTransform : public CFlowBaseNode < eNCT_Instanced > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Camera : Camera " , CFlowNode_Camera ) ; <nl> - REGISTER_FLOW_NODE ( " Camera : ViewShake " , CFlowNode_CameraViewShake ) ; <nl> REGISTER_FLOW_NODE ( " Camera : ViewShakeEx " , CFlowNode_CameraViewShakeEx ) ; <nl> REGISTER_FLOW_NODE ( " Camera : View " , CFlowNode_CameraView ) ; <nl> REGISTER_FLOW_NODE ( " Camera : GetTransform " , CFlowNode_CameraTransform ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowConditionNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowConditionNode . cpp <nl> <nl> / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " StdAfx . h " <nl> - # include " FlowConditionNode . h " <nl> - <nl> - void CFlowNode_Condition : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < bool > ( " condition " , _HELP ( " Setting this input to TRUE sends the value [ value ] to the [ true ] port , otherwise to [ false ] " ) ) , <nl> - InputPortConfig_AnyType ( " value " , _HELP ( " Value to direct to a true or false port " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_AnyType ( " true " , _HELP ( " Activated when the condition is true ( passes the value through ) " ) ) , <nl> - OutputPortConfig_AnyType ( " false " , _HELP ( " Activated when the condition is false ( passes the value through ) " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " LEGACY ! Node to route data flow based on a boolean condition . Both inputs trigger the output . \ nLegacy . Use Logic : Condition instead ! " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - void CFlowNode_Condition : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - case eFE_Initialize : <nl> - bool bCondition = GetPortBool ( pActInfo , 0 ) ; <nl> - <nl> - if ( bCondition ) <nl> - ActivateOutput ( pActInfo , 0 , GetPortAny ( pActInfo , 1 ) ) ; <nl> - else <nl> - ActivateOutput ( pActInfo , 1 , GetPortAny ( pActInfo , 1 ) ) ; <nl> - } <nl> - ; <nl> - } ; <nl> + # include " FlowBaseNode . h " <nl> <nl> class CFlowNode_LogicCondition : public CFlowBaseNode < eNCT_Instanced > <nl> { <nl> class CFlowNode_LogicConditionInverse : public CFlowBaseNode < eNCT_Instanced > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Condition " , CFlowNode_Condition ) <nl> REGISTER_FLOW_NODE ( " Logic : Condition " , CFlowNode_LogicCondition ) <nl> REGISTER_FLOW_NODE ( " Logic : ConditionInverse " , CFlowNode_LogicConditionInverse ) <nl> deleted file mode 100644 <nl> index a0bf152ce7 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowConditionNode . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # ifndef __FLOWCONDITIONNODE_H__ <nl> - # define __FLOWCONDITIONNODE_H__ <nl> - <nl> - # pragma once <nl> - <nl> - # include " FlowBaseNode . h " <nl> - <nl> - class CFlowNode_Condition : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_Condition ( SActivationInfo * ) { } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - # endif <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEngineEffectsNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEngineEffectsNodes . cpp <nl> struct SColorCorrection <nl> static void Serialize ( IFlowNode : : SActivationInfo * actInfo , TSerialize ser ) { } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Glow post process settings <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - struct SGlow <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " Enabled " , false , " Enables node " , " Enabled " ) , <nl> - InputPortConfig < bool > ( " Disabled " , true , " Disables node " , " Disabled " ) , <nl> - InputPortConfig < float > ( " Glow_Scale " , 0 . 5f , " Sets overall glow multiplier " , " Final glow multiplier " ) , <nl> - InputPortConfig < float > ( " Glow_ScreenThreshold " , 0 . 5f , " Sets fullscreen glow threshold " , " Screen glow threshold " ) , <nl> - InputPortConfig < float > ( " Glow_ScreenMul " , 0 . 2f , " Sets fullscreen glow multiplier " , " Screen glow multiplier " ) , <nl> - InputPortConfig < Vec3 > ( " clr_Glow_StreaksColor " , Vec3 ( 0 . 8f , 0 . 7f , 1 . 5f ) , 0 , " Streaks color " ) , <nl> - InputPortConfig < float > ( " Glow_StreaksMul " , 3 . 0f , " Sets glow streaks color multiplier " , " Streaks multiplier " ) , <nl> - InputPortConfig < float > ( " Glow_StreaksStretch " , 1 . 0f , " Sets glow streaks stretch amount " , " Streaks stretch " ) , <nl> - InputPortConfig < float > ( " Glow_FlaresMul " , 0 . 25f , " Sets glow lens - flares ( ghost - flares ) multiplier " , " Lens - flares multiplier " ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Misc post process setup " ) ; <nl> - } <nl> - <nl> - static void Disable ( ) <nl> - { <nl> - gEnv - > p3DEngine - > SetPostEffectParam ( " Glow_Scale " , 0 . 5f ) ; <nl> - } <nl> - <nl> - static bool CustomSetData ( const SFlowNodeConfig & config , TBaseNodeClass * pFlowBaseNode , bool bIsEnabled , IFlowNode : : SActivationInfo * pActInfo ) { return false ; } <nl> - static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Filters <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> struct SEffectFrost <nl> static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> } ; <nl> <nl> - struct SEffectCondensation <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " Enabled " , false , " Enables node " , " Enabled " ) , <nl> - InputPortConfig < bool > ( " Disabled " , true , " Disables node " , " Disabled " ) , <nl> - InputPortConfig < float > ( " ScreenCondensation_Amount " , 0 . 0f , " Amount of condensation " , " Amount " ) , <nl> - InputPortConfig < float > ( " ScreenCondensation_CenterAmount " , 1 . 0f , " Amount of condensation at center of screen " , " CenterAmount " ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Condensation effect " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - static void Disable ( ) <nl> - { <nl> - gEnv - > p3DEngine - > SetPostEffectParam ( " ScreenCondensation_Amount " , 0 ) ; <nl> - } <nl> - <nl> - static bool CustomSetData ( const SFlowNodeConfig & config , TBaseNodeClass * pFlowBaseNode , bool bIsEnabled , IFlowNode : : SActivationInfo * pActInfo ) { return false ; } <nl> - static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> - } ; <nl> - <nl> struct SEffectWaterDroplets <nl> { <nl> static void GetConfiguration ( SFlowNodeConfig & config ) <nl> struct SEffectBloodSplats <nl> static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> } ; <nl> <nl> - struct SEffectDistantRain <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " Enabled " , false , " Enables node " , " Enabled " ) , <nl> - InputPortConfig < bool > ( " Disabled " , true , " Disables node " , " Disabled " ) , <nl> - InputPortConfig < float > ( " DistantRain_Amount " , 0 . 0f , " Amount of visible distant rain " , " Amount " ) , <nl> - InputPortConfig < float > ( " DistantRain_Speed " , 1 . 0f , " Distant rain speed multiplier " , " Speed " ) , <nl> - InputPortConfig < float > ( " DistantRain_DistanceScale " , 1 . 0f , " Distant rain distance scale " , " DistanceScale " ) , <nl> - InputPortConfig < Vec3 > ( " clr_DistantRain_Color " , Vec3 ( 1 . 0f , 1 . 0f , 1 . 0f ) , " Sets distance rain color " , " Color " ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Distant rain effect " ) ; <nl> - } <nl> - <nl> - static void Disable ( ) <nl> - { <nl> - gEnv - > p3DEngine - > SetPostEffectParam ( " DistantRain_Amount " , 0 ) ; <nl> - } <nl> - <nl> - static bool CustomSetData ( const SFlowNodeConfig & config , TBaseNodeClass * pFlowBaseNode , bool bIsEnabled , IFlowNode : : SActivationInfo * pActInfo ) { return false ; } <nl> - static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> - } ; <nl> - <nl> struct SEffectDof <nl> { <nl> static void GetConfiguration ( SFlowNodeConfig & config ) <nl> struct SEffect3DHudInterference <nl> } <nl> } ; <nl> <nl> - struct SEffectHUDScratches <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " Enabled " , false , " Enables node " , " Enabled " ) , <nl> - InputPortConfig < bool > ( " Disabled " , true , " Disables node " , " Disabled " ) , <nl> - InputPortConfig < float > ( " Scratches_Strength " , 0 . 0f , " Sets scratches strength " , " Strength " ) , <nl> - InputPortConfig < float > ( " Scratches_Threshold " , 0 . 0f , " Sets scratches threshold " , " Threshold " ) , <nl> - InputPortConfig < float > ( " Scratches_Intensity " , 0 . 7f , " Sets scratches intensity " , " Intensity " ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Scratches on HUD " ) ; <nl> - } <nl> - <nl> - static void Disable ( ) <nl> - { <nl> - gEnv - > p3DEngine - > SetPostEffectParam ( " Scratches_Strength " , 0 ) ; <nl> - } <nl> - <nl> - static bool CustomSetData ( const SFlowNodeConfig & config , TBaseNodeClass * pFlowBaseNode , bool bIsEnabled , IFlowNode : : SActivationInfo * pActInfo ) { return false ; } <nl> - static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> - } ; <nl> - <nl> - struct SHUDHitEffect <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " Enabled " , false , " Enables node " , " Enabled " ) , <nl> - InputPortConfig < bool > ( " Disabled " , true , " Disables node " , " Disabled " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_Amount " , 1 . 0f , " used to control effect activation " , " Amount " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_DisplayTime " , 3 . 0f , " Sets hit effect display time " , " DisplayTime " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_AnimSpeed " , 0 . 01f , " Sets UV animation ( scroll down ) speed " , " AnimSpeed " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_HealthLevel " , 1 . 0f , " Sets player health level [ 0 . . 1 ] " , " HealthLevel " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_HealthNanoOffset " , 0 . 9f , " Sets player health level where nano pattern becomes visible " , " HealthNanoOffset " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_HealthVeinsOffset " , 0 . 6f , " Sets player health level where veins become visible " , " HealthVeinsOffset " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_ColorFadeOffset " , 0 . 4f , " Sets player health level where color fade out " , " ColodeFadeOffset " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_NanoPatternTiling " , 48 . 0f , " Sets UV tiling for nano pattern " , " NanoPatternTiling " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_HitAttenuation " , 0 . 1f , " Sets attenuation of hit effect " , " HitAttenuation " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_HitAttenuationBlur " , 0 . 6f , " Sets blurriness of hit effect attenuation " , " HitAttenuationBlur " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_HitAreaVisibility " , 1 . 0f , " Sets visibility of hit effect " , " HitAreaVisibility " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_CriticalSaturation " , 0 . 2f , " Sets screen color saturation when in critical state " , " CriticalSaturation " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_CriticalBrightness " , 1 . 0f , " Sets screen color brightness when in critical state " , " CriticalBrightness " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_CriticalContrast " , 1 . 0f , " Sets screen color contrast when in critical state " , " CriticalContrast " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_NoiseAmount " , 1 . 0f , " Sets strength of area " , " NoiseAmount " ) , <nl> - <nl> - InputPortConfig < float > ( " HUDHitEffect_ScreenBorderLeft " , 0 . 1f , " Sets screen border on left side " , " ScreenBorderLeft " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_ScreenBorderTop " , 0 . 15f , " Sets screen border on top side " , " ScreenBorderTop " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_ScreenBorderRight " , 0 . 1f , " Sets screen border on right side " , " ScreenBorderRight " ) , <nl> - InputPortConfig < float > ( " HUDHitEffect_ScreenBorderBottom " , 0 . 15f , " Sets screen border on bottom side " , " ScreenBorderBottom " ) , <nl> - <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Hit effect " ) ; <nl> - } <nl> - <nl> - static void Disable ( ) <nl> - { <nl> - / / gEnv - > p3DEngine - > SetPostEffectParam ( " HUDHitEffect_Active " , false ) ; / / error causing <nl> - } <nl> - <nl> - static bool CustomSetData ( const SFlowNodeConfig & config , TBaseNodeClass * pFlowBaseNode , bool bIsEnabled , IFlowNode : : SActivationInfo * pActInfo ) { return false ; } <nl> - static void Serialize ( IFlowNode : : SActivationInfo * pActInfo , TSerialize ser ) { } <nl> - } ; <nl> - <nl> struct SEffectGhosting <nl> { <nl> static void GetConfiguration ( SFlowNodeConfig & config ) <nl> REGISTER_FLOW_NODE_EX ( " Image : ColorCorrection " , CFlowImageNode < SColorCorrection > , <nl> REGISTER_FLOW_NODE_EX ( " Image : FilterBlur " , CFlowImageNode < SFilterBlur > , SFilterBlur ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : FilterRadialBlur " , CFlowImageNode < SFilterRadialBlur > , SFilterRadialBlur ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : FilterSharpen " , CFlowImageNode < SFilterSharpen > , SFilterSharpen ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : ChromaShift " , CFlowImageNode < SFilterChromaShift > , SFilterChromaShift ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : FilterChromaShift " , CFlowImageNode < SFilterChromaShift > , SFilterChromaShift ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectFrost " , CFlowImageNode < SEffectFrost > , SEffectFrost ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : FilterGrain " , CFlowImageNode < SFilterGrain > , SFilterGrain ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : EffectCondensation " , CFlowImageNode < SEffectCondensation > , SEffectCondensation ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectWaterDroplets " , CFlowImageNode < SEffectWaterDroplets > , SEffectWaterDroplets ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectWaterFlow " , CFlowImageNode < SEffectWaterFlow > , SEffectWaterFlow ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectBloodSplats " , CFlowImageNode < SEffectBloodSplats > , SEffectBloodSplats ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectGhosting " , CFlowImageNode < SEffectGhosting > , SEffectGhosting ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : EffectGhostVision " , CFlowImageNode < SEffectGhostVision > , SEffectGhostVision ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : DepthOfField " , CFlowImageNode < SEffectDof > , SEffectDof ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : VolumetricScattering " , CFlowImageNode < SEffectVolumetricScattering > , SEffectVolumetricScattering ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : DirectionalBlur " , CFlowImageNode < SEffectDirectionalBlur > , SEffectDirectionalBlur ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : AlienInterference " , CFlowImageNode < SEffectAlienInterference > , SEffectAlienInterference ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : RainDrops " , CFlowImageNode < SEffectRainDrops > , SEffectRainDrops ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : DistantRain " , CFlowImageNode < SEffectDistantRain > , SEffectDistantRain ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : Glow " , CFlowImageNode < SGlow > , SGlow ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : EffectDepthOfField " , CFlowImageNode < SEffectDof > , SEffectDof ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : EffectVolumetricScattering " , CFlowImageNode < SEffectVolumetricScattering > , SEffectVolumetricScattering ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : FilterDirectionalBlur " , CFlowImageNode < SEffectDirectionalBlur > , SEffectDirectionalBlur ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : EffectAlienInterference " , CFlowImageNode < SEffectAlienInterference > , SEffectAlienInterference ) ; <nl> + REGISTER_FLOW_NODE_EX ( " Image : EffectRainDrops " , CFlowImageNode < SEffectRainDrops > , SEffectRainDrops ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : FilterVisualArtifacts " , CFlowImageNode < SFilterVisualArtifacts > , SFilterVisualArtifacts ) ; <nl> REGISTER_FLOW_NODE_EX ( " Image : 3DHudInterference " , CFlowImageNode < SEffect3DHudInterference > , SEffect3DHudInterference ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : Scratches " , CFlowImageNode < SEffectHUDScratches > , SEffectHUDScratches ) ; <nl> - REGISTER_FLOW_NODE_EX ( " Image : HUDHitEffect " , CFlowImageNode < SHUDHitEffect > , SHUDHitEffect ) ; <nl> REGISTER_FLOW_NODE ( " Image : SetShadowMode " , CFlowNode_SetShadowMode ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEngineNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEngineNodes . cpp <nl> class CFlowNode_Viewport : public CFlowBaseNode < eNCT_Singleton > <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> REGISTER_FLOW_NODE ( " Engine : PortalSwitch " , CFlowNode_PortalSwitch ) ; <nl> - REGISTER_FLOW_NODE ( " Engine : OceanSwitch " , CFlowNode_OceanSwitch ) ; <nl> - REGISTER_FLOW_NODE ( " Engine : SkyboxSwitch " , CFlowNode_SkyboxSwitch ) ; <nl> + REGISTER_FLOW_NODE ( " Environment : OceanSwitch " , CFlowNode_OceanSwitch ) ; <nl> + REGISTER_FLOW_NODE ( " Environment : SkyboxSwitch " , CFlowNode_SkyboxSwitch ) ; <nl> REGISTER_FLOW_NODE ( " Engine : LayerSwitch " , CFlowNode_LayerSwitch ) ; <nl> - REGISTER_FLOW_NODE ( " Engine : SetObjectMaterial " , CFlowNode_SetObjectMaterial ) ; <nl> + REGISTER_FLOW_NODE ( " Material : SetObjectMaterial " , CFlowNode_SetObjectMaterial ) ; <nl> REGISTER_FLOW_NODE ( " Engine : PrecacheArea " , CFlowNode_PrecacheArea ) ; <nl> REGISTER_FLOW_NODE ( " Engine : Viewport " , CFlowNode_Viewport ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEntityNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEntityNode . cpp <nl> class CFlowNode_EntityFaceAt : public CFlowEntityNodeBase <nl> bool m_bIsBlending ; <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for entity material . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_EntityMaterial : public CFlowEntityNodeBase <nl> - { <nl> - public : <nl> - enum EInputs <nl> - { <nl> - IN_SET , <nl> - IN_MATERIAL , <nl> - IN_RESET , <nl> - } ; <nl> - CFlowNode_EntityMaterial ( SActivationInfo * pActInfo ) : CFlowEntityNodeBase ( ) <nl> - { <nl> - m_pEditorMaterial = 0 ; <nl> - m_entityId = ( EntityId ) ( UINT_PTR ) pActInfo - > m_pUserData ; <nl> - / / m_event = ENTITY_EVENT_MATERIAL ; <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { pActInfo - > m_pUserData = ( void * ) ( UINT_PTR ) m_entityId ; return new CFlowNode_EntityMaterial ( pActInfo ) ; } ; <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - / * <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - bool bChangeMat = false ; <nl> - ser . Value ( " changeMat " , bChangeMat ) ; <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity & & bChangeMat ) <nl> - { <nl> - ChangeMat ( pActInfo , pEntity ) ; <nl> - } <nl> - else <nl> - m_pMaterial = 0 ; <nl> - } <nl> - else <nl> - { <nl> - bool bChangeMat = m_pMaterial ! = 0 ; <nl> - ser . Value ( " changeMat " , bChangeMat ) ; <nl> - } <nl> - * / <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Set " , _HELP ( " Trigger to set the material " ) ) , <nl> - InputPortConfig < string > ( " mat_Material " , _HELP ( " Name of material to apply " ) ) , <nl> - InputPortConfig_Void ( " Reset " , _HELP ( " Trigger to reset the original material " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Apply material to the entity " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - CFlowEntityNodeBase : : ProcessEvent ( event , pActInfo ) ; <nl> - <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - / / workaround to the fact that the entity does not clear the material when going back to editor mode , <nl> - / / and to the fact that there is not any special event to signal when its going back to editor mode <nl> - if ( gEnv - > IsEditor ( ) ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity ) <nl> - { <nl> - if ( gEnv - > IsEditing ( ) ) <nl> - m_pEditorMaterial = pEntity - > GetMaterial ( ) ; <nl> - else <nl> - pEntity - > SetMaterial ( m_pEditorMaterial ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - case eFE_PrecacheResources : <nl> - { <nl> - / / Preload target material . <nl> - const string & mtlName = GetPortString ( pActInfo , IN_MATERIAL ) ; <nl> - m_pMaterial = gEnv - > p3DEngine - > GetMaterialManager ( ) - > LoadMaterial ( mtlName . c_str ( ) ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , IN_SET ) ) <nl> - { <nl> - ChangeMat ( pActInfo , pEntity ) ; <nl> - } <nl> - <nl> - if ( IsPortActive ( pActInfo , IN_RESET ) ) <nl> - { <nl> - pEntity - > SetMaterial ( NULL ) ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - void ChangeMat ( SActivationInfo * pActInfo , IEntity * pEntity ) <nl> - { <nl> - const string & mtlName = GetPortString ( pActInfo , IN_MATERIAL ) ; <nl> - _smart_ptr < IMaterial > pMtl = gEnv - > p3DEngine - > GetMaterialManager ( ) - > LoadMaterial ( mtlName . c_str ( ) ) ; <nl> - if ( pMtl ! = NULL ) <nl> - { <nl> - pEntity - > SetMaterial ( pMtl ) ; <nl> - } <nl> - } <nl> - <nl> - void OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) <nl> - { <nl> - / * <nl> - if ( event . event = = ENTITY_EVENT_MATERIAL & & pEntity & & pEntity - > GetId ( ) = = m_entityId ) <nl> - { <nl> - IMaterial * pMat = ( IMaterial * ) event . nParam [ 0 ] ; <nl> - if ( pMat = = 0 | | ( m_pMaterial ! = 0 & & pMat ! = m_pMaterial ) ) <nl> - m_pMaterial = 0 ; <nl> - } <nl> - * / <nl> - } <nl> - <nl> - _smart_ptr < IMaterial > m_pMaterial ; <nl> - _smart_ptr < IMaterial > m_pEditorMaterial ; <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Same than CFlowNode_EntityMaterial , but it does serialize the material change <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_EntityMaterialSerialize : public CFlowNode_EntityMaterial <nl> - { <nl> - public : <nl> - CFlowNode_EntityMaterialSerialize ( SActivationInfo * pActInfo ) : CFlowNode_EntityMaterial ( pActInfo ) <nl> - { <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { pActInfo - > m_pUserData = ( void * ) ( UINT_PTR ) m_entityId ; return new CFlowNode_EntityMaterialSerialize ( pActInfo ) ; } ; <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity ) <nl> - { <nl> - string matSavedName ; <nl> - ser . Value ( " material " , matSavedName ) ; <nl> - <nl> - if ( matSavedName . empty ( ) ) <nl> - pEntity - > SetMaterial ( NULL ) ; <nl> - else <nl> - { <nl> - IMaterial * pMatCurr = pEntity - > GetMaterial ( ) ; <nl> - if ( ! pMatCurr | | matSavedName ! = pMatCurr - > GetName ( ) ) <nl> - { <nl> - IMaterial * pMtl = gEnv - > p3DEngine - > GetMaterialManager ( ) - > LoadMaterial ( matSavedName . c_str ( ) ) ; <nl> - pEntity - > SetMaterial ( pMtl ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - else <nl> - { <nl> - string matName ; <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity ) <nl> - { <nl> - IMaterial * pMat = pEntity - > GetMaterial ( ) ; <nl> - if ( pMat ) <nl> - matName = pMat - > GetName ( ) ; <nl> - } <nl> - ser . Value ( " material " , matName ) ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Set " , _HELP ( " Trigger to set the material " ) ) , <nl> - InputPortConfig < string > ( " material " , _HELP ( " Name of material to apply " ) ) , <nl> - InputPortConfig_Void ( " Reset " , _HELP ( " Trigger to reset the original material " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Apply material to the entity . The change is serialized " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_BroadcastEntityEvent : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> class CFlowNode_EntityDetachThis : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for getting the player [ deprecated ] . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_EntityGetPlayer : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_EntityGetPlayer ( SActivationInfo * pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " Player " , _HELP ( " Outputs Id of the current player " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Retrieve current player entity - Deprecated Use Game : LocalPlayer ! " ) ; <nl> - config . pInputPorts = 0 ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IActor * pActor = CCryAction : : GetCryAction ( ) - > GetClientActor ( ) ; <nl> - if ( pActor ) <nl> - { <nl> - IEntity * pLocalPlayer = pActor - > GetEntity ( ) ; <nl> - if ( pLocalPlayer ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , pLocalPlayer - > GetId ( ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Flow node for beaming an entity <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNodeRenderParams : public CFlowEntityNodeBase <nl> } <nl> } ; <nl> <nl> - # if 0 / / replace by CFlowNodeMaterialShaderParam <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for setting entity render parameters ( opacity , glow , motionblur , etc ) <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNodeMaterialParam : public CFlowEntityNodeBase <nl> + class CFlowNodeCharAttachmentMaterialShaderParam : public CFlowBaseNode < eNCT_Instanced > <nl> { <nl> public : <nl> - CFlowNodeMaterialParam ( SActivationInfo * pActInfo ) : CFlowEntityNodeBase ( ) <nl> + CFlowNodeCharAttachmentMaterialShaderParam ( SActivationInfo * pActInfo ) : m_pMaterial ( 0 ) , m_bFailedCloningMaterial ( false ) <nl> { <nl> - m_entityId = ( EntityId ) ( UINT_PTR ) pActInfo - > m_pUserData ; <nl> } <nl> <nl> virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> { <nl> - pActInfo - > m_pUserData = ( void * ) ( UINT_PTR ) m_entityId ; <nl> - return new CFlowNodeMaterialParam ( pActInfo ) ; <nl> + return new CFlowNodeCharAttachmentMaterialShaderParam ( pActInfo ) ; <nl> } ; <nl> <nl> + void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> + { <nl> + if ( ser . IsReading ( ) ) <nl> + { <nl> + / / new chance on load <nl> + m_bFailedCloningMaterial = false ; <nl> + } <nl> + } <nl> + <nl> enum EInputPorts <nl> { <nl> - EIP_Get = 0 , <nl> - EIP_Slot , <nl> + EIP_CharSlot = 0 , <nl> + EIP_Attachment , <nl> + EIP_SetMaterial , <nl> + EIP_ForcedMaterial , <nl> EIP_SubMtlId , <nl> + EIP_Get , <nl> EIP_ParamFloat , <nl> EIP_Float , <nl> EIP_ParamColor , <nl> EIP_Color , <nl> + EIP_StartFromDefaultMaterial , <nl> } ; <nl> <nl> enum EOutputPorts <nl> class CFlowNodeMaterialParam : public CFlowEntityNodeBase <nl> virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> { <nl> static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> - InputPortConfig < int > ( " Slot " , 0 , _HELP ( " Material Slot " ) ) , <nl> - InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> - InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " enum_string : Glow = glow , Shininess = shininess , Alpha = alpha , Opacity = opacity " ) ) , <nl> - InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> - InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " enum_string : Diffuse = diffuse , Specular = specular , Emissive = emissive " ) ) , <nl> - InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> + InputPortConfig < int > ( " CharSlot " , 0 , _HELP ( " Character Slot within Entity " ) ) , <nl> + InputPortConfig < string > ( " Attachment " , _HELP ( " Attachment " ) , 0 , _UICONFIG ( " dt = attachment , ref_entity = entityId " ) ) , <nl> + InputPortConfig_Void ( " SetMaterial " , _HELP ( " Trigger to force setting a material [ ForcedMaterial ] " ) ) , <nl> + InputPortConfig < string > ( " ForcedMaterial " , _HELP ( " Material " ) , 0 , _UICONFIG ( " dt = mat " ) ) , <nl> + InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> + InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> + InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamcharatt , charslot_ref = CharSlot , attachment_ref = Attachment , sub_ref = SubMtlId , param = float " ) ) , <nl> + InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> + InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamcharatt , charslot_ref = CharSlot , attachment_ref = Attachment , sub_ref = SubMtlId , param = vec " ) ) , <nl> + InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> + InputPortConfig < bool > ( " StartFromDefaultMaterial " , true , _HELP ( " Choose whether to start again from the attachment ' s default material or apply on top of a possibly already modified material " ) ) , <nl> { 0 } <nl> } ; <nl> <nl> class CFlowNodeMaterialParam : public CFlowEntityNodeBase <nl> { 0 } <nl> } ; <nl> <nl> - config . sDescription = _HELP ( " Set / Get Material Parameters " ) ; <nl> + config . sDescription = _HELP ( " [ CUTSCENE ONLY ] Set ShaderParams of Character Attachments . " ) ; <nl> config . nFlags | = EFLN_TARGET_ENTITY ; <nl> config . pInputPorts = in_config ; <nl> config . pOutputPorts = out_config ; <nl> class CFlowNodeMaterialParam : public CFlowEntityNodeBase <nl> <nl> virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> { <nl> - CFlowEntityNodeBase : : ProcessEvent ( event , pActInfo ) ; <nl> - <nl> if ( event ! = eFE_Activate ) <nl> return ; <nl> <nl> const bool bGet = IsPortActive ( pActInfo , EIP_Get ) ; <nl> const bool bSetFloat = IsPortActive ( pActInfo , EIP_Float ) ; <nl> const bool bSetColor = IsPortActive ( pActInfo , EIP_Color ) ; <nl> + const bool bSetMaterial = IsPortActive ( pActInfo , EIP_SetMaterial ) ; <nl> <nl> - if ( ! bGet & & ! bSetFloat & & ! bSetColor ) <nl> + if ( ! bGet & & ! bSetFloat & & ! bSetColor & & ! bSetMaterial ) <nl> return ; <nl> <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> + IEntity * pEntity = pActInfo - > pEntity ; <nl> if ( pEntity = = 0 ) <nl> return ; <nl> <nl> - IEntityRenderProxy * pRenderProxy = ( IEntityRenderProxy * ) pEntity - > GetProxy ( ENTITY_PROXY_RENDER ) ; <nl> - if ( pRenderProxy = = 0 ) <nl> + const int charSlot = GetPortInt ( pActInfo , EIP_CharSlot ) ; <nl> + ICharacterInstance * pChar = pActInfo - > pEntity - > GetCharacter ( charSlot ) ; <nl> + if ( pChar = = 0 ) <nl> + return ; <nl> + <nl> + IAttachmentManager * pAttMgr = pChar - > GetIAttachmentManager ( ) ; <nl> + if ( pAttMgr = = 0 ) <nl> + return ; <nl> + <nl> + const string & attachment = GetPortString ( pActInfo , EIP_Attachment ) ; <nl> + IAttachment * pAttachment = pAttMgr - > GetInterfaceByName ( attachment . c_str ( ) ) ; <nl> + if ( pAttachment = = 0 ) <nl> + { <nl> + GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> + return ; <nl> + } <nl> + <nl> + IAttachmentObject * pAttachObj = pAttachment - > GetIAttachmentObject ( ) ; <nl> + if ( pAttachObj = = 0 ) <nl> + { <nl> + GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access AttachmentObject at Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> return ; <nl> + } <nl> + <nl> + IMaterialManager * pMatMgr = gEnv - > p3DEngine - > GetMaterialManager ( ) ; <nl> + if ( bSetMaterial ) <nl> + { <nl> + const string & matName = GetPortString ( pActInfo , EIP_ForcedMaterial ) ; <nl> + if ( true / * m_pMaterial = = 0 | | matName ! = m_pMaterial - > GetName ( ) * / ) / / always reload the mat atm <nl> + { <nl> + m_pMaterial = pMatMgr - > LoadMaterial ( matName . c_str ( ) ) ; <nl> + if ( m_pMaterial ) <nl> + { <nl> + m_pMaterial = pMatMgr - > CloneMultiMaterial ( m_pMaterial ) ; <nl> + m_bFailedCloningMaterial = false ; <nl> + } <nl> + else <nl> + { <nl> + m_bFailedCloningMaterial = true ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( m_pMaterial = = 0 & & m_bFailedCloningMaterial = = false ) <nl> + { <nl> + const bool bStartFromDefaultMaterial = GetPortBool ( pActInfo , EIP_StartFromDefaultMaterial ) ; <nl> + IMaterial * pOldMtl = bStartFromDefaultMaterial ? pAttachObj - > GetBaseMaterial ( ) : pAttachObj - > GetReplacementMaterial ( ) ; <nl> + if ( pOldMtl ) <nl> + { <nl> + m_pMaterial = pMatMgr - > CloneMultiMaterial ( pOldMtl ) ; <nl> + m_bFailedCloningMaterial = false ; <nl> + } <nl> + else <nl> + { <nl> + m_bFailedCloningMaterial = true ; <nl> + } <nl> + } <nl> <nl> - const int & slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - IMaterial * pMtl = pRenderProxy - > GetRenderMaterial ( slot ) ; <nl> + IMaterial * pMtl = m_pMaterial ; <nl> if ( pMtl = = 0 ) <nl> { <nl> - GameWarning ( " [ flow ] CFlowNodeSetMaterialParam : Entity ' % s ' [ % d ] has no material at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , slot ) ; <nl> + GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access material at Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> return ; <nl> } <nl> <nl> class CFlowNodeMaterialParam : public CFlowEntityNodeBase <nl> pMtl = pMtl - > GetSafeSubMtl ( subMtlId ) ; <nl> if ( pMtl = = 0 ) <nl> { <nl> - GameWarning ( " [ flow ] CFlowNodeSetMaterialParam : Entity ' % s ' [ % d ] has no sub - material % d at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , subMtlId , slot ) ; <nl> + GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Material ' % s ' has no sub - material % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , m_pMaterial - > GetName ( ) , subMtlId ) ; <nl> return ; <nl> } <nl> + <nl> + / / set our material <nl> + pAttachObj - > SetReplacementMaterial ( pMtl ) ; <nl> + <nl> const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> const string & paramNameVec3 = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> <nl> - float floatValue = 0 . 0f ; <nl> - Vec3 vec3Value = Vec3 ( ZERO ) ; <nl> - if ( bSetFloat ) <nl> - { <nl> - floatValue = GetPortFloat ( pActInfo , EIP_Float ) ; <nl> - pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , false ) ; <nl> - } <nl> - if ( bSetColor ) <nl> - { <nl> - vec3Value = GetPortVec3 ( pActInfo , EIP_Color ) ; <nl> - pMtl - > SetGetMaterialParamVec3 ( paramNameVec3 , vec3Value , false ) ; <nl> - } <nl> - if ( bGet ) <nl> - { <nl> - if ( pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , true ) ) <nl> - ActivateOutput ( pActInfo , EOP_Float , floatValue ) ; <nl> - if ( pMtl - > SetGetMaterialParamVec3 ( paramNameVec3 , vec3Value , true ) ) <nl> - { <nl> - ActivateOutput ( pActInfo , EOP_Color , vec3Value ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - # endif <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for setting entity render parameters ( opacity , glow , motionblur , etc ) <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class CFlowNodeEntityMaterialShaderParam : public CFlowEntityNodeBase <nl> - { <nl> - public : <nl> - CFlowNodeEntityMaterialShaderParam ( SActivationInfo * pActInfo ) : CFlowEntityNodeBase ( ) <nl> - { <nl> - m_entityId = ( EntityId ) ( UINT_PTR ) pActInfo - > m_pUserData ; <nl> - m_anyChangeDone = false ; <nl> - m_pMaterial = NULL ; <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - pActInfo - > m_pUserData = ( void * ) ( UINT_PTR ) m_entityId ; <nl> - return new CFlowNodeEntityMaterialShaderParam ( pActInfo ) ; <nl> - } ; <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Get = 0 , <nl> - EIP_Slot , <nl> - EIP_SubMtlId , <nl> - EIP_ParamFloat , <nl> - EIP_Float , <nl> - EIP_ParamColor , <nl> - EIP_Color , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Float = 0 , <nl> - EOP_Color , <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / this serialize is * NOT * perfect . If any of the following inputs : " slot , submtlid , paramFloat , paramColor " do change and the node is triggered more than once with different values for them , the serializing wont be 100 % correct . <nl> - / / / this does not happens in crysis2 , so is good enough for now . <nl> - / / / to make it perfect , either the materials should be serialized at engine level , or either we would need to create an intermediate module to handle changes on materials from game side , <nl> - / / / make the flownodes to use that module instead of the materials directly , and serialize the changes there instead of in the flownodes . <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - / / we do assume that those inputs never change , which is ok for crysis2 , but of course is not totally right <nl> - const int slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - const int subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameColor = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - ser . Value ( " m_anyChangeDone " , m_anyChangeDone ) ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmm <nl> - if ( ser . IsWriting ( ) ) <nl> - { <nl> - IMaterial * pSubMtl ; <nl> - IRenderShaderResources * pRendShaderRes ; <nl> - if ( ! ObtainMaterialPtrs ( slot , subMtlId , false , pSubMtl , pRendShaderRes ) ) <nl> - return ; <nl> - DynArrayRef < SShaderParam > & shaderParams = pRendShaderRes - > GetParameters ( ) ; <nl> - <nl> - if ( ! paramNameFloat . empty ( ) ) <nl> - { <nl> - float floatValue = 0 ; <nl> - ReadFloatValueFromMat ( pSubMtl , pRendShaderRes , paramNameFloat , floatValue ) ; <nl> - ser . Value ( " floatValue " , floatValue ) ; <nl> - } <nl> - <nl> - if ( ! paramNameColor . empty ( ) ) <nl> - { <nl> - Vec3 colorValue ( ZERO ) ; <nl> - ReadColorValueFromMat ( pSubMtl , pRendShaderRes , paramNameColor , colorValue ) ; <nl> - ser . Value ( " colorValue " , colorValue ) ; <nl> - } <nl> - } <nl> - <nl> - / / mmmmmmmmmmmmmmm - <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - / / if there was no change done , we still need to set values to the material , in case it was changed after the savegame . <nl> - / / But in that case , we dont need to create a clone , we just use the current material <nl> - bool cloneMaterial = m_anyChangeDone ; <nl> - IMaterial * pSubMtl ; <nl> - IRenderShaderResources * pRendShaderRes ; <nl> - if ( ! ObtainMaterialPtrs ( slot , subMtlId , cloneMaterial , pSubMtl , pRendShaderRes ) ) <nl> - return ; <nl> - DynArrayRef < SShaderParam > & shaderParams = pRendShaderRes - > GetParameters ( ) ; <nl> - <nl> - / / if we * potentially * can change one of them , we have to restore them , even if we in theory didnt change any . that is why this checks the name of the parameters , instead of actualy changedone <nl> - { <nl> - bool bUpdateShaderConstants = false ; <nl> - if ( ! paramNameFloat . empty ( ) ) <nl> - { <nl> - float floatValue ; <nl> - ser . Value ( " floatValue " , floatValue ) ; <nl> - if ( pSubMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Float = floatValue ; <nl> - SShaderParam : : SetParam ( paramNameFloat , & shaderParams , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( ! paramNameColor . empty ( ) ) <nl> - { <nl> - Vec3 colorValue ; <nl> - ser . Value ( " colorValue " , colorValue ) ; <nl> - if ( pSubMtl - > SetGetMaterialParamVec3 ( paramNameColor , colorValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Color [ 0 ] = colorValue [ 0 ] ; <nl> - val . m_Color [ 1 ] = colorValue [ 1 ] ; <nl> - val . m_Color [ 2 ] = colorValue [ 2 ] ; <nl> - val . m_Color [ 3 ] = 1 . 0f ; <nl> - SShaderParam : : SetParam ( paramNameColor , & shaderParams , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - <nl> - if ( bUpdateShaderConstants ) <nl> - { <nl> - const SShaderItem & shaderItem = pSubMtl - > GetShaderItem ( ) ; <nl> - shaderItem . m_pShaderResources - > UpdateConstants ( shaderItem . m_pShader ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> - InputPortConfig < int > ( " Slot " , 0 , _HELP ( " Material Slot " ) ) , <nl> - InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> - InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamslot , slot_ref = Slot , sub_ref = SubMtlId , param = float " ) ) , <nl> - InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> - InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamslot , slot_ref = Slot , sub_ref = SubMtlId , param = vec " ) ) , <nl> - InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < float > ( " ValueFloat " , _HELP ( " Current Float Value " ) ) , <nl> - OutputPortConfig < Vec3 > ( " ValueColor " , _HELP ( " Current Color Value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Set / Get Entity ' s Material Shader Parameters " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - CFlowEntityNodeBase : : ProcessEvent ( event , pActInfo ) ; <nl> - <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - const bool bGet = IsPortActive ( pActInfo , EIP_Get ) ; <nl> - const bool bSetFloat = IsPortActive ( pActInfo , EIP_Float ) ; <nl> - const bool bSetColor = IsPortActive ( pActInfo , EIP_Color ) ; <nl> - const int slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - const int subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameColor = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - if ( ! bGet & & ! bSetFloat & & ! bSetColor ) <nl> - return ; <nl> - <nl> - bool cloneMaterial = bSetFloat | | bSetColor ; <nl> - IMaterial * pSubMtl ; <nl> - IRenderShaderResources * pRendShaderRes ; <nl> - <nl> - if ( ! ObtainMaterialPtrs ( slot , subMtlId , cloneMaterial , pSubMtl , pRendShaderRes ) ) <nl> - return ; <nl> - <nl> - DynArrayRef < SShaderParam > & shaderParams = pRendShaderRes - > GetParameters ( ) ; <nl> - <nl> - / / . . . . . . . . . . sets . . . . . . . <nl> - { <nl> - bool bUpdateShaderConstants = false ; <nl> - if ( bSetFloat ) <nl> - { <nl> - m_anyChangeDone = true ; <nl> - float floatValue = GetPortFloat ( pActInfo , EIP_Float ) ; <nl> - if ( pSubMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Float = floatValue ; <nl> - SShaderParam : : SetParam ( paramNameFloat , & shaderParams , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( bSetColor ) <nl> - { <nl> - m_anyChangeDone = true ; <nl> - Vec3 colorValue = GetPortVec3 ( pActInfo , EIP_Color ) ; <nl> - if ( pSubMtl - > SetGetMaterialParamVec3 ( paramNameColor , colorValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Color [ 0 ] = colorValue [ 0 ] ; <nl> - val . m_Color [ 1 ] = colorValue [ 1 ] ; <nl> - val . m_Color [ 2 ] = colorValue [ 2 ] ; <nl> - val . m_Color [ 3 ] = 1 . 0f ; <nl> - SShaderParam : : SetParam ( paramNameColor , & shaderParams , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - <nl> - if ( bUpdateShaderConstants ) <nl> - { <nl> - const SShaderItem & shaderItem = pSubMtl - > GetShaderItem ( ) ; <nl> - shaderItem . m_pShaderResources - > UpdateConstants ( shaderItem . m_pShader ) ; <nl> - } <nl> - } <nl> - <nl> - / / . . . . . . . . get <nl> - if ( bGet ) <nl> - { <nl> - float floatValue ; <nl> - if ( ReadFloatValueFromMat ( pSubMtl , pRendShaderRes , paramNameFloat , floatValue ) ) <nl> - ActivateOutput ( pActInfo , EOP_Float , floatValue ) ; <nl> - <nl> - Vec3 colorValue ; <nl> - if ( ReadColorValueFromMat ( pSubMtl , pRendShaderRes , paramNameColor , colorValue ) ) <nl> - ActivateOutput ( pActInfo , EOP_Color , colorValue ) ; <nl> - } <nl> - } <nl> - <nl> - bool ReadFloatValueFromMat ( IMaterial * pSubMtl , IRenderShaderResources * pRendShaderRes , const char * paramName , float & floatValue ) <nl> - { <nl> - if ( pSubMtl - > SetGetMaterialParamFloat ( paramName , floatValue , true ) ) <nl> - return true ; <nl> - <nl> - DynArrayRef < SShaderParam > & shaderParams = pRendShaderRes - > GetParameters ( ) ; <nl> - <nl> - for ( int i = 0 ; i < shaderParams . size ( ) ; + + i ) <nl> - { <nl> - SShaderParam & param = shaderParams [ i ] ; <nl> - if ( stricmp ( param . m_Name , paramName ) = = 0 ) <nl> - { <nl> - floatValue = 0 . 0f ; <nl> - switch ( param . m_Type ) <nl> - { <nl> - case eType_BOOL : <nl> - floatValue = param . m_Value . m_Bool ; <nl> - break ; <nl> - case eType_SHORT : <nl> - floatValue = param . m_Value . m_Short ; <nl> - break ; <nl> - case eType_INT : <nl> - floatValue = ( float ) param . m_Value . m_Int ; <nl> - break ; <nl> - case eType_FLOAT : <nl> - floatValue = param . m_Value . m_Float ; <nl> - break ; <nl> - } <nl> - return true ; <nl> - } <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - bool ReadColorValueFromMat ( IMaterial * pSubMtl , IRenderShaderResources * pRendShaderRes , const char * paramName , Vec3 & colorValue ) <nl> - { <nl> - if ( pSubMtl - > SetGetMaterialParamVec3 ( paramName , colorValue , true ) ) <nl> - return true ; <nl> - <nl> - DynArrayRef < SShaderParam > & shaderParams = pRendShaderRes - > GetParameters ( ) ; <nl> - <nl> - for ( int i = 0 ; i < shaderParams . size ( ) ; + + i ) <nl> - { <nl> - SShaderParam & param = shaderParams [ i ] ; <nl> - if ( stricmp ( param . m_Name , paramName ) = = 0 ) <nl> - { <nl> - colorValue . Set ( 0 , 0 , 0 ) ; <nl> - if ( param . m_Type = = eType_VECTOR ) <nl> - { <nl> - colorValue . Set ( param . m_Value . m_Vector [ 0 ] , param . m_Value . m_Vector [ 1 ] , param . m_Value . m_Vector [ 2 ] ) ; <nl> - } <nl> - if ( param . m_Type = = eType_FCOLOR ) <nl> - { <nl> - colorValue . Set ( param . m_Value . m_Color [ 0 ] , param . m_Value . m_Color [ 1 ] , param . m_Value . m_Color [ 2 ] ) ; <nl> - } <nl> - return true ; <nl> - } <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - void OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - bool ObtainMaterialPtrs ( int slot , int subMtlId , bool cloneMaterial , IMaterial * & pSubMtl , IRenderShaderResources * & pRenderShaderRes ) <nl> - { <nl> - const bool RETFAIL = false ; <nl> - const bool RETOK = true ; <nl> - <nl> - IEntity * pEntity = GetEntity ( ) ; <nl> - if ( pEntity = = 0 ) <nl> - return RETFAIL ; <nl> - <nl> - IEntityRenderProxy * pRenderProxy = ( IEntityRenderProxy * ) pEntity - > GetProxy ( ENTITY_PROXY_RENDER ) ; <nl> - if ( pRenderProxy = = 0 ) <nl> - return RETFAIL ; <nl> - <nl> - IMaterial * pMaterial = pRenderProxy - > GetRenderMaterial ( slot ) ; <nl> - if ( pMaterial = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeEntityMaterialShaderParam : Entity ' % s ' [ % d ] has no material at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , slot ) ; <nl> - return RETFAIL ; <nl> - } <nl> - <nl> - if ( cloneMaterial & & m_pMaterial ! = pMaterial ) <nl> - { <nl> - pMaterial = gEnv - > p3DEngine - > GetMaterialManager ( ) - > CloneMultiMaterial ( pMaterial ) ; <nl> - if ( ! pMaterial ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeEntityMaterialShaderParam : Entity ' % s ' [ % d ] Can ' t clone material at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , slot ) ; <nl> - return RETFAIL ; <nl> - } <nl> - pRenderProxy - > SetSlotMaterial ( slot , pMaterial ) ; <nl> - m_pMaterial = pMaterial ; <nl> - } <nl> - <nl> - pSubMtl = pMaterial - > GetSafeSubMtl ( subMtlId ) ; <nl> - if ( pSubMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeEntityMaterialShaderParam : Entity ' % s ' [ % d ] has no sub - material % d at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , subMtlId , slot ) ; <nl> - return RETFAIL ; <nl> - } <nl> - <nl> - const SShaderItem & shaderItem = pSubMtl - > GetShaderItem ( ) ; <nl> - pRenderShaderRes = shaderItem . m_pShaderResources ; <nl> - if ( ! pRenderShaderRes ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeEntityMaterialShaderParam : Entity ' % s ' [ % d ] Material ' s ' % s ' sub - material [ % d ] ' % s ' has not shader - resources " , GetEntity ( ) - > GetName ( ) , GetEntity ( ) - > GetId ( ) , pMaterial - > GetName ( ) , subMtlId , pSubMtl - > GetName ( ) ) ; <nl> - return RETFAIL ; <nl> - } <nl> - <nl> - return RETOK ; <nl> - } <nl> - <nl> - protected : <nl> - bool m_anyChangeDone ; <nl> - _smart_ptr < IMaterial > m_pMaterial ; / / this is only used to know if we need to clone or not . And is in purpose not reseted on flow initialize , and also not serialized . <nl> - / / the situation is : <nl> - / / if we already cloned the material , it will stay cloned even if we load a checkpoint previous to the point where the change happened , so we dont need to clone it again . <nl> - / / On the other side , if we are doing a ' resumegame " , we need to clone the material even if we already cloned it when the checkpoint happened . <nl> - / / By not serializing or reseting this member , we cover those cases correctly <nl> - } ; <nl> - <nl> - class CFlowNodeCharAttachmentMaterialShaderParam : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - CFlowNodeCharAttachmentMaterialShaderParam ( SActivationInfo * pActInfo ) : m_pMaterial ( 0 ) , m_bFailedCloningMaterial ( false ) <nl> - { <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNodeCharAttachmentMaterialShaderParam ( pActInfo ) ; <nl> - } ; <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - / / new chance on load <nl> - m_bFailedCloningMaterial = false ; <nl> - } <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_CharSlot = 0 , <nl> - EIP_Attachment , <nl> - EIP_SetMaterial , <nl> - EIP_ForcedMaterial , <nl> - EIP_SubMtlId , <nl> - EIP_Get , <nl> - EIP_ParamFloat , <nl> - EIP_Float , <nl> - EIP_ParamColor , <nl> - EIP_Color , <nl> - EIP_StartFromDefaultMaterial , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Float = 0 , <nl> - EOP_Color , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < int > ( " CharSlot " , 0 , _HELP ( " Character Slot within Entity " ) ) , <nl> - InputPortConfig < string > ( " Attachment " , _HELP ( " Attachment " ) , 0 , _UICONFIG ( " dt = attachment , ref_entity = entityId " ) ) , <nl> - InputPortConfig_Void ( " SetMaterial " , _HELP ( " Trigger to force setting a material [ ForcedMaterial ] " ) ) , <nl> - InputPortConfig < string > ( " ForcedMaterial " , _HELP ( " Material " ) , 0 , _UICONFIG ( " dt = mat " ) ) , <nl> - InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> - InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> - InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamcharatt , charslot_ref = CharSlot , attachment_ref = Attachment , sub_ref = SubMtlId , param = float " ) ) , <nl> - InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> - InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamcharatt , charslot_ref = CharSlot , attachment_ref = Attachment , sub_ref = SubMtlId , param = vec " ) ) , <nl> - InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> - InputPortConfig < bool > ( " StartFromDefaultMaterial " , true , _HELP ( " Choose whether to start again from the attachment ' s default material or apply on top of a possibly already modified material " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < float > ( " ValueFloat " , _HELP ( " Current Float Value " ) ) , <nl> - OutputPortConfig < Vec3 > ( " ValueColor " , _HELP ( " Current Color Value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " [ CUTSCENE ONLY ] Set ShaderParams of Character Attachments . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - const bool bGet = IsPortActive ( pActInfo , EIP_Get ) ; <nl> - const bool bSetFloat = IsPortActive ( pActInfo , EIP_Float ) ; <nl> - const bool bSetColor = IsPortActive ( pActInfo , EIP_Color ) ; <nl> - const bool bSetMaterial = IsPortActive ( pActInfo , EIP_SetMaterial ) ; <nl> - <nl> - if ( ! bGet & & ! bSetFloat & & ! bSetColor & & ! bSetMaterial ) <nl> - return ; <nl> - <nl> - IEntity * pEntity = pActInfo - > pEntity ; <nl> - if ( pEntity = = 0 ) <nl> - return ; <nl> - <nl> - const int charSlot = GetPortInt ( pActInfo , EIP_CharSlot ) ; <nl> - ICharacterInstance * pChar = pActInfo - > pEntity - > GetCharacter ( charSlot ) ; <nl> - if ( pChar = = 0 ) <nl> - return ; <nl> - <nl> - IAttachmentManager * pAttMgr = pChar - > GetIAttachmentManager ( ) ; <nl> - if ( pAttMgr = = 0 ) <nl> - return ; <nl> - <nl> - const string & attachment = GetPortString ( pActInfo , EIP_Attachment ) ; <nl> - IAttachment * pAttachment = pAttMgr - > GetInterfaceByName ( attachment . c_str ( ) ) ; <nl> - if ( pAttachment = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> - return ; <nl> - } <nl> - <nl> - IAttachmentObject * pAttachObj = pAttachment - > GetIAttachmentObject ( ) ; <nl> - if ( pAttachObj = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access AttachmentObject at Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> - return ; <nl> - } <nl> - <nl> - IMaterialManager * pMatMgr = gEnv - > p3DEngine - > GetMaterialManager ( ) ; <nl> - if ( bSetMaterial ) <nl> - { <nl> - const string & matName = GetPortString ( pActInfo , EIP_ForcedMaterial ) ; <nl> - if ( true / * m_pMaterial = = 0 | | matName ! = m_pMaterial - > GetName ( ) * / ) / / always reload the mat atm <nl> - { <nl> - m_pMaterial = pMatMgr - > LoadMaterial ( matName . c_str ( ) ) ; <nl> - if ( m_pMaterial ) <nl> - { <nl> - m_pMaterial = pMatMgr - > CloneMultiMaterial ( m_pMaterial ) ; <nl> - m_bFailedCloningMaterial = false ; <nl> - } <nl> - else <nl> - { <nl> - m_bFailedCloningMaterial = true ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( m_pMaterial = = 0 & & m_bFailedCloningMaterial = = false ) <nl> - { <nl> - const bool bStartFromDefaultMaterial = GetPortBool ( pActInfo , EIP_StartFromDefaultMaterial ) ; <nl> - IMaterial * pOldMtl = bStartFromDefaultMaterial ? pAttachObj - > GetBaseMaterial ( ) : pAttachObj - > GetReplacementMaterial ( ) ; <nl> - if ( pOldMtl ) <nl> - { <nl> - m_pMaterial = pMatMgr - > CloneMultiMaterial ( pOldMtl ) ; <nl> - m_bFailedCloningMaterial = false ; <nl> - } <nl> - else <nl> - { <nl> - m_bFailedCloningMaterial = true ; <nl> - } <nl> - } <nl> - <nl> - IMaterial * pMtl = m_pMaterial ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Cannot access material at Attachment ' % s ' [ CharSlot = % d ] " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , attachment . c_str ( ) , charSlot ) ; <nl> - return ; <nl> - } <nl> - <nl> - const int & subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - pMtl = pMtl - > GetSafeSubMtl ( subMtlId ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Material ' % s ' has no sub - material % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , m_pMaterial - > GetName ( ) , subMtlId ) ; <nl> - return ; <nl> - } <nl> - <nl> - / / set our material <nl> - pAttachObj - > SetReplacementMaterial ( pMtl ) ; <nl> - <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameVec3 = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - const SShaderItem & shaderItem = pMtl - > GetShaderItem ( ) ; <nl> - IRenderShaderResources * pRendRes = shaderItem . m_pShaderResources ; <nl> - if ( pRendRes = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Material ' % s ' ( sub = % d ) at Attachment ' % s ' [ CharSlot = % d ] has no render resources " , <nl> - pEntity - > GetName ( ) , pEntity - > GetId ( ) , pMtl - > GetName ( ) , subMtlId , attachment . c_str ( ) , charSlot ) ; <nl> - return ; <nl> - } <nl> - DynArrayRef < SShaderParam > & params = pRendRes - > GetParameters ( ) ; / / pShader - > GetPublicParams ( ) ; <nl> - <nl> - bool bUpdateShaderConstants = false ; <nl> - float floatValue = 0 . 0f ; <nl> - Vec3 vec3Value = Vec3 ( ZERO ) ; <nl> - if ( bSetFloat ) <nl> - { <nl> - floatValue = GetPortFloat ( pActInfo , EIP_Float ) ; <nl> - if ( pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Float = floatValue ; <nl> - SShaderParam : : SetParam ( paramNameFloat , & params , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( bSetColor ) <nl> - { <nl> - vec3Value = GetPortVec3 ( pActInfo , EIP_Color ) ; <nl> - if ( pMtl - > SetGetMaterialParamVec3 ( paramNameVec3 , vec3Value , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Color [ 0 ] = vec3Value [ 0 ] ; <nl> - val . m_Color [ 1 ] = vec3Value [ 1 ] ; <nl> - val . m_Color [ 2 ] = vec3Value [ 2 ] ; <nl> - val . m_Color [ 3 ] = 1 . 0f ; <nl> - SShaderParam : : SetParam ( paramNameVec3 , & params , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( bUpdateShaderConstants ) <nl> - { <nl> - shaderItem . m_pShaderResources - > UpdateConstants ( shaderItem . m_pShader ) ; <nl> - } <nl> - if ( bGet ) <nl> - { <nl> - if ( pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , true ) ) <nl> - ActivateOutput ( pActInfo , EOP_Float , floatValue ) ; <nl> - if ( pMtl - > SetGetMaterialParamVec3 ( paramNameVec3 , vec3Value , true ) ) <nl> - ActivateOutput ( pActInfo , EOP_Color , vec3Value ) ; <nl> - <nl> - for ( int i = 0 ; i < params . size ( ) ; + + i ) <nl> - { <nl> - SShaderParam & param = params [ i ] ; <nl> - if ( stricmp ( param . m_Name , paramNameFloat ) = = 0 ) <nl> - { <nl> - float val = 0 . 0f ; <nl> - switch ( param . m_Type ) <nl> - { <nl> - case eType_BOOL : <nl> - val = param . m_Value . m_Bool ; <nl> - break ; <nl> - case eType_SHORT : <nl> - val = param . m_Value . m_Short ; <nl> - break ; <nl> - case eType_INT : <nl> - val = ( float ) param . m_Value . m_Int ; <nl> - break ; <nl> - case eType_FLOAT : <nl> - val = param . m_Value . m_Float ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Float , val ) ; <nl> - } <nl> - if ( stricmp ( param . m_Name , paramNameVec3 ) = = 0 ) <nl> - { <nl> - Vec3 val ( ZERO ) ; <nl> - if ( param . m_Type = = eType_VECTOR ) <nl> - { <nl> - val . Set ( param . m_Value . m_Vector [ 0 ] , param . m_Value . m_Vector [ 1 ] , param . m_Value . m_Vector [ 2 ] ) ; <nl> - } <nl> - if ( param . m_Type = = eType_FCOLOR ) <nl> - { <nl> - val . Set ( param . m_Value . m_Color [ 0 ] , param . m_Value . m_Color [ 1 ] , param . m_Value . m_Color [ 2 ] ) ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Color , val ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - _smart_ptr < IMaterial > m_pMaterial ; <nl> - bool m_bFailedCloningMaterial ; <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for cloning an entity ' s material <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNodeEntityCloneMaterialOld : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNodeEntityCloneMaterialOld ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Clone = 0 , <nl> - EIP_Reset , <nl> - EIP_Slot , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Cloned = 0 , <nl> - EOP_Reset <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Clone " , _HELP ( " Trigger to clone material " ) ) , <nl> - InputPortConfig_Void ( " Reset " , _HELP ( " Trigger to reset material " ) ) , <nl> - InputPortConfig < int > ( " Slot " , 0 , _HELP ( " Material Slot " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_Void ( " Cloned " , _HELP ( " Triggered when cloned . " ) ) , <nl> - OutputPortConfig_Void ( " Reset " , _HELP ( " Triggered when reset . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Clone an Entity ' s Material and Reset it back to original . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - const int slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - UnApplyMaterial ( pActInfo - > pEntity , slot ) ; <nl> - } <nl> - break ; <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , EIP_Reset ) ) <nl> - { <nl> - const int slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - UnApplyMaterial ( pActInfo - > pEntity , slot ) ; <nl> - ActivateOutput ( pActInfo , EOP_Reset , true ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , EIP_Clone ) ) <nl> - { <nl> - const int slot = GetPortInt ( pActInfo , EIP_Slot ) ; <nl> - UnApplyMaterial ( pActInfo - > pEntity , slot ) ; <nl> - CloneAndApplyMaterial ( pActInfo - > pEntity , slot ) ; <nl> - ActivateOutput ( pActInfo , EOP_Cloned , true ) ; <nl> - } <nl> - } <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - void UnApplyMaterial ( IEntity * pEntity , int slot ) <nl> - { <nl> - if ( pEntity = = 0 ) <nl> - return ; <nl> - IEntityRenderProxy * pRenderProxy = ( IEntityRenderProxy * ) pEntity - > GetProxy ( ENTITY_PROXY_RENDER ) ; <nl> - if ( pRenderProxy = = 0 ) <nl> - return ; <nl> - pRenderProxy - > SetSlotMaterial ( slot , 0 ) ; <nl> - } <nl> - <nl> - void CloneAndApplyMaterial ( IEntity * pEntity , int slot ) <nl> - { <nl> - if ( pEntity = = 0 ) <nl> - return ; <nl> - <nl> - IEntityRenderProxy * pRenderProxy = ( IEntityRenderProxy * ) pEntity - > GetProxy ( ENTITY_PROXY_RENDER ) ; <nl> - if ( pRenderProxy = = 0 ) <nl> - return ; <nl> - <nl> - IMaterial * pMtl = pRenderProxy - > GetSlotMaterial ( slot ) ; <nl> - if ( pMtl ) <nl> - return ; <nl> - <nl> - pMtl = pRenderProxy - > GetRenderMaterial ( slot ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeEntityCloneMaterial : Entity ' % s ' [ % d ] has no material at slot % d " , pEntity - > GetName ( ) , pEntity - > GetId ( ) , slot ) ; <nl> - return ; <nl> - } <nl> - <nl> - pMtl = gEnv - > p3DEngine - > GetMaterialManager ( ) - > CloneMultiMaterial ( pMtl ) ; <nl> - pRenderProxy - > SetSlotMaterial ( slot , pMtl ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for setting entity render parameters ( opacity , glow , motionblur , etc ) <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNodeMaterialShaderParam : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNodeMaterialShaderParam ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Get = 0 , <nl> - EIP_Name , <nl> - EIP_SubMtlId , <nl> - EIP_ParamFloat , <nl> - EIP_Float , <nl> - EIP_ParamColor , <nl> - EIP_Color , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Float = 0 , <nl> - EOP_Color , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> - InputPortConfig < string > ( " mat_Material " , _HELP ( " Material Name " ) ) , <nl> - InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> - InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamname , name_ref = mat_Material , sub_ref = SubMtlId , param = float " ) ) , <nl> - InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> - InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamname , name_ref = mat_Material , sub_ref = SubMtlId , param = vec " ) ) , <nl> - InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < float > ( " ValueFloat " , _HELP ( " Current Float Value " ) ) , <nl> - OutputPortConfig < Vec3 > ( " ValueColor " , _HELP ( " Current Color Value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Set / Get Material ' s Shader Parameters " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - const bool bGet = IsPortActive ( pActInfo , EIP_Get ) ; <nl> - const bool bSetFloat = IsPortActive ( pActInfo , EIP_Float ) ; <nl> - const bool bSetColor = IsPortActive ( pActInfo , EIP_Color ) ; <nl> - <nl> - if ( ! bGet & & ! bSetFloat & & ! bSetColor ) <nl> - return ; <nl> - <nl> - const string & matName = GetPortString ( pActInfo , EIP_Name ) ; <nl> - IMaterial * pMtl = gEnv - > p3DEngine - > GetMaterialManager ( ) - > FindMaterial ( matName ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialParam : Material ' % s ' not found . " , matName . c_str ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> - const int & subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - pMtl = pMtl - > GetSafeSubMtl ( subMtlId ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialParam : Material ' % s ' has no sub - material % d " , matName . c_str ( ) , subMtlId ) ; <nl> - return ; <nl> - } <nl> - <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameVec3 = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - const SShaderItem & shaderItem = pMtl - > GetShaderItem ( ) ; <nl> - IRenderShaderResources * pRendRes = shaderItem . m_pShaderResources ; <nl> - if ( pRendRes = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialParam : Material ' % s ' ( submtl % d ) has no shader - resources . " , matName . c_str ( ) , subMtlId ) ; <nl> - return ; <nl> - } <nl> - DynArrayRef < SShaderParam > & params = pRendRes - > GetParameters ( ) ; / / pShader - > GetPublicParams ( ) ; <nl> - <nl> - bool bUpdateShaderConstants = false ; <nl> + const SShaderItem & shaderItem = pMtl - > GetShaderItem ( ) ; <nl> + IRenderShaderResources * pRendRes = shaderItem . m_pShaderResources ; <nl> + if ( pRendRes = = 0 ) <nl> + { <nl> + GameWarning ( " [ flow ] CFlowNodeCharAttachmentMaterialShaderParam : Entity ' % s ' [ % d ] Material ' % s ' ( sub = % d ) at Attachment ' % s ' [ CharSlot = % d ] has no render resources " , <nl> + pEntity - > GetName ( ) , pEntity - > GetId ( ) , pMtl - > GetName ( ) , subMtlId , attachment . c_str ( ) , charSlot ) ; <nl> + return ; <nl> + } <nl> + DynArrayRef < SShaderParam > & params = pRendRes - > GetParameters ( ) ; / / pShader - > GetPublicParams ( ) ; <nl> + <nl> + bool bUpdateShaderConstants = false ; <nl> float floatValue = 0 . 0f ; <nl> Vec3 vec3Value = Vec3 ( ZERO ) ; <nl> if ( bSetFloat ) <nl> class CFlowNodeMaterialShaderParam : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> shaderItem . m_pShaderResources - > UpdateConstants ( shaderItem . m_pShader ) ; <nl> } <nl> - <nl> if ( bGet ) <nl> { <nl> if ( pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , true ) ) <nl> class CFlowNodeMaterialShaderParam : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> s - > Add ( * this ) ; <nl> } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for setting entity render parameters ( opacity , glow , motionblur , etc ) . Same than CFlowNodeMaterialShaderParam , but it serializes the changes <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNodeMaterialShaderParamSerialize : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNodeMaterialShaderParamSerialize ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Get = 0 , <nl> - EIP_Name , <nl> - EIP_SubMtlId , <nl> - EIP_ParamFloat , <nl> - EIP_Float , <nl> - EIP_ParamColor , <nl> - EIP_Color , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Float = 0 , <nl> - EOP_Color , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Get " , _HELP ( " Trigger to get current value " ) ) , <nl> - InputPortConfig < string > ( " mat_Material " , _HELP ( " Material Name " ) ) , <nl> - InputPortConfig < int > ( " SubMtlId " , 0 , _HELP ( " Sub Material Id " ) ) , <nl> - InputPortConfig < string > ( " ParamFloat " , _HELP ( " Float Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamname , name_ref = mat_Material , sub_ref = SubMtlId , param = float " ) ) , <nl> - InputPortConfig < float > ( " ValueFloat " , 0 . 0f , _HELP ( " Trigger to set Float value " ) ) , <nl> - InputPortConfig < string > ( " ParamColor " , _HELP ( " Color Parameter to be set / get " ) , 0 , _UICONFIG ( " dt = matparamname , name_ref = mat_Material , sub_ref = SubMtlId , param = vec " ) ) , <nl> - InputPortConfig < Vec3 > ( " color_ValueColor " , _HELP ( " Trigger to set Color value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < float > ( " ValueFloat " , _HELP ( " Current Float Value " ) ) , <nl> - OutputPortConfig < Vec3 > ( " ValueColor " , _HELP ( " Current Color Value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Set / Get Material ' s Shader Parameters , with ' Set ' serialization " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - if ( ser . IsWriting ( ) ) <nl> - { <nl> - bool validFloat = false ; <nl> - bool validColor = false ; <nl> - float floatValue = 0 ; <nl> - Vec3 colorValue ( 0 . f , 0 . f , 0 . f ) ; <nl> - <nl> - GetValues ( pActInfo , floatValue , colorValue , validFloat , validColor ) ; <nl> - ser . Value ( " validFloat " , validFloat ) ; <nl> - ser . Value ( " validColor " , validColor ) ; <nl> - ser . Value ( " floatValue " , floatValue ) ; <nl> - ser . Value ( " colorValue " , colorValue ) ; <nl> - } <nl> - <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - bool validFloat = false ; <nl> - bool validColor = false ; <nl> - float floatValue = 0 ; <nl> - Vec3 colorValue ( 0 . f , 0 . f , 0 . f ) ; <nl> - <nl> - ser . Value ( " validFloat " , validFloat ) ; <nl> - ser . Value ( " validColor " , validColor ) ; <nl> - ser . Value ( " floatValue " , floatValue ) ; <nl> - ser . Value ( " colorValue " , colorValue ) ; <nl> - <nl> - SetValues ( pActInfo , validFloat , validColor , floatValue , colorValue ) ; <nl> - } <nl> - } <nl> - <nl> - IMaterial * ObtainMaterial ( SActivationInfo * pActInfo ) <nl> - { <nl> - const string & matName = GetPortString ( pActInfo , EIP_Name ) ; <nl> - IMaterial * pMtl = gEnv - > p3DEngine - > GetMaterialManager ( ) - > FindMaterial ( matName ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialShaderParamSerialize : Material ' % s ' not found . " , matName . c_str ( ) ) ; <nl> - return NULL ; <nl> - } <nl> - <nl> - const int & subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - pMtl = pMtl - > GetSafeSubMtl ( subMtlId ) ; <nl> - if ( pMtl = = 0 ) <nl> - { <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialShaderParamSerialize : Material ' % s ' has no sub - material % d " , matName . c_str ( ) , subMtlId ) ; <nl> - return NULL ; <nl> - } <nl> - <nl> - return pMtl ; <nl> - } <nl> - <nl> - IRenderShaderResources * ObtainRendRes ( SActivationInfo * pActInfo , IMaterial * pMtl ) <nl> - { <nl> - assert ( pMtl ) ; <nl> - const SShaderItem & shaderItem = pMtl - > GetShaderItem ( ) ; <nl> - IRenderShaderResources * pRendRes = shaderItem . m_pShaderResources ; <nl> - if ( pRendRes = = 0 ) <nl> - { <nl> - const string & matName = GetPortString ( pActInfo , EIP_Name ) ; <nl> - const int & subMtlId = GetPortInt ( pActInfo , EIP_SubMtlId ) ; <nl> - GameWarning ( " [ flow ] CFlowNodeMaterialShaderParamSerialize : Material ' % s ' ( submtl % d ) has no shader - resources . " , matName . c_str ( ) , subMtlId ) ; <nl> - } <nl> - return pRendRes ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - const bool bGet = IsPortActive ( pActInfo , EIP_Get ) ; <nl> - const bool bSetFloat = IsPortActive ( pActInfo , EIP_Float ) ; <nl> - const bool bSetColor = IsPortActive ( pActInfo , EIP_Color ) ; <nl> - <nl> - if ( ! bGet & & ! bSetFloat & & ! bSetColor ) <nl> - return ; <nl> - <nl> - if ( bSetFloat | | bSetColor ) <nl> - { <nl> - float floatValue = GetPortFloat ( pActInfo , EIP_Float ) ; <nl> - Vec3 colorValue = GetPortVec3 ( pActInfo , EIP_Color ) ; <nl> - <nl> - SetValues ( pActInfo , bSetFloat , bSetColor , floatValue , colorValue ) ; <nl> - } <nl> - <nl> - if ( bGet ) <nl> - { <nl> - bool validFloat = false ; <nl> - bool validColor = false ; <nl> - float floatValue = 0 ; <nl> - Vec3 colorValue ( 0 . f , 0 . f , 0 . f ) ; <nl> - <nl> - GetValues ( pActInfo , floatValue , colorValue , validFloat , validColor ) ; <nl> - <nl> - if ( validFloat ) <nl> - ActivateOutput ( pActInfo , EOP_Float , floatValue ) ; <nl> - if ( validColor ) <nl> - ActivateOutput ( pActInfo , EOP_Color , colorValue ) ; <nl> - } <nl> - } <nl> - <nl> - void GetValues ( SActivationInfo * pActInfo , float & floatValue , Vec3 & colorValue , bool & validFloat , bool & validColor ) <nl> - { <nl> - validFloat = false ; <nl> - validColor = false ; <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameColor = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - IMaterial * pMtl = ObtainMaterial ( pActInfo ) ; <nl> - if ( ! pMtl ) <nl> - return ; <nl> - IRenderShaderResources * pRendRes = ObtainRendRes ( pActInfo , pMtl ) ; <nl> - if ( ! pRendRes ) <nl> - return ; <nl> - DynArrayRef < SShaderParam > & params = pRendRes - > GetParameters ( ) ; <nl> - <nl> - validFloat = pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , true ) ; <nl> - validColor = pMtl - > SetGetMaterialParamVec3 ( paramNameColor , colorValue , true ) ; <nl> - <nl> - if ( ! validFloat ) <nl> - { <nl> - for ( int i = 0 ; i < params . size ( ) ; + + i ) <nl> - { <nl> - SShaderParam & param = params [ i ] ; <nl> - if ( stricmp ( param . m_Name , paramNameFloat ) = = 0 ) <nl> - { <nl> - switch ( param . m_Type ) <nl> - { <nl> - case eType_BOOL : <nl> - floatValue = param . m_Value . m_Bool ; <nl> - validFloat = true ; <nl> - break ; <nl> - case eType_SHORT : <nl> - floatValue = param . m_Value . m_Short ; <nl> - validFloat = true ; <nl> - break ; <nl> - case eType_INT : <nl> - floatValue = ( float ) param . m_Value . m_Int ; <nl> - validFloat = true ; <nl> - break ; <nl> - case eType_FLOAT : <nl> - floatValue = param . m_Value . m_Float ; <nl> - validFloat = true ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( ! validColor ) <nl> - { <nl> - for ( int i = 0 ; i < params . size ( ) ; + + i ) <nl> - { <nl> - SShaderParam & param = params [ i ] ; <nl> - <nl> - if ( stricmp ( param . m_Name , paramNameColor ) = = 0 ) <nl> - { <nl> - if ( param . m_Type = = eType_VECTOR ) <nl> - { <nl> - colorValue . Set ( param . m_Value . m_Vector [ 0 ] , param . m_Value . m_Vector [ 1 ] , param . m_Value . m_Vector [ 2 ] ) ; <nl> - validColor = true ; <nl> - } <nl> - if ( param . m_Type = = eType_FCOLOR ) <nl> - { <nl> - colorValue . Set ( param . m_Value . m_Color [ 0 ] , param . m_Value . m_Color [ 1 ] , param . m_Value . m_Color [ 2 ] ) ; <nl> - validColor = true ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void SetValues ( SActivationInfo * pActInfo , bool bSetFloat , bool bSetColor , float floatValue , Vec3 & colorValue ) <nl> - { <nl> - IMaterial * pMtl = ObtainMaterial ( pActInfo ) ; <nl> - if ( ! pMtl ) <nl> - return ; <nl> - <nl> - IRenderShaderResources * pRendRes = ObtainRendRes ( pActInfo , pMtl ) ; <nl> - if ( ! pRendRes ) <nl> - return ; <nl> - DynArrayRef < SShaderParam > & params = pRendRes - > GetParameters ( ) ; <nl> - const SShaderItem & shaderItem = pMtl - > GetShaderItem ( ) ; <nl> - <nl> - const string & paramNameFloat = GetPortString ( pActInfo , EIP_ParamFloat ) ; <nl> - const string & paramNameColor = GetPortString ( pActInfo , EIP_ParamColor ) ; <nl> - <nl> - bool bUpdateShaderConstants = false ; <nl> - if ( bSetFloat ) <nl> - { <nl> - if ( pMtl - > SetGetMaterialParamFloat ( paramNameFloat , floatValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Float = floatValue ; <nl> - SShaderParam : : SetParam ( paramNameFloat , & params , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( bSetColor ) <nl> - { <nl> - if ( pMtl - > SetGetMaterialParamVec3 ( paramNameColor , colorValue , false ) = = false ) <nl> - { <nl> - UParamVal val ; <nl> - val . m_Color [ 0 ] = colorValue [ 0 ] ; <nl> - val . m_Color [ 1 ] = colorValue [ 1 ] ; <nl> - val . m_Color [ 2 ] = colorValue [ 2 ] ; <nl> - val . m_Color [ 3 ] = 1 . 0f ; <nl> - SShaderParam : : SetParam ( paramNameColor , & params , val ) ; <nl> - bUpdateShaderConstants = true ; <nl> - } <nl> - } <nl> - if ( bUpdateShaderConstants ) <nl> - { <nl> - shaderItem . m_pShaderResources - > UpdateConstants ( shaderItem . m_pShader ) ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Flow node for setting entity material layers . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_EntityMaterialLayer : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_EntityMaterialLayer ( SActivationInfo * pActInfo ) { } <nl> - <nl> - enum INPUTS <nl> - { <nl> - EIP_Enable = 0 , <nl> - EIP_Disable , <nl> - EIP_Layer <nl> - } ; <nl> - <nl> - enum OUTPUTS <nl> - { <nl> - EOP_Done = 0 , <nl> - } ; <nl> - <nl> - static const char * GetUIConfig ( ) <nl> - { <nl> - static char layers [ 128 ] ; <nl> - if ( ! layers [ 0 ] ) <nl> - { <nl> - / / cry_sprintf ( layers , " enum_int : Frozen = % d , Wet = % d , Dirt = % d , Burned = % d " , MTL_LAYER_FROZEN , MTL_LAYER_WET , MTL_LAYER_DIRT , MTL_LAYER_BURNED ) ; <nl> - cry_sprintf ( layers , " enum_int : Frozen = % d , Wet = % d , Cloak = % d , DynamicFrozen = % d " , MTL_LAYER_FROZEN , MTL_LAYER_WET , MTL_LAYER_CLOAK , MTL_LAYER_DYNAMICFROZEN ) ; <nl> - } <nl> - return & layers [ 0 ] ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Trigger to enable the layer " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Trigger to disable the layer " ) ) , <nl> - InputPortConfig < int > ( " Layer " , MTL_LAYER_FROZEN , _HELP ( " Layer to be enabled or disabled " ) , 0 , _UICONFIG ( GetUIConfig ( ) ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_Void ( " Done " , _HELP ( " Triggered when done " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Enable / Disable Entity Material Layers " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - IEntity * pEntity = pActInfo - > pEntity ; <nl> - if ( pEntity = = 0 ) <nl> - return ; <nl> - const bool bEnable = IsPortActive ( pActInfo , EIP_Enable ) ; <nl> - const bool bDisable = IsPortActive ( pActInfo , EIP_Disable ) ; <nl> - if ( bEnable | | bDisable ) <nl> - { <nl> - IEntityRenderProxy * pRenderProxy = ( IEntityRenderProxy * ) pEntity - > GetProxy ( ENTITY_PROXY_RENDER ) ; <nl> - if ( pRenderProxy ) <nl> - { <nl> - uint8 layer = ( uint8 ) GetPortInt ( pActInfo , EIP_Layer ) ; <nl> - uint8 activeLayers = pRenderProxy - > GetMaterialLayersMask ( ) ; <nl> - if ( bEnable ) <nl> - activeLayers | = layer ; <nl> - else <nl> - activeLayers & = ~ layer ; <nl> - <nl> - pRenderProxy - > SetMaterialLayersMask ( activeLayers ) ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Done , true ) ; <nl> - } <nl> - } <nl> <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> + _smart_ptr < IMaterial > m_pMaterial ; <nl> + bool m_bFailedCloningMaterial ; <nl> } ; <nl> <nl> class CFlowNode_SpawnEntity : public CFlowBaseNode < eNCT_Singleton > <nl> REGISTER_FLOW_NODE ( " Entity : BroadcastEvent " , CFlowNode_BroadcastEntityEvent ) <nl> REGISTER_FLOW_NODE ( " Entity : EntityId " , CFlowNode_EntityId ) <nl> REGISTER_FLOW_NODE ( " Entity : EntityInfo " , CFlowNode_EntityGetInfo ) <nl> REGISTER_FLOW_NODE ( " Entity : ParentId " , CFlowNode_ParentId ) <nl> - REGISTER_FLOW_NODE ( " Entity : SetProperty " , CFlowNode_EntitySetProperty ) <nl> - REGISTER_FLOW_NODE ( " Entity : GetProperty " , CFlowNode_EntityGetProperty ) <nl> - REGISTER_FLOW_NODE ( " Entity : Material " , CFlowNode_EntityMaterial ) <nl> - REGISTER_FLOW_NODE ( " Entity : MaterialSerialize " , CFlowNode_EntityMaterialSerialize ) <nl> - REGISTER_FLOW_NODE ( " Entity : MaterialLayer " , CFlowNode_EntityMaterialLayer ) <nl> - REGISTER_FLOW_NODE ( " Entity : AttachChild " , CFlowNode_EntityAttachChild ) <nl> - REGISTER_FLOW_NODE ( " Entity : DetachThis " , CFlowNode_EntityDetachThis ) <nl> - REGISTER_FLOW_NODE ( " Entity : GetPlayer " , CFlowNode_EntityGetPlayer ) <nl> + REGISTER_FLOW_NODE ( " Entity : PropertySet " , CFlowNode_EntitySetProperty ) <nl> + REGISTER_FLOW_NODE ( " Entity : PropertyGet " , CFlowNode_EntityGetProperty ) <nl> + REGISTER_FLOW_NODE ( " Entity : ChildAttach " , CFlowNode_EntityAttachChild ) <nl> + REGISTER_FLOW_NODE ( " Entity : ChildDetach " , CFlowNode_EntityDetachThis ) <nl> REGISTER_FLOW_NODE ( " Entity : BeamEntity " , CFlowNode_BeamEntity ) <nl> REGISTER_FLOW_NODE ( " Entity : RenderParams " , CFlowNodeRenderParams ) <nl> - / / REGISTER_FLOW_NODE ( " Entity : MaterialParam " , CFlowNodeMaterialParam ) <nl> - REGISTER_FLOW_NODE ( " Entity : MaterialParam " , CFlowNodeEntityMaterialShaderParam ) <nl> - REGISTER_FLOW_NODE ( " Entity : MaterialClone " , CFlowNodeEntityCloneMaterialOld ) <nl> REGISTER_FLOW_NODE ( " entity : TagPoint " , CFlowNode_EntityTagpoint ) <nl> REGISTER_FLOW_NODE ( " Entity : CheckDistance " , CFlowNode_EntityCheckDistance ) <nl> REGISTER_FLOW_NODE ( " Entity : CheckProjection " , CFlowNode_EntityCheckProjection ) <nl> REGISTER_FLOW_NODE ( " Entity : EntityFaceAt " , CFlowNode_EntityFaceAt ) <nl> <nl> REGISTER_FLOW_NODE ( " Entity : FindEntityByName " , CFlowNode_FindEntityByName ) ; <nl> <nl> - / / engine based <nl> - REGISTER_FLOW_NODE ( " Engine : MaterialParam " , CFlowNodeMaterialShaderParam ) <nl> - REGISTER_FLOW_NODE ( " Environment : MaterialParamSerialize " , CFlowNodeMaterialShaderParamSerialize ) <nl> - <nl> / / spawn nodes <nl> REGISTER_FLOW_NODE ( " Entity : Spawn " , CFlowNode_SpawnEntity ) ; <nl> REGISTER_FLOW_NODE ( " Entity : SpawnArchetype " , CFlowNode_SpawnArchetypeEntity ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEnvironmentNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowEnvironmentNodes . cpp <nl> <nl> # include < Cry3DEngine / ITimeOfDay . h > <nl> # include < CrySystem / IStreamEngine . h > <nl> <nl> - class CFlowNode_EnvLighting : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_EnvLighting ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - eIP_TimeOfDay = 0 , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - eOP_SunDirection = 0 , <nl> - } ; <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < float > ( " TimeOfDay " ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " SunDirection " ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , eIP_TimeOfDay ) ) <nl> - Update ( pActInfo ) ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - void Update ( SActivationInfo * pActInfo ) <nl> - { <nl> - float timeOfDay = GetPortFloat ( pActInfo , eIP_TimeOfDay ) ; <nl> - float longitude = timeOfDay / 24 . 0f * gf_PI * 2 . 0f ; <nl> - float latitude = - 45 . 0f * gf_PI / 180 . 0f ; <nl> - Vec3 sunDir ( sinf ( longitude ) * cosf ( latitude ) , sinf ( longitude ) * sinf ( latitude ) , cosf ( longitude ) ) ; <nl> - <nl> - CRY_ASSERT ( ! " Direct call of I3DEngine : : SetSunDir ( ) is not supported anymore . Use Time of day featue instead . " ) ; <nl> - / / gEnv - > p3DEngine - > SetSunDir ( sunDir ) ; <nl> - ActivateOutput ( pActInfo , eOP_SunDirection , sunDir ) ; <nl> - } <nl> - } ; <nl> - <nl> class CFlowNode_EnvMoonDirection : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> public : <nl> class CFlowNode_PresetSwitch : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Environment : Lighting " , CFlowNode_EnvLighting ) ; <nl> REGISTER_FLOW_NODE ( " Environment : MoonDirection " , CFlowNode_EnvMoonDirection ) ; <nl> REGISTER_FLOW_NODE ( " Environment : Sun " , CFlowNode_EnvSun ) ; <nl> REGISTER_FLOW_NODE ( " Time : TimeOfDayTransitionTrigger " , CFlowNode_TimeOfDayTransitionTrigger ) <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowExecuteStringNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowExecuteStringNode . cpp <nl> class CFlowNode_ExecuteString : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " System : ExecuteString " , CFlowNode_ExecuteString ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : ExecuteString " , CFlowNode_ExecuteString ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowGameNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowGameNodes . cpp <nl> class CFlowPlayer : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - class CFlowAllPlayers : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowAllPlayers ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " update " , _HELP ( " Retriggers the entity id . Required for multiplayer " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig < EntityId > ( " entityId1 " , _HELP ( " Player 1 " ) ) , <nl> - OutputPortConfig < EntityId > ( " entityId2 " , _HELP ( " Player 2 " ) ) , <nl> - OutputPortConfig < EntityId > ( " entityId3 " , _HELP ( " Player 3 " ) ) , <nl> - OutputPortConfig < EntityId > ( " entityId4 " , _HELP ( " Player 4 " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Outputs the players entity id . . " ) ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - case eFE_Activate : <nl> - { <nl> - IActorSystem * pActorSystem = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) ; <nl> - IActorIteratorPtr actorIt = pActorSystem - > CreateActorIterator ( ) ; <nl> - int iNumPlayers = 0 ; <nl> - IActor * pActor = actorIt - > Next ( ) ; <nl> - while ( iNumPlayers < 4 & & pActor ) <nl> - { <nl> - if ( pActor - > GetChannelId ( ) ) <nl> - { <nl> - ActivateOutput ( pActInfo , iNumPlayers , pActor - > GetEntityId ( ) ) ; <nl> - + + iNumPlayers ; <nl> - } <nl> - <nl> - pActor = actorIt - > Next ( ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - class CFlowIsPlayer : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowIsPlayer ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " update " , _HELP ( " Retriggers the output . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig < bool > ( " isPlayer " , _HELP ( " Entity is a player ( local or multiplayer client ) . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . sDescription = _HELP ( " Outputs whether an entity is a player . " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - case eFE_Activate : <nl> - { <nl> - if ( ! pActInfo - > pEntity ) <nl> - ActivateOutput ( pActInfo , 0 , false ) ; <nl> - else <nl> - { <nl> - CRY_ASSERT ( gEnv - > pGame ) ; <nl> - IActor * pActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) - > GetActor ( pActInfo - > pEntity - > GetId ( ) ) ; <nl> - if ( pActor & & pActor - > GetChannelId ( ) ! = 0 ) / / is this a client ? <nl> - ActivateOutput ( pActInfo , 0 , true ) ; <nl> - else <nl> - ActivateOutput ( pActInfo , 0 , false ) ; <nl> - } <nl> - <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> void SendFlowHitToEntity ( EntityId targetId , EntityId shooterId , int damage , const Vec3 & pos ) <nl> class CFlowIsLevelOfType : public CFlowBaseNode < eNCT_Instanced > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Game : LocalPlayer " , CFlowPlayer ) ; <nl> - REGISTER_FLOW_NODE ( " Game : AllPlayers " , CFlowAllPlayers ) ; <nl> - REGISTER_FLOW_NODE ( " Game : IsPlayer " , CFlowIsPlayer ) ; <nl> - REGISTER_FLOW_NODE ( " Game : DamageActor " , CFlowDamageActor ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : LocalPlayer " , CFlowPlayer ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : Damage " , CFlowDamageActor ) ; <nl> REGISTER_FLOW_NODE ( " Entity : Damage " , CFlowDamageEntity ) <nl> - REGISTER_FLOW_NODE ( " Game : ActorGrabObject " , CFlowActorGrabObject ) ; <nl> - REGISTER_FLOW_NODE ( " Game : ActorGetHealth " , CFlowActorGetHealth ) ; <nl> - REGISTER_FLOW_NODE ( " Game : ActorSetHealth " , CFlowActorSetHealth ) ; <nl> - REGISTER_FLOW_NODE ( " Game : ActorCheckHealth " , CFlowActorCheckHealth ) ; <nl> - REGISTER_FLOW_NODE ( " Game : GameObjectEvent " , CFlowGameObjectEvent ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : GrabObject " , CFlowActorGrabObject ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : HealthGet " , CFlowActorGetHealth ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : HealthSet " , CFlowActorSetHealth ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : HealthCheck " , CFlowActorCheckHealth ) ; <nl> + REGISTER_FLOW_NODE ( " Game : ObjectEvent " , CFlowGameObjectEvent ) ; <nl> REGISTER_FLOW_NODE ( " Game : GetSupportedGameRulesForMap " , CFlowGetSupportedGameRulesForMap ) ; <nl> REGISTER_FLOW_NODE ( " Game : GetEntityState " , CFlowGetStateOfEntity ) ; <nl> REGISTER_FLOW_NODE ( " Game : IsLevelOfType " , CFlowIsLevelOfType ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowHUDNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowHUDNodes . cpp <nl> <nl> # include < PersistantDebug . h > <nl> # include " CryActionCVars . h " <nl> <nl> - / / display an instruction message in the HUD <nl> - class CFlowNode_DisplayInstructionMessage : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_DisplayInstructionMessage ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig in_ports [ ] = <nl> - { <nl> - / / a " void " port that can be pulsed to display the message <nl> - InputPortConfig_Void ( " display " , _HELP ( " Connect event here to display the message " ) ) , <nl> - / / this string port is the message that should be displayed <nl> - InputPortConfig < string > ( " text_message " , _HELP ( " Display this message on the hud " ) ) , <nl> - / / this floating point input port is how long the message should be displayed <nl> - InputPortConfig < float > ( " displayTime " , 10 . 0f , _HELP ( " How long to display message " ) ) , <nl> - { 0 } <nl> - } ; <nl> - / / we set pointers in " config " here to specify which input and output ports the node contains <nl> - config . pInputPorts = in_ports ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - / / if the event is activate , and the 0th port ( " display " ) has been activated , <nl> - / / display the message <nl> - if ( event = = eFE_Activate & & IsPortActive ( pActInfo , 0 ) ) <nl> - { <nl> - if ( CFlowSystemCVars : : Get ( ) . m_noDebugText = = 0 ) <nl> - { <nl> - static const ColorF col ( 175 . 0f / 255 . 0f , 218 . 0f / 255 . 0f , 154 . 0f / 255 . 0f , 1 . 0f ) ; <nl> - CCryAction : : GetCryAction ( ) - > GetIPersistantDebug ( ) - > Add2DText ( GetPortString ( pActInfo , 1 ) . c_str ( ) , 2 . f , col , GetPortFloat ( pActInfo , 2 ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / display an info message in the HUD <nl> - class CFlowNode_DisplayInfoMessage : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_DisplayInfoMessage ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig in_ports [ ] = <nl> - { <nl> - / / a " void " port that can be pulsed to display the message <nl> - InputPortConfig_Void ( " display " , _HELP ( " Connect event here to display the message " ) ) , <nl> - / / this string port is the message that should be displayed <nl> - InputPortConfig < string > ( " message " , _HELP ( " Display this message on the hud " ) ) , <nl> - / / this floating point input port is how long the message should be displayed <nl> - InputPortConfig < float > ( " displayTime " , 10 . 0f , _HELP ( " How long to display message " ) ) , <nl> - { 0 } <nl> - } ; <nl> - / / we set pointers in " config " here to specify which input and output ports the node contains <nl> - config . pInputPorts = in_ports ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - / / if the event is activate , and the 0th port ( " display " ) has been activated , <nl> - / / display the message <nl> - if ( event = = eFE_Activate & & IsPortActive ( pActInfo , 0 ) ) <nl> - { <nl> - if ( CFlowSystemCVars : : Get ( ) . m_noDebugText = = 0 ) <nl> - { <nl> - static const ColorF col ( 175 . 0f / 255 . 0f , 218 . 0f / 255 . 0f , 154 . 0f / 255 . 0f , 1 . 0f ) ; <nl> - CCryAction : : GetCryAction ( ) - > GetIPersistantDebug ( ) - > Add2DText ( GetPortString ( pActInfo , 1 ) . c_str ( ) , 2 . f , col , GetPortFloat ( pActInfo , 2 ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / display a debug message in the HUD <nl> class CFlowNode_DisplayDebugMessage : public CFlowBaseNode < eNCT_Instanced > <nl> { <nl> class CFlowNode_DisplayDebugMessage : public CFlowBaseNode < eNCT_Instanced > <nl> <nl> } ; <nl> <nl> - / / display a debug message in the HUD <nl> - class CFlowNode_DisplayTimedDebugMessage : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - CTimeValue m_endTime ; <nl> - <nl> - public : <nl> - CFlowNode_DisplayTimedDebugMessage ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_DisplayTimedDebugMessage ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - ser . Value ( " m_endTime " , m_endTime ) ; <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig in_ports [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Trigger this port to display message " ) ) , <nl> - InputPortConfig < string > ( " Message " , _HELP ( " Message to display " ) ) , <nl> - InputPortConfig < float > ( " DisplayTime " , 2 . 0f , _HELP ( " How long to display in seconds ( < = 0 . 0 means forever ) " ) ) , <nl> - InputPortConfig < float > ( " PosX " , 50 . 0f , _HELP ( " X Position of text " ) ) , <nl> - InputPortConfig < float > ( " PosY " , 50 . 0f , _HELP ( " Y Position of text " ) ) , <nl> - InputPortConfig < float > ( " FontSize " , 2 . 0f , _HELP ( " Input font size " ) ) , <nl> - { 0 } <nl> - } ; <nl> - / / we set pointers in " config " here to specify which input and output ports the node contains <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . sDescription = _HELP ( " Display a debug [ Message ] for [ DisplayTime ] seconds \ rIf an entity is not provided , the local player will be used instead " ) ; <nl> - config . pInputPorts = in_ports ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_DEBUG ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - <nl> - if ( event = = eFE_Initialize ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - if ( event = = eFE_Activate ) <nl> - { <nl> - if ( CFlowSystemCVars : : Get ( ) . m_noDebugText = = 0 ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , 0 ) ) <nl> - { <nl> - m_endTime = gEnv - > pTimer - > GetFrameStartTime ( ) + GetPortFloat ( pActInfo , 2 ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - } <nl> - } <nl> - else if ( event = = eFE_Update ) <nl> - { <nl> - if ( CFlowSystemCVars : : Get ( ) . m_noDebugText = = 0 ) <nl> - { <nl> - if ( CCryActionCVars : : Get ( ) . cl_DisableHUDText = = 0 ) <nl> - { <nl> - IRenderer * pRenderer = gEnv - > pRenderer ; <nl> - <nl> - / / Get correct coordinates <nl> - float x = GetPortFloat ( pActInfo , 3 ) ; <nl> - float y = GetPortFloat ( pActInfo , 4 ) ; <nl> - if ( x < 1 . f | | y < 1 . f ) <nl> - { <nl> - int screenX , screenY , screenWidth , screenHeight ; <nl> - pRenderer - > GetViewport ( & screenX , & screenY , & screenWidth , & screenHeight ) ; <nl> - if ( x < 1 . f ) <nl> - x * = ( float ) screenWidth ; <nl> - if ( y < 1 . f ) <nl> - y * = ( float ) screenHeight ; <nl> - } <nl> - <nl> - float drawColor [ 4 ] = { 1 , 1 , 1 , 1 } ; <nl> - pRenderer - > Draw2dLabel ( x , <nl> - y , <nl> - GetPortFloat ( pActInfo , 5 ) , <nl> - drawColor , <nl> - false , <nl> - " % s " , GetPortString ( pActInfo , 1 ) . c_str ( ) ) ; <nl> - } <nl> - } <nl> - / / check if we should show forever . . . <nl> - if ( GetPortFloat ( pActInfo , 2 ) > 0 . 0f ) <nl> - { <nl> - / / no , so check if time - out <nl> - CTimeValue curTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - if ( curTime > = m_endTime ) <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " HUD : DisplayInstructionMessage " , CFlowNode_DisplayInstructionMessage ) ; <nl> - REGISTER_FLOW_NODE ( " HUD : DisplayInfoMessage " , CFlowNode_DisplayInfoMessage ) ; <nl> - REGISTER_FLOW_NODE ( " HUD : DisplayDebugMessage " , CFlowNode_DisplayDebugMessage ) ; <nl> - REGISTER_FLOW_NODE ( " HUD : DisplayTimedDebugMessage " , CFlowNode_DisplayTimedDebugMessage ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : DisplayMessage " , CFlowNode_DisplayDebugMessage ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowInputNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowInputNode . cpp <nl> class CFlowNode_InputKey : public CFlowBaseNode < eNCT_Instanced > , public IInputEv <nl> string m_eventKeyName ; / / string is necessary for ActivateOutput , and it allocates in heap - so we use a member var for it <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class CFlowNode_InputActionListenerOLD : public CFlowBaseNode < eNCT_Instanced > , public IInputEventListener <nl> - { <nl> - enum INPUTS <nl> - { <nl> - EIP_ENABLE = 0 , <nl> - EIP_DISABLE , <nl> - EIP_ACTION , <nl> - EIP_ACTIONMAP , <nl> - EIP_NONDEVMODE , <nl> - } ; <nl> - <nl> - enum OUTPUTS <nl> - { <nl> - EOP_PRESSED , <nl> - EOP_RELEASED , <nl> - } ; <nl> - <nl> - public : <nl> - CFlowNode_InputActionListenerOLD ( SActivationInfo * pActInfo ) : m_bActive ( false ) , m_bAnyAction ( false ) <nl> - { <nl> - m_eventKeyName . resize ( 64 ) ; / / avoid delete / re - newing during execution - assuming no action keys are longer than 64 char <nl> - } <nl> - <nl> - ~ CFlowNode_InputActionListenerOLD ( ) <nl> - { <nl> - Register ( false , 0 ) ; <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Trigger to enable ( default : disabled ) . " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Trigger to disable " ) ) , <nl> - InputPortConfig < string > ( " Action " , _HELP ( " Action input to trigger " ) , _HELP ( " Action " ) , _UICONFIG ( " enum_global : input_actions " ) ) , <nl> - InputPortConfig < string > ( " ActionMap " , _HELP ( " Action Map to use " ) , _HELP ( " Action Map " ) , _UICONFIG ( " enum_global : action_maps " ) ) , <nl> - InputPortConfig < bool > ( " NonDevMode " , false , _HELP ( " If set to true , can be used in Non - Devmode as well [ Debugging backdoor ] " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - OutputPortConfig < string > ( " Pressed " , _HELP ( " Action trigger pressed . " ) ) , <nl> - OutputPortConfig < string > ( " Released " , _HELP ( " Action trigger released . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " FlowNode to catch input events via their action name . It is enabled by default . Entity Input need to be used in multiplayer . " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_InputActionListenerOLD ( pActInfo ) ; <nl> - } <nl> - <nl> - void Register ( bool bRegister , SActivationInfo * pActInfo ) <nl> - { <nl> - IInput * pInput = gEnv - > pInput ; <nl> - if ( pInput ) <nl> - { <nl> - if ( bRegister ) <nl> - { <nl> - assert ( pActInfo ! = 0 ) ; <nl> - / / const bool bAllowedInNonDevMode = GetPortBool ( pActInfo , EIP_NONDEVMODE ) ; <nl> - / / if ( gEnv - > pSystem - > IsDevMode ( ) | | bAllowedInNonDevMode ) <nl> - pInput - > AddEventListener ( this ) ; <nl> - } <nl> - else <nl> - pInput - > RemoveEventListener ( this ) ; <nl> - } <nl> - m_bActive = bRegister ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - ser . Value ( " m_bActive " , m_bActive ) ; <nl> - ser . Value ( " m_bAnyAction " , m_bAnyAction ) ; <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - Register ( m_bActive , pActInfo ) ; <nl> - } <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - m_actInfo = * pActInfo ; <nl> - Register ( false , pActInfo ) ; <nl> - break ; <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - m_actInfo = * pActInfo ; <nl> - if ( IsPortActive ( pActInfo , EIP_DISABLE ) ) <nl> - Register ( false , pActInfo ) ; <nl> - if ( IsPortActive ( pActInfo , EIP_ENABLE ) ) <nl> - { <nl> - Register ( true , pActInfo ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual bool OnInputEvent ( const SInputEvent & event ) <nl> - { <nl> - / / Kevin - Ignore if console is up <nl> - if ( gEnv - > pConsole - > IsOpened ( ) ) <nl> - return false ; <nl> - <nl> - m_eventKeyName = event . keyName . c_str ( ) ; <nl> - <nl> - / / Removed caching of actions to avoid problems when rebinding keys if node is already active <nl> - / / Only a very slight performance hit without caching <nl> - / / TODO : Should be refactored to handle onAction instead of directly comparing inputs , caching won ' t be needed <nl> - const string & actionName = GetPortString ( & m_actInfo , EIP_ACTION ) ; <nl> - const string & actionMapName = GetPortString ( & m_actInfo , EIP_ACTIONMAP ) ; <nl> - bool bActionFound = actionName . empty ( ) ; <nl> - m_bAnyAction = bActionFound ; <nl> - if ( ! bActionFound ) <nl> - { <nl> - IActionMapManager * pAMMgr = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActionMapManager ( ) ; <nl> - if ( pAMMgr ) <nl> - { <nl> - IActionMap * pAM = pAMMgr - > GetActionMap ( actionMapName ) ; <nl> - if ( pAM ) <nl> - { <nl> - const IActionMapAction * pAction = pAM - > GetAction ( ActionId ( actionName ) ) ; <nl> - if ( pAction ) <nl> - { <nl> - const int iNumInputData = pAction - > GetNumActionInputs ( ) ; <nl> - for ( int i = 0 ; i < iNumInputData ; + + i ) <nl> - { <nl> - const SActionInput * pActionInput = pAction - > GetActionInput ( i ) ; <nl> - CRY_ASSERT ( pActionInput ! = NULL ) ; <nl> - bActionFound = stricmp ( pActionInput - > input , m_eventKeyName . c_str ( ) ) = = 0 ; <nl> - <nl> - if ( bActionFound ) <nl> - { <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( bActionFound ) <nl> - { <nl> - bool nullInputValue = ( fabs_tpl ( event . value ) < 0 . 02f ) ; <nl> - if ( ( event . state = = eIS_Pressed ) | | ( ( event . state = = eIS_Changed ) & & ! nullInputValue ) ) <nl> - ActivateOutput ( & m_actInfo , EOP_PRESSED , m_eventKeyName ) ; <nl> - else if ( ( event . state = = eIS_Released ) | | ( ( event . state = = eIS_Changed ) & & nullInputValue ) ) <nl> - ActivateOutput ( & m_actInfo , EOP_RELEASED , m_eventKeyName ) ; <nl> - } <nl> - <nl> - / / return false , so other listeners get notification as well <nl> - return false ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - SActivationInfo m_actInfo ; <nl> - bool m_bActive ; <nl> - bool m_bAnyAction ; <nl> - string m_eventKeyName ; / / string is necessary for ActivateOutput , and it allocates in heap - so we use a member var for it <nl> - <nl> - } ; <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_InputActionFilterOLD : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - enum INPUTS <nl> - { <nl> - EIP_ENABLE = 0 , <nl> - EIP_DISABLE , <nl> - EIP_FILTER <nl> - } ; <nl> - <nl> - enum OUTPUTS <nl> - { <nl> - EOP_ENABLED , <nl> - EOP_DISABLED , <nl> - } ; <nl> - <nl> - void EnableFilter ( bool bEnable , bool bActivateOutput = true ) <nl> - { <nl> - if ( m_filterName . empty ( ) ) <nl> - return ; <nl> - <nl> - m_bEnabled = bEnable ; <nl> - <nl> - IGameFramework * pGameFramework = gEnv - > pGame ? gEnv - > pGame - > GetIGameFramework ( ) : NULL ; <nl> - IActionMapManager * pAMMgr = pGameFramework ? pGameFramework - > GetIActionMapManager ( ) : NULL ; <nl> - if ( pAMMgr ) <nl> - { <nl> - pAMMgr - > EnableFilter ( m_filterName , bEnable ) ; <nl> - if ( bActivateOutput & & m_pActInfo & & m_pActInfo - > pGraph ) <nl> - { <nl> - ActivateOutput ( m_pActInfo , bEnable ? EOP_ENABLED : EOP_DISABLED , 1 ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - public : <nl> - CFlowNode_InputActionFilterOLD ( SActivationInfo * pActInfo ) <nl> - : m_bEnabled ( false ) <nl> - , m_pActInfo ( pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowNode_InputActionFilterOLD ( ) <nl> - { <nl> - EnableFilter ( false , false ) ; <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Trigger to enable ActionFilter " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Trigger to disable ActionFilter " ) ) , <nl> - InputPortConfig < string > ( " Filter " , _HELP ( " Action Filter " ) , 0 , _UICONFIG ( " enum_global : action_filter " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - OutputPortConfig_Void ( " Enabled " , _HELP ( " Triggered when enabled . " ) ) , <nl> - OutputPortConfig_Void ( " Disabled " , _HELP ( " Triggered when disabled . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " FlowNode to enable / disable ActionFilters \ rIf a player is not proved as input entity , the filter will affect all players " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_InputActionFilterOLD ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - m_pActInfo = pActInfo ; <nl> - / / disable on reading <nl> - if ( ser . IsReading ( ) ) <nl> - EnableFilter ( false ) ; <nl> - ser . Value ( " m_filterName " , m_filterName ) ; <nl> - / / on saving we ask the ActionMapManager if the filter is enabled <nl> - / / so , all basically all nodes referring to the same filter will write the correct ( current ) value <nl> - / / on quickload , all of them or none of them will enable / disable the filter again <nl> - / / maybe use a more central location for this <nl> - if ( ser . IsWriting ( ) ) <nl> - { <nl> - bool bWroteIt = false ; <nl> - IActionMapManager * pAMMgr = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActionMapManager ( ) ; <nl> - if ( pAMMgr & & m_filterName . empty ( ) = = false ) <nl> - { <nl> - IActionFilter * pFilter = pAMMgr - > GetActionFilter ( m_filterName . c_str ( ) ) ; <nl> - if ( pFilter ) <nl> - { <nl> - bool bIsEnabled = pAMMgr - > IsFilterEnabled ( m_filterName . c_str ( ) ) ; <nl> - ser . Value ( " m_bEnabled " , bIsEnabled ) ; <nl> - bWroteIt = true ; <nl> - } <nl> - } <nl> - if ( ! bWroteIt ) <nl> - ser . Value ( " m_bEnabled " , m_bEnabled ) ; <nl> - } <nl> - else <nl> - { <nl> - ser . Value ( " m_bEnabled " , m_bEnabled ) ; <nl> - } <nl> - / / re - enable <nl> - if ( ser . IsReading ( ) ) <nl> - EnableFilter ( m_bEnabled ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - m_pActInfo = pActInfo ; <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - EnableFilter ( false ) ; <nl> - m_filterName = GetPortString ( pActInfo , EIP_FILTER ) ; <nl> - break ; <nl> - case eFE_Activate : <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , EIP_FILTER ) ) <nl> - { <nl> - m_filterName = GetPortString ( pActInfo , EIP_FILTER ) ; <nl> - } <nl> - else <nl> - { <nl> - EnableFilter ( IsPortActive ( pActInfo , EIP_ENABLE ) ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - protected : <nl> - bool m_bEnabled ; <nl> - string m_filterName ; / / we need to store this name , as it the d ' tor we need to disable the filter , but don ' t have access to port names <nl> - SActivationInfo * m_pActInfo ; <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_ActionMapManagerOLD : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - enum INPUTS <nl> - { <nl> - EIP_ENABLE = 0 , <nl> - EIP_DISABLE , <nl> - EIP_ACTIONMAP , <nl> - } ; <nl> - <nl> - public : <nl> - CFlowNode_ActionMapManagerOLD ( SActivationInfo * pActInfo ) <nl> - : m_pActInfo ( pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowNode_ActionMapManagerOLD ( ) <nl> - { <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Trigger to enable ( default : disabled ) . " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Trigger to disable " ) ) , <nl> - InputPortConfig < string > ( " ActionMap " , _HELP ( " Action Map to use " ) , _HELP ( " Action Map " ) , _UICONFIG ( " enum_global : action_maps " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . pInputPorts = inputs ; <nl> - config . sDescription = _HELP ( " FlowNode to enable / disable actionmaps " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_ActionMapManagerOLD ( pActInfo ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - m_pActInfo = pActInfo ; <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , EIP_ENABLE ) | | IsPortActive ( pActInfo , EIP_DISABLE ) ) <nl> - { <nl> - const bool bEnable = IsPortActive ( pActInfo , EIP_ENABLE ) ; <nl> - const string actionMapName = GetPortString ( pActInfo , EIP_ACTIONMAP ) ; <nl> - <nl> - IGameFramework * pGameFramework = gEnv - > pGame ? gEnv - > pGame - > GetIGameFramework ( ) : NULL ; <nl> - IActionMapManager * pAMMgr = pGameFramework ? pGameFramework - > GetIActionMapManager ( ) : NULL ; <nl> - if ( pAMMgr & & ! actionMapName . empty ( ) ) <nl> - { <nl> - pAMMgr - > EnableActionMap ( actionMapName , bEnable ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - protected : <nl> - SActivationInfo * m_pActInfo ; <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> class CFlowNode_ForceFeedback : public CFlowBaseNode < eNCT_Singleton > <nl> class CFlowNode_ForceFeedbackTweaker : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_ForceFeedbackTriggerTweaker : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - enum INPUTS <nl> - { <nl> - eIP_LeftTouchToActivate , <nl> - eIP_LeftGain , <nl> - eIP_LeftEnvelope , <nl> - <nl> - eIP_RightTouchToActivate , <nl> - eIP_RightGain , <nl> - eIP_RightEnvelope , <nl> - <nl> - eIP_Activate , <nl> - eIP_Deactivate , <nl> - } ; <nl> - <nl> - public : <nl> - CFlowNode_ForceFeedbackTriggerTweaker ( SActivationInfo * pActInfo ) { } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig < bool > ( " LeftTouchToActivate " , true , _HELP ( " If true the left trigger ' s gain will be modulated by how much the trigger is pressed " ) ) , <nl> - InputPortConfig < float > ( " LeftGain " , 1 . f , _HELP ( " Gain sent to the left trigger ' s motor " ) ) , <nl> - InputPortConfig < int > ( " LeftEnvelope " , 1 . f , _HELP ( " Envelope sent to the left trigger ' s motor ( multiple of 4 , from 0 to 2000 ) " ) ) , <nl> - InputPortConfig < bool > ( " RightTouchToActivate " , true , _HELP ( " If true the right trigger ' s gain will be modulated by how much the trigger is pressed " ) ) , <nl> - InputPortConfig < float > ( " RightGain " , 1 . f , _HELP ( " Gain sent to the right trigger ' s motor " ) ) , <nl> - InputPortConfig < int > ( " RightEnvelope " , 1 . f , _HELP ( " Envelope sent to the right trigger ' s motor ( multiple of 4 , from 0 to 2000 ) " ) ) , <nl> - InputPortConfig_AnyType ( " Activate " , _HELP ( " activate the forcefeedback tweaker " ) ) , <nl> - InputPortConfig_AnyType ( " Deactivate " , _HELP ( " deactivate the force feedback tweaker " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . sDescription = _HELP ( " FlowNode to control force feedback effect on left and right triggers " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , eIP_Activate ) ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , eIP_Deactivate ) ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - IForceFeedbackSystem * pForceFeedback = gEnv - > pGame - > GetIGameFramework ( ) - > GetIForceFeedbackSystem ( ) ; <nl> - if ( pForceFeedback ) <nl> - { <nl> - pForceFeedback - > AddCustomTriggerForceFeedback ( SFFTriggerOutputData ( <nl> - GetPortBool ( pActInfo , eIP_LeftTouchToActivate ) , <nl> - GetPortBool ( pActInfo , eIP_RightTouchToActivate ) , <nl> - GetPortFloat ( pActInfo , eIP_LeftGain ) , <nl> - GetPortFloat ( pActInfo , eIP_RightGain ) , <nl> - 0 . 0f , <nl> - 0 . 0f , <nl> - GetPortInt ( pActInfo , eIP_LeftEnvelope ) , <nl> - GetPortInt ( pActInfo , eIP_RightEnvelope ) <nl> - ) <nl> - ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Input : Key " , CFlowNode_InputKey ) ; <nl> - REGISTER_FLOW_NODE ( " Input : ActionMapManager " , CFlowNode_ActionMapManagerOLD ) ; <nl> - REGISTER_FLOW_NODE ( " Input : ActionListener " , CFlowNode_InputActionListenerOLD ) ; <nl> - REGISTER_FLOW_NODE ( " Input : ActionFilter " , CFlowNode_InputActionFilterOLD ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : InputKey " , CFlowNode_InputKey ) ; <nl> REGISTER_FLOW_NODE ( " Game : ForceFeedback " , CFlowNode_ForceFeedback ) ; <nl> REGISTER_FLOW_NODE ( " Game : ForceFeedbackTweaker " , CFlowNode_ForceFeedbackTweaker ) ; <nl> - REGISTER_FLOW_NODE ( " Game : ForceFeedbackTriggerTweaker " , CFlowNode_ForceFeedbackTriggerTweaker ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowInventoryNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowInventoryNodes . cpp <nl> class CFlowNode_RestorePlayerInventory : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Inventory : AddItem " , CFlowNode_InventoryAddItem ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : RemoveItem " , CFlowNode_InventoryRemoveItem ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : RemoveAllItems " , CFlowNode_InventoryRemoveAllItems ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : HasItem " , CFlowNode_InventoryHasItem ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : ItemAdd " , CFlowNode_InventoryAddItem ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : ItemRemove " , CFlowNode_InventoryRemoveItem ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : ItemRemoveAll " , CFlowNode_InventoryRemoveAllItems ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : ItemCheck " , CFlowNode_InventoryHasItem ) ; <nl> REGISTER_FLOW_NODE ( " Inventory : HolsterItem " , CFlowNode_InventoryHolsterItem ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : SelectItem " , CFlowNode_InventorySelectItem ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : ItemSelect " , CFlowNode_InventorySelectItem ) ; <nl> REGISTER_FLOW_NODE ( " Inventory : ItemSelected " , CFlowNode_InventoryItemSelected ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : RemoveAllAmmo " , CFlowNode_InventoryRemoveAllAmmo ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : AddEquipPack " , CFlowNode_AddEquipmentPack ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : StorePlayerInventory " , CFlowNode_StorePlayerInventory ) ; <nl> - REGISTER_FLOW_NODE ( " Inventory : RestorePlayerInventory " , CFlowNode_RestorePlayerInventory ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : AmmoRemoveAll " , CFlowNode_InventoryRemoveAllAmmo ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : EquipPackAdd " , CFlowNode_AddEquipmentPack ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : PlayerInventoryStore " , CFlowNode_StorePlayerInventory ) ; <nl> + REGISTER_FLOW_NODE ( " Inventory : PlayerInventoryRestore " , CFlowNode_RestorePlayerInventory ) ; <nl> deleted file mode 100644 <nl> index 6dc9bba4e1 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowKinectNodes . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowBaseNode . h " <nl> - <nl> - # if ! CRY_PLATFORM_DURANGO <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Kinect gesture system experiments . <nl> - # define TEST_KINECT_GESTURE_SYSTEM 0 <nl> - # if TEST_KINECT_GESTURE_SYSTEM <nl> - void TestKinectGestureSystem ( ) ; <nl> - # endif / / TEST_KINECT_GESTURE_SYSTEM <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class CFlowNode_KinectAlignment : public IKinectInputListener , public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - <nl> - CFlowNode_KinectAlignment ( SActivationInfo * pActivationInfo ) : <nl> - m_alignTime ( 0 . 0f ) , <nl> - m_currentTime ( 0 . 0f ) , <nl> - m_nodeID ( pActivationInfo - > myID ) , <nl> - m_pGraph ( pActivationInfo - > pGraph ) <nl> - { <nl> - } <nl> - <nl> - virtual ~ CFlowNode_KinectAlignment ( ) <nl> - { <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - pKinectInput - > UnregisterInputListener ( this ) ; <nl> - } <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { return new CFlowNode_KinectAlignment ( pActInfo ) ; } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - eIP_Enable = 0 , <nl> - eIP_Disable , <nl> - eIP_ForceAlign , <nl> - eIP_AlignTime , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - eOP_Started = 0 , <nl> - eOP_Completed , <nl> - } ; <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputConfig [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Enable alignment watcher " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Disable alignment watcher " ) ) , <nl> - InputPortConfig_Void ( " ForceAlign " , _HELP ( " Force beginning of new alignment phase . " ) ) , <nl> - InputPortConfig < float > ( " AlignTime " , 1 . 0f , _HELP ( " Time spent each time skeletal alignment is started " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputConfig [ ] = <nl> - { <nl> - OutputPortConfig < bool > ( " Started " , _HELP ( " Triggers when a new alignment is started . " ) ) , <nl> - OutputPortConfig < bool > ( " Completed " , _HELP ( " Triggers when an alignment completes . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Get default skeleton joint lengths when new closest tracked skeleton is detected " ) ; <nl> - config . pInputPorts = inputConfig ; <nl> - config . pOutputPorts = outputConfig ; <nl> - <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActivationInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - m_alignTime = GetPortFloat ( pActivationInfo , eIP_AlignTime ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActivationInfo , eIP_Enable ) ) <nl> - { <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - pKinectInput - > RegisterInputListener ( this , " CFlowNode_KinectAlignment " ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Started , true ) ; <nl> - } <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_Disable ) ) <nl> - { <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - pKinectInput - > UnregisterInputListener ( this ) ; <nl> - } <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_ForceAlign ) ) <nl> - { <nl> - EnableNodeUpdate ( ) ; <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_AlignTime ) ) <nl> - { <nl> - m_alignTime = GetPortFloat ( pActivationInfo , eIP_AlignTime ) ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - / / If we are here then the node is active , decrease the alignment time until it hits zero <nl> - m_currentTime = max ( 0 . 0f , m_currentTime - gEnv - > pTimer - > GetFrameTime ( ) ) ; <nl> - <nl> - / / Check skeleton status , if it doesn ' t meet the criteria , then reset the alignment time and warn the user <nl> - / / Have a decent alignment , saved the distances as defaults <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - uint32 closestSkeleton = pKinectInput - > GetClosestTrackedSkeleton ( ) ; <nl> - if ( closestSkeleton ! = KIN_SKELETON_INVALID_TRACKING_ID ) <nl> - { <nl> - SKinSkeletonRawData skeletonRawData ; <nl> - if ( pKinectInput - > GetSkeletonRawData ( closestSkeleton , skeletonRawData ) ) <nl> - { <nl> - / / Check some basic constraints about the skeleton that should be rational for the " rest " pose <nl> - <nl> - Vec4 cHipPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_HIP_CENTER ] ; <nl> - Vec4 cSpinePos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_SPINE ] ; <nl> - Vec4 cShoulder = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_SHOULDER_CENTER ] ; <nl> - <nl> - Vec4 lWristPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_WRIST_LEFT ] ; <nl> - Vec4 lElbowPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_ELBOW_LEFT ] ; <nl> - Vec4 lShldrPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_SHOULDER_LEFT ] ; <nl> - <nl> - Vec4 rWristPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_WRIST_RIGHT ] ; <nl> - Vec4 rElbowPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_ELBOW_RIGHT ] ; <nl> - Vec4 rShldrPos = skeletonRawData . vSkeletonPositions [ KIN_SKELETON_POSITION_SHOULDER_RIGHT ] ; <nl> - <nl> - const char * invalidStateReason = NULL ; <nl> - <nl> - / / Check that wrists are below elbows <nl> - if ( lWristPos . y > = lElbowPos . y | | rWristPos . y > = rElbowPos . y ) <nl> - { <nl> - invalidStateReason = " Wrists above elbows " ; <nl> - } <nl> - <nl> - / / Wrists are below spine <nl> - if ( ! invalidStateReason & & ( lWristPos . y > cSpinePos . y | | rWristPos . y > cSpinePos . y ) ) <nl> - { <nl> - invalidStateReason = " Wrists above spine " ; <nl> - } <nl> - <nl> - / / Wrists are in horitzontal plane with body <nl> - if ( ! invalidStateReason & & <nl> - ( fabs ( lWristPos . z - cShoulder . z ) > 0 . 1 | | <nl> - fabs ( rWristPos . z - cShoulder . z ) > 0 . 1 ) <nl> - ) <nl> - { <nl> - invalidStateReason = " Wrists are in front of body " ; <nl> - } <nl> - <nl> - if ( ! invalidStateReason & & <nl> - skeletonRawData . eSkeletonPositionTrackingState [ KIN_SKELETON_POSITION_HIP_CENTER ] = = KIN_SKELETON_POSITION_TRACKED & & <nl> - fabs ( cShoulder . x - cHipPos . x ) > 0 . 03 <nl> - ) <nl> - { <nl> - invalidStateReason = " Spine is not straight " ; <nl> - } <nl> - <nl> - / / Check that wrist distance from shoulder center is symmetrical within some threshold <nl> - float xLWristToHipC = fabs ( lWristPos . x - cShoulder . x ) ; <nl> - float xRWristToHipC = fabs ( rWristPos . x - cShoulder . x ) ; <nl> - if ( ! invalidStateReason & & fabs ( xLWristToHipC - xRWristToHipC ) > 0 . 05 ) <nl> - { <nl> - invalidStateReason = " Wrists not evenly spaced from body " ; <nl> - } <nl> - <nl> - / / Morgan - Disabled as this does not support all body types <nl> - / / Wrist x - distance from shoulder is very small <nl> - / / if ( ! invalidStateReason & & ( fabs ( lWristPos . x - lShldrPos . x ) > 0 . 1 | | fabs ( rWristPos . x - rShldrPos . x ) > 0 . 1 ) ) <nl> - / / invalidStateReason = 4 ; <nl> - <nl> - / / WARN <nl> - if ( invalidStateReason ) <nl> - { <nl> - float color [ ] = { 1 . 0f , 0 . 0f , 0 . 0f , 1 . 0f } ; <nl> - gEnv - > pRenderer - > Draw2dLabel ( 100 , 200 , 2 . 5 , color , false , " Warning : Pose invalid , stand with arms in rest position . Failure Reason : % s " , invalidStateReason ) ; <nl> - m_currentTime = m_alignTime ; <nl> - } <nl> - else if ( m_currentTime < = 0 . 0f ) <nl> - { <nl> - pKinectInput - > UpdateSkeletonAlignment ( closestSkeleton ) ; <nl> - <nl> - ActivateOutput ( pActivationInfo , eOP_Completed , true ) ; <nl> - m_pGraph - > SetRegularlyUpdated ( m_nodeID , false ) ; <nl> - } <nl> - else <nl> - { <nl> - float color [ ] = { 1 . 0f , 1 . 0f , 1 . 0f , 1 . 0f } ; <nl> - gEnv - > pRenderer - > Draw2dLabel ( 100 , 200 , 2 . 5 , color , false , " Aligning : Stand straight in rest pose , with your arms at rest at your sides . " ) ; <nl> - } <nl> - <nl> - } <nl> - } <nl> - / / If the current skeleton is invalid , then turn this node ' s monitoring off <nl> - else <nl> - { <nl> - m_pGraph - > SetRegularlyUpdated ( m_nodeID , false ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * pSizer ) const <nl> - { <nl> - pSizer - > Add ( * this ) ; <nl> - } <nl> - <nl> - / / IKinectInputListener <nl> - virtual bool OnKinectRawInputEvent ( const SKinSkeletonFrame & skeletonFrame ) { return false ; } <nl> - virtual void OnRailProgress ( const SKinRailState & railState ) { } <nl> - virtual void OnVoiceCommand ( string voiceCommand ) { } ; <nl> - virtual void OnKinectClosestSkeletonChanged ( uint32 skeletonIndex ) <nl> - { <nl> - if ( skeletonIndex ! = KIN_SKELETON_INVALID_TRACKING_ID ) <nl> - { <nl> - EnableNodeUpdate ( ) ; <nl> - } <nl> - } <nl> - / / ~ IKinectInputListener <nl> - <nl> - virtual void OnKinectSkeletonMoved ( uint32 skeletonIndex , float distanceMoved ) { } ; <nl> - <nl> - virtual void EnableNodeUpdate ( ) <nl> - { <nl> - m_currentTime = m_alignTime ; <nl> - m_pGraph - > SetRegularlyUpdated ( m_nodeID , true ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - float m_alignTime ; <nl> - float m_currentTime ; <nl> - IFlowGraph * m_pGraph ; <nl> - TFlowNodeId m_nodeID ; <nl> - <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Kinect : Alignment " , CFlowNode_KinectAlignment ) ; <nl> - <nl> - const static string ms_jointEnum ( " enum_int : hip_center = 0 , spine = 1 , shoulder_center = 2 , head = 3 , shoulder_left = 4 , elbow_left = 5 , wrist_left = 6 , hand_left = 7 , shoulder_right = 8 , elbow_right = 9 , wrist_right = 10 , hand_right = 11 , hip_left = 12 , knee_left = 13 , ankle_left = 14 , foot_left = 15 , hip_right = 16 , knee_right = 17 , ankle_right = 18 , foot_right = 19 , hand_refined_left = 20 , hand_refined_right = 21 , null = 22 " ) ; <nl> - <nl> - class CFlowNode_KinectSkeleton : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - <nl> - CFlowNode_KinectSkeleton ( SActivationInfo * pActivationInfo ) : m_frequency ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { return new CFlowNode_KinectSkeleton ( pActInfo ) ; } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - eIP_Sync = 0 , <nl> - eIP_Auto , <nl> - eIP_Freq , <nl> - eIP_Joint , <nl> - eIP_RefJoint <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - eOP_Pos = 0 , <nl> - eOP_X , <nl> - eOP_Y , <nl> - eOP_Z <nl> - } ; <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputConfig [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Sync " , _HELP ( " Synchronize " ) ) , <nl> - InputPortConfig < bool > ( " Auto " , false , _HELP ( " Auto update " ) ) , <nl> - InputPortConfig < float > ( " Freq " , 0 . 0f , _HELP ( " Auto update frequency ( 0 to update every frame ) " ) ) , <nl> - InputPortConfig < int > ( " Joint " , KIN_SKELETON_POSITION_COUNT , _HELP ( " Joint " ) , NULL , _UICONFIG ( ms_jointEnum . c_str ( ) ) ) , <nl> - InputPortConfig < int > ( " RefJoint " , KIN_SKELETON_POSITION_COUNT , _HELP ( " Reference joint " ) , NULL , _UICONFIG ( ms_jointEnum . c_str ( ) ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputConfig [ ] = <nl> - { <nl> - OutputPortConfig < Vec3 > ( " Pos " , _HELP ( " Position " ) ) , <nl> - OutputPortConfig < float > ( " X " , _HELP ( " Position X " ) ) , <nl> - OutputPortConfig < float > ( " Y " , _HELP ( " Position Y " ) ) , <nl> - OutputPortConfig < float > ( " Z " , _HELP ( " Position Z " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Get status of joint in Kinect skeleton " ) ; <nl> - config . pInputPorts = inputConfig ; <nl> - config . pOutputPorts = outputConfig ; <nl> - <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Kinect gesture system experiments . <nl> - # if TEST_KINECT_GESTURE_SYSTEM <nl> - TestKinectGestureSystem ( ) ; <nl> - # endif / / TEST_KINECT_GESTURE_SYSTEM <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActivationInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - SetAutoUpdate ( pActivationInfo , GetPortBool ( pActivationInfo , eIP_Auto ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActivationInfo , eIP_Auto ) ) <nl> - { <nl> - SetAutoUpdate ( pActivationInfo , GetPortBool ( pActivationInfo , eIP_Auto ) ) ; <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_Freq ) ) <nl> - { <nl> - m_frequency = GetPortFloat ( pActivationInfo , eIP_Freq ) ; <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_Sync ) ) <nl> - { <nl> - Sync ( pActivationInfo ) ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - CTimeValue delta = gEnv - > pTimer - > GetFrameStartTime ( ) - m_prevTime ; <nl> - <nl> - if ( delta . GetSeconds ( ) > = m_frequency ) <nl> - { <nl> - Sync ( pActivationInfo ) ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * pSizer ) const <nl> - { <nl> - pSizer - > Add ( * this ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - void SetAutoUpdate ( SActivationInfo * pActivationInfo , bool enable ) <nl> - { <nl> - pActivationInfo - > pGraph - > SetRegularlyUpdated ( pActivationInfo - > myID , enable ) ; <nl> - <nl> - if ( enable ) <nl> - { <nl> - m_prevTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - } <nl> - } <nl> - <nl> - void Sync ( SActivationInfo * pActivationInfo ) <nl> - { <nl> - int32 joint = GetPortInt ( pActivationInfo , eIP_Joint ) , refJoint = GetPortInt ( pActivationInfo , eIP_RefJoint ) ; <nl> - <nl> - if ( ( joint > = 0 ) & & ( joint < KIN_SKELETON_POSITION_COUNT ) ) <nl> - { <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - uint32 closestSkeleton = pKinectInput - > GetClosestTrackedSkeleton ( ) ; <nl> - <nl> - if ( closestSkeleton ! = KIN_SKELETON_INVALID_TRACKING_ID ) <nl> - { <nl> - SKinSkeletonRawData skeletonRawData ; <nl> - if ( pKinectInput - > GetSkeletonRawData ( closestSkeleton , skeletonRawData ) ) <nl> - { <nl> - Vec4 jointPos = skeletonRawData . vSkeletonPositions [ joint ] ; <nl> - <nl> - if ( ( refJoint > = 0 ) & & ( refJoint < KIN_SKELETON_POSITION_COUNT ) ) <nl> - { <nl> - jointPos = jointPos - skeletonRawData . vSkeletonPositions [ refJoint ] ; <nl> - } <nl> - <nl> - ActivateOutput ( pActivationInfo , eOP_Pos , Vec3 ( jointPos . x , jointPos . y , jointPos . z ) ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_X , jointPos . x ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Y , jointPos . y ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Z , jointPos . z ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - m_prevTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - } <nl> - <nl> - float m_frequency ; <nl> - <nl> - CTimeValue m_prevTime ; <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Kinect : Skeleton " , CFlowNode_KinectSkeleton ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Kinect gesture system experiments . Just something I was playing around with one evening , but <nl> - / / might be a good starting point for a more advanced system in the future . <nl> - / / <nl> - / / TODO : Ability to define and recycle rules ? <nl> - / / Vec3 support ? <nl> - # if TEST_KINECT_GESTURE_SYSTEM <nl> - <nl> - class CKinectPose <nl> - { <nl> - public : <nl> - <nl> - bool Parse ( const XmlNodeRef & xmlNode ) ; <nl> - <nl> - float Evaluate ( const SKinSkeletonRawData & skeleton ) const ; <nl> - <nl> - private : <nl> - <nl> - enum EParamType <nl> - { <nl> - ePT_Nil = 0 , <nl> - ePT_Int32 , <nl> - ePT_Float , <nl> - ePT_CVar <nl> - } ; <nl> - <nl> - class CParam <nl> - { <nl> - public : <nl> - <nl> - inline CParam ( ) : m_type ( ePT_Nil ) <nl> - { <nl> - } <nl> - <nl> - inline CParam ( int32 rhs ) : m_type ( ePT_Int32 ) , m_int32 ( rhs ) <nl> - { <nl> - } <nl> - <nl> - inline CParam ( float rhs ) : m_type ( ePT_Float ) , m_float ( rhs ) <nl> - { <nl> - } <nl> - <nl> - inline CParam ( const ICVar * rhs ) : m_type ( ePT_CVar ) , m_pCVar ( rhs ) <nl> - { <nl> - } <nl> - <nl> - inline int32 ToInt32 ( ) const <nl> - { <nl> - switch ( m_type ) <nl> - { <nl> - case ePT_Int32 : <nl> - { <nl> - return m_int32 ; <nl> - } <nl> - <nl> - case ePT_Float : <nl> - { <nl> - return static_cast < int32 > ( m_float ) ; <nl> - } <nl> - <nl> - case ePT_CVar : <nl> - { <nl> - return m_pCVar ? m_pCVar - > GetIVal ( ) : 0 ; <nl> - } <nl> - <nl> - default : <nl> - { <nl> - return 0 ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - inline float ToFloat ( ) const <nl> - { <nl> - switch ( m_type ) <nl> - { <nl> - case ePT_Int32 : <nl> - { <nl> - return static_cast < float > ( m_int32 ) ; <nl> - } <nl> - <nl> - case ePT_Float : <nl> - { <nl> - return m_float ; <nl> - } <nl> - <nl> - case ePT_CVar : <nl> - { <nl> - return m_pCVar ? m_pCVar - > GetFVal ( ) : 0 ; <nl> - } <nl> - <nl> - default : <nl> - { <nl> - return 0 . 0f ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - inline CParam & operator = ( const CParam & rhs ) <nl> - { <nl> - memcpy ( this , & rhs , sizeof ( CParam ) ) ; <nl> - <nl> - return * this ; <nl> - } <nl> - <nl> - inline CParam & operator = ( int32 rhs ) <nl> - { <nl> - m_type = ePT_Int32 ; <nl> - m_int32 = rhs ; <nl> - <nl> - return * this ; <nl> - } <nl> - <nl> - inline CParam & operator = ( float rhs ) <nl> - { <nl> - m_type = ePT_Float ; <nl> - m_float = rhs ; <nl> - <nl> - return * this ; <nl> - } <nl> - <nl> - inline CParam & operator = ( const ICVar * rhs ) <nl> - { <nl> - m_type = ePT_CVar ; <nl> - m_pCVar = rhs ; <nl> - <nl> - return * this ; <nl> - } <nl> - <nl> - friend inline bool operator & & ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return lhs . ToInt32 ( ) & & rhs . ToInt32 ( ) ; <nl> - } <nl> - <nl> - friend inline bool operator | | ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return lhs . ToInt32 ( ) | | rhs . ToInt32 ( ) ; <nl> - } <nl> - <nl> - friend inline bool operator < ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return lhs . ToFloat ( ) < rhs . ToFloat ( ) ; <nl> - } <nl> - <nl> - friend inline bool operator > ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return lhs . ToFloat ( ) > rhs . ToFloat ( ) ; <nl> - } <nl> - <nl> - friend inline CParam operator + ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return CParam ( lhs . ToFloat ( ) + rhs . ToFloat ( ) ) ; <nl> - } <nl> - <nl> - friend inline CParam operator - ( const CParam & lhs , const CParam & rhs ) <nl> - { <nl> - return CParam ( lhs . ToFloat ( ) - rhs . ToFloat ( ) ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - EParamType m_type ; <nl> - <nl> - union <nl> - { <nl> - int32 m_int32 ; <nl> - <nl> - float m_float ; <nl> - <nl> - const ICVar * m_pCVar ; <nl> - } ; <nl> - } ; <nl> - <nl> - enum ENodeType <nl> - { <nl> - eNT_Null = 0 , <nl> - eNT_Const , <nl> - eNT_CVar , <nl> - eNT_JointX , <nl> - eNT_JointY , <nl> - eNT_JointZ , <nl> - eNT_And , <nl> - eNT_Or , <nl> - eNT_GreaterThan , <nl> - eNT_LessThan , <nl> - eNT_Add , <nl> - eNT_Subtract , <nl> - eNT_Count <nl> - } ; <nl> - <nl> - struct SNode <nl> - { <nl> - inline SNode ( ) : type ( eNT_Null ) <nl> - { <nl> - } <nl> - <nl> - ENodeType type ; <nl> - <nl> - CParam params [ 2 ] ; <nl> - } ; <nl> - <nl> - typedef std : : vector < SNode > TNodeVector ; <nl> - <nl> - bool ParseNode ( const XmlNodeRef & xmlNode , int32 iNode ) ; <nl> - <nl> - ENodeType GetNodeType ( const string & name ) const ; <nl> - <nl> - int32 GetJointId ( const string & name ) const ; <nl> - <nl> - CParam ProcessNode ( const SKinSkeletonRawData & skeleton , int32 iNode ) const ; <nl> - <nl> - static const string ms_nodeTypeNames [ eNT_Count ] , ms_jointNames [ KIN_SKELETON_POSITION_COUNT ] ; <nl> - <nl> - TNodeVector m_nodes ; <nl> - } ; <nl> - <nl> - class CKinectGesture <nl> - { <nl> - public : <nl> - <nl> - bool Parse ( const XmlNodeRef & xmlNode ) ; <nl> - <nl> - private : <nl> - <nl> - typedef std : : vector < string > TPoseVector ; <nl> - <nl> - TPoseVector m_poses ; <nl> - } ; <nl> - <nl> - class CKinectGestureSystem <nl> - { <nl> - public : <nl> - <nl> - bool LoadGestureLibrary ( const string & fileName ) ; <nl> - <nl> - const CKinectPose * GetPose ( const string & name ) const ; <nl> - <nl> - const CKinectGesture * GetGesture ( const string & name ) const ; <nl> - <nl> - private : <nl> - <nl> - typedef std : : unordered_map < string , CKinectPose , stl : : hash_strcmp < string > , stl : : hash_strcmp < string > > TPoseMap ; <nl> - <nl> - typedef std : : unordered_map < string , CKinectGesture , stl : : hash_strcmp < string > , stl : : hash_strcmp < string > > TGestureMap ; <nl> - <nl> - TPoseMap m_poses ; <nl> - <nl> - TGestureMap m_gestures ; <nl> - } ; <nl> - <nl> - const string CKinectPose : : ms_nodeTypeNames [ eNT_Count ] = <nl> - { <nl> - " null " , <nl> - " const " , <nl> - " c_var " , <nl> - " joint_x " , <nl> - " joint_y " , <nl> - " joint_z " , <nl> - " and " , <nl> - " or " , <nl> - " greater_than " , <nl> - " less_than " , <nl> - " add " , <nl> - " subtract " <nl> - } ; <nl> - <nl> - const string CKinectPose : : ms_jointNames [ KIN_SKELETON_POSITION_COUNT ] = <nl> - { <nl> - " hip_center " , <nl> - " spine " , <nl> - " shoulder_center " , <nl> - " head " , <nl> - " shoulder_left " , <nl> - " elbow_left " , <nl> - " wrist_left " , <nl> - " hand_left " , <nl> - " shoulder_right " , <nl> - " elbow_right " , <nl> - " wrist_right " , <nl> - " hand_right " , <nl> - " hip_left " , <nl> - " knee_left " , <nl> - " ankle_left " , <nl> - " foot_left " , <nl> - " hip_right " , <nl> - " knee_right " , <nl> - " ankle_right " , <nl> - " foot_right " <nl> - } ; <nl> - <nl> - bool CKinectPose : : Parse ( const XmlNodeRef & xmlNode ) <nl> - { <nl> - if ( ! strcmp ( xmlNode - > getTag ( ) , " pose " ) ) <nl> - { <nl> - if ( xmlNode - > getChildCount ( ) > 1 ) <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - <nl> - m_nodes . push_back ( SNode ( ) ) ; <nl> - <nl> - if ( ParseNode ( xmlNode - > getChild ( 0 ) , 0 ) ) <nl> - { <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - m_nodes . clear ( ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - float CKinectPose : : Evaluate ( const SKinSkeletonRawData & skeleton ) const <nl> - { <nl> - return m_nodes . size ( ) ? ProcessNode ( skeleton , 0 ) . ToFloat ( ) : 0 . 0f ; <nl> - } <nl> - <nl> - bool CKinectPose : : ParseNode ( const XmlNodeRef & xmlNode , int32 iNode ) <nl> - { <nl> - CRY_ASSERT ( ( iNode > = 0 ) & & ( static_cast < size_t > ( iNode < m_nodes . size ( ) ) ) ) ; <nl> - <nl> - if ( m_nodes [ iNode ] . type = GetNodeType ( xmlNode - > getTag ( ) ) ) <nl> - { <nl> - switch ( m_nodes [ iNode ] . type ) <nl> - { <nl> - case eNT_Const : <nl> - { <nl> - const char * pTag = NULL , * pValue = NULL ; <nl> - <nl> - if ( xmlNode - > getAttributeByIndex ( 0 , & pTag , & pValue ) ) <nl> - { <nl> - if ( ! strcmp ( pTag , " int32 " ) ) <nl> - { <nl> - m_nodes [ iNode ] . params [ 0 ] = static_cast < int32 > ( atoi ( pValue ) ) ; <nl> - <nl> - return true ; <nl> - } <nl> - else if ( ! strcmp ( pTag , " float " ) ) <nl> - { <nl> - m_nodes [ iNode ] . params [ 0 ] = static_cast < float > ( atof ( pValue ) ) ; <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - case eNT_CVar : <nl> - { <nl> - string name = xmlNode - > getAttr ( " name " ) ; <nl> - <nl> - if ( ICVar * pCVar = gEnv - > pConsole - > GetCVar ( name . c_str ( ) ) ) <nl> - { <nl> - m_nodes [ iNode ] . params [ 0 ] = pCVar ; <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - case eNT_JointX : <nl> - case eNT_JointY : <nl> - case eNT_JointZ : <nl> - { <nl> - int32 jointId = GetJointId ( xmlNode - > getAttr ( " name " ) ) ; <nl> - <nl> - if ( jointId ! = KIN_SKELETON_POSITION_COUNT ) <nl> - { <nl> - m_nodes [ iNode ] . params [ 0 ] = jointId ; <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - case eNT_And : <nl> - case eNT_Or : <nl> - case eNT_GreaterThan : <nl> - case eNT_LessThan : <nl> - case eNT_Add : <nl> - case eNT_Subtract : <nl> - { <nl> - if ( xmlNode - > getChildCount ( ) = = 2 ) <nl> - { <nl> - m_nodes [ iNode ] . params [ 0 ] = static_cast < int32 > ( m_nodes . size ( ) ) ; <nl> - <nl> - m_nodes . push_back ( SNode ( ) ) ; <nl> - <nl> - if ( ! ParseNode ( xmlNode - > getChild ( 0 ) , m_nodes [ iNode ] . params [ 0 ] . ToInt32 ( ) ) ) <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - m_nodes [ iNode ] . params [ 1 ] = static_cast < int32 > ( m_nodes . size ( ) ) ; <nl> - <nl> - m_nodes . push_back ( SNode ( ) ) ; <nl> - <nl> - if ( ! ParseNode ( xmlNode - > getChild ( 1 ) , m_nodes [ iNode ] . params [ 1 ] . ToInt32 ( ) ) ) <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - default : <nl> - { <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - CKinectPose : : ENodeType CKinectPose : : GetNodeType ( const string & name ) const <nl> - { <nl> - for ( int32 nodeType = eNT_Null ; nodeType < eNT_Count ; + + nodeType ) <nl> - { <nl> - if ( name = = ms_nodeTypeNames [ nodeType ] ) <nl> - { <nl> - return static_cast < ENodeType > ( nodeType ) ; <nl> - } <nl> - } <nl> - <nl> - return eNT_Null ; <nl> - } <nl> - <nl> - int32 CKinectPose : : GetJointId ( const string & name ) const <nl> - { <nl> - for ( int32 jointId = KIN_SKELETON_POSITION_HIP_CENTER ; jointId < KIN_SKELETON_POSITION_COUNT ; + + jointId ) <nl> - { <nl> - if ( name = = ms_jointNames [ jointId ] ) <nl> - { <nl> - return jointId ; <nl> - } <nl> - } <nl> - <nl> - return KIN_SKELETON_POSITION_COUNT ; <nl> - } <nl> - <nl> - CKinectPose : : CParam CKinectPose : : ProcessNode ( const SKinSkeletonRawData & skeleton , int32 iNode ) const <nl> - { <nl> - CRY_ASSERT ( ( iNode > = 0 ) & & ( static_cast < size_t > ( iNode < m_nodes . size ( ) ) ) ) ; <nl> - <nl> - const SNode & node = m_nodes [ iNode ] ; <nl> - <nl> - switch ( node . type ) <nl> - { <nl> - case eNT_Const : <nl> - case eNT_CVar : <nl> - { <nl> - return node . params [ 0 ] ; <nl> - } <nl> - <nl> - case eNT_JointX : <nl> - { <nl> - return CParam ( skeleton . vSkeletonPositions [ node . params [ 0 ] . ToInt32 ( ) ] . x ) ; <nl> - } <nl> - <nl> - case eNT_JointY : <nl> - { <nl> - return CParam ( skeleton . vSkeletonPositions [ node . params [ 0 ] . ToInt32 ( ) ] . y ) ; <nl> - } <nl> - <nl> - case eNT_JointZ : <nl> - { <nl> - return CParam ( skeleton . vSkeletonPositions [ node . params [ 0 ] . ToInt32 ( ) ] . z ) ; <nl> - } <nl> - <nl> - case eNT_And : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) & & ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ; <nl> - } <nl> - <nl> - case eNT_Or : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) | | ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ; <nl> - } <nl> - <nl> - case eNT_GreaterThan : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) > ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ? 1 . 0f : 0 . 0f ; <nl> - } <nl> - <nl> - case eNT_LessThan : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) < ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ? 1 . 0f : 0 . 0f ; <nl> - } <nl> - <nl> - case eNT_Add : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) + ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ; <nl> - } <nl> - <nl> - case eNT_Subtract : <nl> - { <nl> - return ProcessNode ( skeleton , node . params [ 0 ] . ToInt32 ( ) ) - ProcessNode ( skeleton , node . params [ 1 ] . ToInt32 ( ) ) ; <nl> - } <nl> - <nl> - default : <nl> - { <nl> - return CParam ( ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - bool CKinectGesture : : Parse ( const XmlNodeRef & node ) <nl> - { <nl> - return true ; <nl> - } <nl> - <nl> - bool CKinectGestureSystem : : LoadGestureLibrary ( const string & fileName ) <nl> - { <nl> - if ( const XmlNodeRef rootNode = gEnv - > pSystem - > LoadXmlFromFile ( fileName . c_str ( ) ) ) <nl> - { <nl> - if ( ! strcmp ( rootNode - > getTag ( ) , " gesture_library " ) ) <nl> - { <nl> - for ( uint32 iChildNode = 0 , iEndChildNode = rootNode - > getChildCount ( ) ; iChildNode ! = iEndChildNode ; + + iChildNode ) <nl> - { <nl> - const XmlNodeRef childNode = rootNode - > getChild ( iChildNode ) ; <nl> - <nl> - if ( ! strcmp ( childNode - > getTag ( ) , " poses " ) ) <nl> - { <nl> - for ( uint32 iPoseNode = 0 , iEndPoseNode = childNode - > getChildCount ( ) ; iPoseNode ! = iEndPoseNode ; + + iPoseNode ) <nl> - { <nl> - const XmlNodeRef poseNode = childNode - > getChild ( iPoseNode ) ; <nl> - <nl> - if ( ! strcmp ( poseNode - > getTag ( ) , " pose " ) ) <nl> - { <nl> - std : : pair < TPoseMap : : iterator , bool > result = m_poses . insert ( TPoseMap : : value_type ( poseNode - > getAttr ( " name " ) , CKinectPose ( ) ) ) ; <nl> - <nl> - if ( result . second ) <nl> - { <nl> - TPoseMap : : iterator & iPose = result . first ; <nl> - <nl> - if ( ! iPose - > second . Parse ( poseNode ) ) <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - m_poses . erase ( iPose ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - } <nl> - } <nl> - else if ( ! strcmp ( childNode - > getTag ( ) , " gestures " ) ) <nl> - { <nl> - for ( uint32 iGestureNode = 0 , iEndGestureNode = childNode - > getChildCount ( ) ; iGestureNode ! = iEndGestureNode ; + + iGestureNode ) <nl> - { <nl> - const XmlNodeRef gestureNode = childNode - > getChild ( iGestureNode ) ; <nl> - <nl> - if ( ! strcmp ( gestureNode - > getTag ( ) , " gesture " ) ) <nl> - { <nl> - std : : pair < TGestureMap : : iterator , bool > result = m_gestures . insert ( TGestureMap : : value_type ( gestureNode - > getAttr ( " name " ) , CKinectGesture ( ) ) ) ; <nl> - <nl> - if ( result . second ) <nl> - { <nl> - TGestureMap : : iterator & iGesture = result . first ; <nl> - <nl> - if ( ! iGesture - > second . Parse ( gestureNode ) ) <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - m_gestures . erase ( iGesture ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - } <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - / / Warning ! ! ! <nl> - <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - const CKinectPose * CKinectGestureSystem : : GetPose ( const string & name ) const <nl> - { <nl> - TPoseMap : : const_iterator iPose = m_poses . find ( name ) ; <nl> - <nl> - return ( iPose ! = m_poses . end ( ) ) ? & iPose - > second : NULL ; <nl> - } <nl> - <nl> - void TestKinectGestureSystem ( ) <nl> - { <nl> - CKinectGestureSystem kinectGestureSystem ; <nl> - <nl> - if ( kinectGestureSystem . LoadGestureLibrary ( " gestures . xml " ) ) <nl> - { <nl> - if ( const CKinectPose * pPose = kinectGestureSystem . GetPose ( " raise_right_arm " ) ) <nl> - { <nl> - if ( IKinectInput * pKinectInput = gEnv - > pSystem - > GetIInput ( ) - > GetKinectInput ( ) ) <nl> - { <nl> - SKinSkeletonRawData skeleton ; <nl> - <nl> - for ( uint32 iSkeleton = 0 ; iSkeleton < KIN_SKELETON_COUNT ; + + iSkeleton ) <nl> - { <nl> - if ( pKinectInput - > GetSkeletonRawData ( iSkeleton , skeleton ) ) <nl> - { <nl> - pPose - > Evaluate ( skeleton ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - # endif / / TEST_KINECT_GESTURE_SYSTEM <nl> - <nl> - # endif / / ! CRY_PLATFORM_DURANGO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> deleted file mode 100644 <nl> index 32417abf65 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowLogInput . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / File name : FlowLogInput . h <nl> - / / Version : v1 . 00 <nl> - / / Created : 9 / 5 / 2005 by Timur . <nl> - / / Compilers : Visual Studio . NET 2003 <nl> - / / Description : <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / History : <nl> - / / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowBaseNode . h " <nl> - <nl> - class CFlowLogInput : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowLogInput ( SActivationInfo * pActInfo ) { } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_AnyType ( " in " , " Any value to be logged " ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Activate & & IsPortActive ( pActInfo , 0 ) ) <nl> - { <nl> - / / const TFlowInputData & in = pActInfo - > pInputPorts [ 0 ] ; <nl> - string strValue ; <nl> - pActInfo - > pInputPorts [ 0 ] . GetValueWithConversion ( strValue ) ; <nl> - const char * sName = pActInfo - > pGraph - > GetNodeName ( pActInfo - > myID ) ; <nl> - CryLogAlways ( " [ flow - log ] Node % s : Value = % s " , sName , strValue . c_str ( ) ) ; <nl> - / * <nl> - switch ( in . GetType ( ) ) <nl> - { <nl> - case eFDT_Bool : <nl> - port . pVar - > Set ( * pPort - > defaultData . GetPtr < bool > ( ) ) ; <nl> - break ; <nl> - case eFDT_Int : <nl> - port . pVar - > Set ( * pPort - > defaultData . GetPtr < int > ( ) ) ; <nl> - break ; <nl> - case eFDT_Float : <nl> - port . pVar - > Set ( * pPort - > defaultData . GetPtr < float > ( ) ) ; <nl> - break ; <nl> - case eFDT_EntityId : <nl> - port . pVar - > Set ( * pPort - > defaultData . GetPtr < int > ( ) ) ; <nl> - break ; <nl> - case eFDT_Vec3 : <nl> - port . pVar - > Set ( * pPort - > defaultData . GetPtr < Vec3 > ( ) ) ; <nl> - break ; <nl> - case eFDT_String : <nl> - port . pVar - > Set ( ( pPort - > defaultData . GetPtr < string > ( ) ) - > c_str ( ) ) ; <nl> - break ; <nl> - default : <nl> - CryLogAlways ( " Unknown Type " ) ; <nl> - } <nl> - * / <nl> - } <nl> - } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Log : LogInput " , CFlowLogInput ) <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowMathNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowMathNodes . cpp <nl> class CFlowNode_SetColor : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_Select2 : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_Select2 ( SActivationInfo * pActInfo ) { } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < int > ( " in " , _HELP ( " Number that will select index of output that generates event " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_Void ( " one " ) , <nl> - OutputPortConfig_Void ( " two " ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Modulo of 2 from [ in ] port decides which out port sends true event " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - case eFE_Initialize : <nl> - int nIndex = GetPortInt ( pActInfo , 0 ) % 2 ; <nl> - if ( nIndex = = 0 ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , ( bool ) true ) ; <nl> - } <nl> - else <nl> - { <nl> - ActivateOutput ( pActInfo , 1 , ( bool ) true ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_ToVec3 : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> REGISTER_FLOW_NODE ( " Math : LessCheck " , CFlowNode_LessCheck ) <nl> REGISTER_FLOW_NODE ( " Math : Counter " , CFlowNode_Counter ) <nl> REGISTER_FLOW_NODE ( " Math : PortCounter " , CFlowNode_PortCounter ) ; <nl> REGISTER_FLOW_NODE ( " Math : Remainder " , CFlowNode_Remainder ) <nl> - REGISTER_FLOW_NODE ( " Math : Select2 " , CFlowNode_Select2 ) <nl> REGISTER_FLOW_NODE ( " Math : Reciprocal " , CFlowNode_Reciprocal ) ; <nl> REGISTER_FLOW_NODE ( " Math : Random " , CFlowNode_Random ) ; <nl> REGISTER_FLOW_NODE ( " Math : Power " , CFlowNode_Power ) ; <nl> REGISTER_FLOW_NODE ( " Math : SinCos " , CFlowNode_SinCos ) ; <nl> REGISTER_FLOW_NODE ( " Math : AnglesToDir " , CFlowNode_AnglesToDir ) ; <nl> REGISTER_FLOW_NODE ( " Math : DirToAngles " , CFlowNode_DirToAngles ) ; <nl> REGISTER_FLOW_NODE ( " Math : SetNumber " , CFlowNode_SetNumber ) ; <nl> - REGISTER_FLOW_NODE ( " Math : ToBoolean " , CFlowNode_ToBoolean ) ; <nl> - REGISTER_FLOW_NODE ( " Math : FromBoolean " , CFlowNode_FromBoolean ) ; <nl> + REGISTER_FLOW_NODE ( " Math : BooleanTo " , CFlowNode_ToBoolean ) ; <nl> + REGISTER_FLOW_NODE ( " Math : BooleanFrom " , CFlowNode_FromBoolean ) ; <nl> REGISTER_FLOW_NODE ( " Math : UpDownCounter " , CFlowNode_UpDownCounter ) ; <nl> REGISTER_FLOW_NODE ( " Math : SetColor " , CFlowNode_SetColor ) ; <nl> REGISTER_FLOW_NODE ( " Math : Sinus " , CFlowNode_Sin ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowMissionNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowMissionNodes . cpp <nl> class CFlowNode_EndLevel : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Mission : EndLevelNew " , CFlowNode_EndLevel ) ; <nl> + REGISTER_FLOW_NODE ( " Mission : LoadNextLevel " , CFlowNode_EndLevel ) ; <nl> deleted file mode 100644 <nl> index ed4e19d02c . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNaturalPointNodes . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowBaseNode . h " <nl> - <nl> - class CFlowNode_TrackIR : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - <nl> - CFlowNode_TrackIR ( SActivationInfo * pActivationInfo ) : m_frequency ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { return new CFlowNode_TrackIR ( pActInfo ) ; } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - eIP_Sync = 0 , <nl> - eIP_Auto , <nl> - eIP_Freq , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - eOP_Pitch = 0 , <nl> - eOP_Yaw , <nl> - eOP_Roll , <nl> - eOP_X , <nl> - eOP_Y , <nl> - eOP_Z <nl> - } ; <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputConfig [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Sync " , _HELP ( " Synchronize " ) ) , <nl> - InputPortConfig < bool > ( " Auto " , false , _HELP ( " Auto update " ) ) , <nl> - InputPortConfig < float > ( " Freq " , 0 . 0f , _HELP ( " Auto update frequency ( 0 to update every frame ) " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputConfig [ ] = <nl> - { <nl> - OutputPortConfig < float > ( " Pitch " , _HELP ( " Pitch " ) ) , <nl> - OutputPortConfig < float > ( " Yaw " , _HELP ( " Yaw " ) ) , <nl> - OutputPortConfig < float > ( " Roll " , _HELP ( " Roll " ) ) , <nl> - OutputPortConfig < float > ( " X " , _HELP ( " Position X " ) ) , <nl> - OutputPortConfig < float > ( " Y " , _HELP ( " Position Y " ) ) , <nl> - OutputPortConfig < float > ( " Z " , _HELP ( " Position Z " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Get status of joint in Kinect skeleton " ) ; <nl> - config . pInputPorts = inputConfig ; <nl> - config . pOutputPorts = outputConfig ; <nl> - <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActivationInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - SetAutoUpdate ( pActivationInfo , GetPortBool ( pActivationInfo , eIP_Auto ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActivationInfo , eIP_Auto ) ) <nl> - { <nl> - SetAutoUpdate ( pActivationInfo , GetPortBool ( pActivationInfo , eIP_Auto ) ) ; <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_Freq ) ) <nl> - { <nl> - m_frequency = GetPortFloat ( pActivationInfo , eIP_Freq ) ; <nl> - } <nl> - else if ( IsPortActive ( pActivationInfo , eIP_Sync ) ) <nl> - { <nl> - Sync ( pActivationInfo ) ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - CTimeValue delta = gEnv - > pTimer - > GetFrameStartTime ( ) - m_prevTime ; <nl> - <nl> - if ( delta . GetSeconds ( ) > = m_frequency ) <nl> - { <nl> - Sync ( pActivationInfo ) ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * pSizer ) const <nl> - { <nl> - pSizer - > Add ( * this ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - void SetAutoUpdate ( SActivationInfo * pActivationInfo , bool enable ) <nl> - { <nl> - pActivationInfo - > pGraph - > SetRegularlyUpdated ( pActivationInfo - > myID , enable ) ; <nl> - <nl> - if ( enable ) <nl> - { <nl> - m_prevTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - } <nl> - } <nl> - <nl> - void Sync ( SActivationInfo * pActivationInfo ) <nl> - { <nl> - if ( INaturalPointInput * pNPInput = gEnv - > pSystem - > GetIInput ( ) - > GetNaturalPointInput ( ) ) <nl> - { <nl> - NP_RawData currentNPData ; <nl> - <nl> - if ( pNPInput - > GetNaturalPointData ( currentNPData ) ) <nl> - { <nl> - ActivateOutput ( pActivationInfo , eOP_Pitch , currentNPData . fNPPitch ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Yaw , currentNPData . fNPYaw ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Roll , currentNPData . fNPRoll ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_X , currentNPData . fNPX ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Y , currentNPData . fNPY ) ; <nl> - ActivateOutput ( pActivationInfo , eOP_Z , currentNPData . fNPZ ) ; <nl> - } <nl> - <nl> - } <nl> - <nl> - m_prevTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - } <nl> - <nl> - float m_frequency ; <nl> - <nl> - CTimeValue m_prevTime ; <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " NaturalPoint : GetNPData " , CFlowNode_TrackIR ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAI . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAI . cpp <nl> class CFlowNode_AIActiveCountMonitor : public CFlowBaseNode < eNCT_Instanced > <nl> <nl> CFlowNode_AIActiveCountMonitor : : SActiveAIStatistics CFlowNode_AIActiveCountMonitor : : s_activeAIStatistics ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Filters the inputs depending on owner ' s AI alertness level . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIAlertnessFilter : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_AIAlertnessFilter ( SActivationInfo * pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < int > ( " Threshold " , 1 , _HELP ( " The alertness level needed to output the values on the Input port to the High port . \ nIf current alertness is less than this then the values are sent to the Low output port . " ) ) , <nl> - InputPortConfig_AnyType ( " Input " , _HELP ( " The group ID of the group to get the alertness from " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_AnyType ( " Low " , _HELP ( " Outputs here all values passed on Input if current alertness is less than threshold value " ) ) , <nl> - OutputPortConfig_AnyType ( " High " , _HELP ( " Outputs here all values passed on Input if current alertness is equal or greater than threshold value " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Filters the inputs depending on owner ' s AI alertness level . " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( ! pActInfo - > pEntity ) <nl> - return ; <nl> - <nl> - if ( event ! = eFE_Initialize & & event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - if ( ! IsPortActive ( pActInfo , 1 ) ) <nl> - return ; <nl> - <nl> - EntityId entityID = pActInfo - > pEntity - > GetId ( ) ; <nl> - IActorSystem * pActorSystem = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) ; <nl> - IActor * pActor = pActorSystem - > GetActor ( entityID ) ; <nl> - if ( ! pActor ) <nl> - return ; <nl> - <nl> - / / read the input value . . . <nl> - / / . . . and depending on threshold . . . <nl> - / * int currentAlertness = pOldActor - > GetCachedAIValues ( ) - > GetAlertnessState ( ) ; <nl> - / / . . . output it to one of two possible output ports <nl> - <nl> - int outValue = ( currentAlertness < GetPortInt ( pActInfo , 0 ) ) ? 0 : 1 ; <nl> - ActivateOutput ( pActInfo , outValue , GetPortAny ( pActInfo , 1 ) ) ; * / <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Group AI enemies alertness level . <nl> / / It represents the current alertness level of AI enemies , more precisely , <nl> class CFlowNode_AIGroupAlertness : public CFlowBaseNode < eNCT_Instanced > <nl> } ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / AI : AIMergeGroups <nl> + / / AI : GroupIDSet <nl> / / Merges two AI groups . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIMergeGroups : public CFlowBaseNode < eNCT_Singleton > <nl> class CFlowNode_AIMergeGroups : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / AI : GroupBeacon node . <nl> - / / This node returns the position of the group beacon . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIGroupBeacon : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - CFlowNode_AIGroupBeacon ( SActivationInfo * pActInfo ) : m_lastVal ( ZERO ) <nl> - { <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_AIGroupBeacon ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - / / forces re - triggering on load <nl> - if ( ser . IsReading ( ) ) <nl> - m_lastVal . zero ( ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " pos " , _HELP ( " Beacon position " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < int > ( " groupID " , _HELP ( " The group ID of the group to get the beacon from " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Outputs AI Group ' s beacon position " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Initialize ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - m_lastVal . zero ( ) ; <nl> - ActivateOutput ( pActInfo , 0 , m_lastVal ) ; <nl> - } <nl> - else if ( event = = eFE_Update ) <nl> - { <nl> - IAISystem * pAISystem = gEnv - > pAISystem ; <nl> - int groupID = GetPortInt ( pActInfo , 0 ) ; <nl> - <nl> - IAIObject * pBeacon = pAISystem - > GetBeacon ( groupID ) ; <nl> - Vec3 beacon ( ZERO ) ; <nl> - if ( pBeacon ) <nl> - beacon = pBeacon - > GetPos ( ) ; <nl> - if ( beacon ! = m_lastVal ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , beacon ) ; <nl> - m_lastVal = beacon ; <nl> - } <nl> - } <nl> - } <nl> - Vec3 m_lastVal ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / AI : GroupID node . <nl> / / Returns the groupID of the entity . <nl> class CFlowNode_AISmartObjectEvent : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Enable / Disable AI for an entity / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIEnable : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - enum EInputs <nl> - { <nl> - IN_ENABLE , <nl> - IN_DISABLE , <nl> - } ; <nl> - CFlowNode_AIEnable ( SActivationInfo * pActInfo ) { } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_AnyType ( " Enable " , _HELP ( " Enable AI for target entity " ) ) , <nl> - InputPortConfig_AnyType ( " Disable " , _HELP ( " Disable AI for target entity " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Plays an Animation " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - { <nl> - if ( ! pActInfo - > pEntity ) <nl> - return ; <nl> - <nl> - if ( IsPortActive ( pActInfo , IN_ENABLE ) ) <nl> - { <nl> - if ( IAIObject * aiObject = pActInfo - > pEntity - > GetAI ( ) ) <nl> - aiObject - > Event ( AIEVENT_ENABLE , 0 ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , IN_DISABLE ) ) <nl> - { <nl> - if ( IAIObject * aiObject = pActInfo - > pEntity - > GetAI ( ) ) <nl> - aiObject - > Event ( AIEVENT_DISABLE , 0 ) ; <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Initialize : <nl> - break ; <nl> - } <nl> - ; <nl> - } ; <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / control auto disabling <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIPerceptionScale : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / changes parameter of assigned AI <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIChangeParameter : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - enum EAIParamNames <nl> - { <nl> - AIPARAM_FACTION = 0 , / / make sure they match the UICONFIG below <nl> - AIPARAM_GROUPID , <nl> - AIPARAM_FORGETFULNESS <nl> - } ; <nl> - <nl> - public : <nl> - CFlowNode_AIChangeParameter ( SActivationInfo * pActInfo ) <nl> - { <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Change the parameter of the AI " ) ) , <nl> - InputPortConfig < int > ( " Param " , AIPARAM_FACTION , _HELP ( " Parameter to change " ) , _HELP ( " Parameter " ) , <nl> - _UICONFIG ( " enum_int : Faction = 0 , GroupId = 1 , Forgetfulness = 2 " ) ) , <nl> - InputPortConfig < float > ( " Value " , 0 . 0f , _HELP ( " Value " ) ) , <nl> - InputPortConfig < string > ( " Faction " , " " , _HELP ( " Faction " ) , 0 , _UICONFIG ( " enum_global : Faction " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Changes an AI ' s parameters dynamically " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = 0 ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Activate & & IsPortActive ( pActInfo , 0 ) & & pActInfo - > pEntity ) <nl> - { <nl> - IAIActor * pAIActor = CastToIAIActorSafe ( pActInfo - > pEntity - > GetAI ( ) ) ; <nl> - if ( pAIActor ) <nl> - { <nl> - int param = GetPortInt ( pActInfo , 1 ) ; <nl> - float val = GetPortFloat ( pActInfo , 2 ) ; <nl> - const string & faction = GetPortString ( pActInfo , 3 ) ; <nl> - <nl> - AgentParameters ap = pAIActor - > GetParameters ( ) ; <nl> - switch ( param ) <nl> - { <nl> - case AIPARAM_FACTION : <nl> - ap . factionID = gEnv - > pAISystem - > GetFactionMap ( ) . GetFactionID ( faction . c_str ( ) ) ; <nl> - break ; <nl> - case AIPARAM_GROUPID : <nl> - ap . m_nGroup = ( int ) val ; <nl> - break ; <nl> - case AIPARAM_FORGETFULNESS : <nl> - ap . m_PerceptionParams . forgetfulness = val ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - pAIActor - > SetParameters ( ap ) ; <nl> - } <nl> - } <nl> - ; <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Make hunter ' s freezing beam follow the player but with <nl> - / / some limited speed to allow the player avoid the beam if he ' s <nl> - / / running fast enough <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_HunterShootTarget : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - IAIObject * m_pTarget ; <nl> - Vec3 m_targetPos ; <nl> - Vec3 m_lastPos ; <nl> - float m_startTime ; <nl> - float m_lastTime ; <nl> - float m_duration ; <nl> - <nl> - public : <nl> - CFlowNode_HunterShootTarget ( SActivationInfo * pActInfo ) <nl> - : m_pTarget ( nullptr ) <nl> - , m_targetPos ( ZERO ) <nl> - , m_lastPos ( ZERO ) <nl> - , m_startTime ( 0 . 0f ) <nl> - , m_lastTime ( 0 . 0f ) <nl> - , m_duration ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_HunterShootTarget ( pActInfo ) ; <nl> - } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Starts shooting " ) ) , <nl> - InputPortConfig < float > ( " Speed " , _HELP ( " Speed of oscillation " ) ) , <nl> - InputPortConfig < float > ( " Width " , _HELP ( " Width factor of oscillation " ) ) , <nl> - InputPortConfig < float > ( " Duration " , _HELP ( " Duration " ) ) , <nl> - InputPortConfig < float > ( " TargetAlignSpeed " , _HELP ( " Speed of aligning to target " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " targetPos " , _HELP ( " Target shooting position " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Switching species hostility on / off ( makes AI ignore enemies / be ignored ) . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_DEBUG ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Update ) <nl> - { <nl> - IAIObject * pAI = pActInfo - > pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - return ; <nl> - } <nl> - <nl> - float time = gEnv - > pTimer - > GetCurrTime ( ) ; <nl> - <nl> - float relTime = time - m_startTime ; <nl> - float timeStep = time - m_lastTime ; <nl> - m_lastTime = time ; <nl> - <nl> - if ( relTime > = m_duration ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - return ; <nl> - } <nl> - <nl> - Vec3 pos = pAI - > GetPos ( ) ; <nl> - <nl> - IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ; <nl> - if ( ! pAIActor ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - return ; <nl> - } <nl> - <nl> - IAIObject * pTarget = pAIActor - > GetAttentionTarget ( ) ; <nl> - <nl> - Vec3 targetPos ( m_lastPos ) ; <nl> - if ( pTarget & & ( pTarget = = m_pTarget | | Distance : : Point_PointSq ( pTarget - > GetPos ( ) , m_lastPos ) < 4 * 4 ) ) <nl> - targetPos = pTarget - > GetPos ( ) ; <nl> - <nl> - Vec3 fireDir = pos - targetPos ; <nl> - Vec3 fireDir2d ( fireDir . x , fireDir . y , 0 ) ; <nl> - Vec3 sideDir = fireDir . Cross ( fireDir2d ) ; <nl> - Vec3 upDir ( 0 , 0 , 1 ) ; / / = fireDir . Cross ( sideDir ) . normalized ( ) ; <nl> - sideDir . NormalizeSafe ( ) ; <nl> - <nl> - float dist = fireDir2d . GetLength2D ( ) ; <nl> - <nl> - Vec3 diffTarget = targetPos - m_targetPos ; <nl> - float distTarget = diffTarget . GetLength ( ) ; <nl> - <nl> - if ( timeStep & & distTarget > 0 . 05f ) <nl> - { <nl> - float alignSpeed = GetPortFloat ( pActInfo , 4 ) ; <nl> - <nl> - m_targetPos + = diffTarget . GetNormalizedSafe ( ) * timeStep * alignSpeed ; <nl> - / * <nl> - / / make m_lastPos follow m_targetPos with limited speed <nl> - Vec3 aim = targetPos + ( targetPos - m_targetPos ) * 2 . 0f ; <nl> - m_targetPos = targetPos ; <nl> - Vec3 dir = aim - m_lastPos ; <nl> - float maxDelta = GetPortFloat ( pActInfo , 1 ) * timeStep ; <nl> - if ( maxDelta > 0 ) <nl> - { <nl> - if ( dir . GetLengthSquared ( ) > maxDelta * maxDelta ) <nl> - dir . SetLength ( maxDelta ) ; <nl> - m_lastPos + = dir ; <nl> - } <nl> - * / <nl> - <nl> - } <nl> - <nl> - # ifndef PI <nl> - # define PI 3 . 14159265358979323f / * You know this number , don ' t you ? * / <nl> - # endif <nl> - const float maxAmp = 8 ; <nl> - float a = max ( 0 . f , ( m_duration * 0 . 6f - relTime ) / m_duration ) ; / / 0 . 6f = 60 % chasing target and 40 % exact aiming <nl> - float b = sinf ( relTime / m_duration * GetPortFloat ( pActInfo , 1 ) * 180 . 0f / PI ) ; <nl> - a * = a ; <nl> - <nl> - fireDir = pos - m_targetPos ; <nl> - fireDir2d . x = fireDir . x ; <nl> - fireDir2d . y = fireDir . y ; <nl> - sideDir = fireDir . Cross ( fireDir2d ) ; <nl> - sideDir . NormalizeSafe ( ) ; <nl> - <nl> - Vec3 result = m_targetPos - upDir * a * dist * maxAmp ; <nl> - <nl> - result . z - = 2 . 5f ; <nl> - <nl> - Vec3 actualCenteredFireDir ( result - pos ) ; <nl> - actualCenteredFireDir . NormalizeSafe ( ) ; <nl> - b * = GetPortFloat ( pActInfo , 2 ) * dist * a * ( 1 - actualCenteredFireDir . Dot ( - fireDir . GetNormalizedSafe ( ) ) ) ; <nl> - <nl> - result + = sideDir * b ; <nl> - <nl> - ActivateOutput ( pActInfo , 0 , result ) ; <nl> - <nl> - return ; <nl> - } <nl> - <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - if ( ! pActInfo - > pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pActInfo - > pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - return ; <nl> - <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( ! pPipeUser ) <nl> - return ; <nl> - <nl> - if ( IsPortActive ( pActInfo , 0 ) ) <nl> - { <nl> - m_pTarget = pPipeUser - > GetSpecialAIObject ( " atttarget " ) ; <nl> - if ( m_pTarget ) <nl> - { <nl> - m_lastTime = m_startTime = gEnv - > pTimer - > GetCurrTime ( ) ; <nl> - m_lastPos = m_targetPos = m_pTarget - > GetPos ( ) ; <nl> - m_duration = GetPortFloat ( pActInfo , 3 ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - } <nl> - } ; <nl> - } ; <nl> - <nl> - / * * <nl> - * Makes the Hunter ' s freeze beam sweep around without any specific target . <nl> - * / <nl> - / / Spinned off of CFlowNode_HunterShootTarget . <nl> - class CFlowNode_HunterBeamSweep : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - Vec3 m_targetPos ; <nl> - float m_startTime ; <nl> - float m_duration ; <nl> - <nl> - void ProcessActivate ( SActivationInfo * pActInfo ) <nl> - { <nl> - if ( ! IsPortActive ( pActInfo , 0 ) ) <nl> - return ; <nl> - <nl> - if ( ! pActInfo - > pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pActInfo - > pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - return ; <nl> - <nl> - m_startTime = gEnv - > pTimer - > GetCurrTime ( ) ; <nl> - m_targetPos = pAI - > GetPos ( ) + GetPortFloat ( pActInfo , 1 ) * pAI - > GetEntityDir ( ) ; <nl> - m_duration = GetPortFloat ( pActInfo , 6 ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - <nl> - void ProcessUpdate ( SActivationInfo * pActInfo ) <nl> - { <nl> - if ( ! pActInfo - > pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pActInfo - > pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - return ; <nl> - } <nl> - <nl> - float time = gEnv - > pTimer - > GetCurrTime ( ) ; <nl> - float relTime = time - m_startTime ; <nl> - if ( relTime > = m_duration ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - return ; <nl> - } <nl> - <nl> - Matrix34 worldTransform = pActInfo - > pEntity - > GetWorldTM ( ) ; <nl> - Vec3 fireDir = worldTransform . GetColumn1 ( ) ; <nl> - Vec3 sideDir = worldTransform . GetColumn0 ( ) ; <nl> - Vec3 upDir = worldTransform . GetColumn2 ( ) ; <nl> - <nl> - float baseDist = GetPortFloat ( pActInfo , 1 ) ; <nl> - float leftRightSpeed = GetPortFloat ( pActInfo , 2 ) ; <nl> - float width = GetPortFloat ( pActInfo , 3 ) ; <nl> - float nearFarSpeed = GetPortFloat ( pActInfo , 4 ) ; <nl> - float dist = GetPortFloat ( pActInfo , 5 ) ; <nl> - <nl> - / / runs from 0 to 2 * PI and indicates where in the 2 * PI long cycle we are now <nl> - float t = 2 * PI * relTime / m_duration ; <nl> - <nl> - / / NOTE Mrz 31 , 2007 : < pvl > essetially a Lissajous curve , with some <nl> - / / irregularity added by a higher frequency harmonic and offset vertically <nl> - / / because we don ' t want the hunter to shoot at the sky . <nl> - Vec3 result = pAI - > GetPos ( ) + <nl> - baseDist * fireDir + <nl> - dist * sinf ( nearFarSpeed * t ) * upDir + <nl> - 0 . 2f * dist * sinf ( 2 . 3f * nearFarSpeed * t + 1 . 0f / * phase shift * / ) * upDir + <nl> - - 1 . 8f * dist * upDir + <nl> - width * sinf ( leftRightSpeed * t ) * sideDir + <nl> - 0 . 2f * width * sinf ( 2 . 3f * leftRightSpeed * t + 1 . 0f / * phase shift * / ) * sideDir ; <nl> - <nl> - ActivateOutput ( pActInfo , 0 , result ) ; <nl> - } <nl> - <nl> - public : <nl> - CFlowNode_HunterBeamSweep ( SActivationInfo * pActInfo ) <nl> - : m_targetPos ( ZERO ) <nl> - , m_startTime ( 0 . 0f ) <nl> - , m_duration ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_HunterBeamSweep ( pActInfo ) ; <nl> - } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Starts shooting " ) ) , <nl> - InputPortConfig < float > ( " BaseDistance " , _HELP ( " Average distance around which sweeping will oscillate " ) ) , <nl> - InputPortConfig < float > ( " LeftRightSpeed " , _HELP ( " Speed of width oscillation " ) ) , <nl> - InputPortConfig < float > ( " Width " , _HELP ( " Amplitude of width oscillation " ) ) , <nl> - InputPortConfig < float > ( " NearFarSpeed " , _HELP ( " Speed of distance oscillation " ) ) , <nl> - InputPortConfig < float > ( " Distance " , _HELP ( " Amplitude of distance oscillation " ) ) , <nl> - InputPortConfig < float > ( " Duration " , _HELP ( " Duration " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " targetPos " , _HELP ( " Target shooting position " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Switching species hostility on / off ( makes AI ignore enemies / be ignored ) . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_DEBUG ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Update ) <nl> - { <nl> - ProcessUpdate ( pActInfo ) ; <nl> - } <nl> - else if ( event = = eFE_Activate ) <nl> - { <nl> - ProcessActivate ( pActInfo ) ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Nav cost factor <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIEventListener : public CFlowBaseNode < eNCT_Instanced > , IAIEvent <nl> TFlowNodeId m_nodeID ; <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Register an entity with the interest system <nl> - class CFlowNode_InterestingEntity : public CFlowBaseNode < eNCT_Instanced > , public IInterestListener <nl> - { <nl> - public : <nl> - enum EInputs <nl> - { <nl> - IN_REGISTER_INTERESTING , <nl> - IN_UNREGISTER_INTERESTING , <nl> - IN_RADIUS , <nl> - IN_INTEREST_LEVEL , <nl> - IN_ACTION , <nl> - IN_OFFSET , <nl> - IN_PAUSE , <nl> - IN_SHARED , <nl> - } ; <nl> - <nl> - enum EOutputs <nl> - { <nl> - OUT_ACTOR_INTERESTED , <nl> - OUT_ACTOR_NOT_INTERESTED , <nl> - OUT_ACTOR_ACTION_COMPLETE , <nl> - OUT_ACTOR_ACTION_ABORT , <nl> - } ; <nl> - <nl> - CFlowNode_InterestingEntity ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_nodeID = 0 ; <nl> - m_pGraph = NULL ; <nl> - m_EntityId = 0 ; <nl> - } <nl> - <nl> - virtual ~ CFlowNode_InterestingEntity ( void ) <nl> - { <nl> - ICentralInterestManager * pCIM = gEnv - > pAISystem - > GetCentralInterestManager ( ) ; <nl> - if ( m_EntityId ! = 0 & & pCIM ! = NULL ) <nl> - { <nl> - pCIM - > UnRegisterListener ( this , m_EntityId ) ; <nl> - m_EntityId = 0 ; <nl> - m_pGraph = NULL ; <nl> - } <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_InterestingEntity ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - ser . Value ( " m_EntityId " , m_EntityId ) ; <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " OnActorInterested " , _HELP ( " Outputs when an AI Entity gets interested in this . It carries the EntityId " ) ) , <nl> - OutputPortConfig < EntityId > ( " OnActorLoseInterest " , _HELP ( " Outputs when an AI Entity is no longer interested in this . It carries the EntityId " ) ) , <nl> - OutputPortConfig < EntityId > ( " OnActorCompleteAction " , _HELP ( " Outputs when AI Entity completes an action associated with becoming interseted . It carries the EntityId " ) ) , <nl> - OutputPortConfig < EntityId > ( " OnActorAbortAction " , _HELP ( " Outputs when an action is aborted associated with this interest target . It carries the EntityId " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SInputPortConfig in_ports [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Register " , _HELP ( " Register entity as interesting " ) ) , <nl> - InputPortConfig_Void ( " Unregister " , _HELP ( " Unregister entity as interesting " ) ) , <nl> - InputPortConfig < float > ( " Radius " , - 1 . 0f , _HELP ( " This object will be only interesting from this radius . Negative value will use previous setup " ) ) , <nl> - InputPortConfig < float > ( " InterestLevel " , - 1 . 0f , _HELP ( " Base interest level of object or minimum interest level of actor . Negative value will use previous setup " ) ) , <nl> - InputPortConfig < string > ( " Action " , _HELP ( " AI Action . If empty it will be used the instance value if any " ) , 0 ) , <nl> - InputPortConfig < Vec3 > ( " Offset " , Vec3 ( ZERO ) , _HELP ( " Offset from the pivot to determine visibility " ) , 0 ) , <nl> - InputPortConfig < float > ( " Pause " , - 1 . f , _HELP ( " Pause between successive uses of the same entity by the same AI " ) , 0 ) , <nl> - InputPortConfig < int > ( " Shared " , - 1 , _HELP ( " 1 if the entity can be used by more than one AI at the same time " ) , 0 ) , <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_ports ; <nl> - config . pOutputPorts = out_config ; <nl> - config . sDescription = _HELP ( " Registers an entity as interesting " ) ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = pActInfo - > pEntity ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - ICentralInterestManager * pCIM = gEnv - > pAISystem - > GetCentralInterestManager ( ) ; <nl> - <nl> - if ( event = = eFE_SetEntityId & & ( IsOutputConnected ( pActInfo , OUT_ACTOR_INTERESTED ) | | IsOutputConnected ( pActInfo , OUT_ACTOR_NOT_INTERESTED ) <nl> - | | IsOutputConnected ( pActInfo , OUT_ACTOR_ACTION_COMPLETE ) | | IsOutputConnected ( pActInfo , OUT_ACTOR_ACTION_ABORT ) ) ) <nl> - { <nl> - if ( m_EntityId ) <nl> - pCIM - > UnRegisterListener ( this , m_EntityId ) ; <nl> - pCIM - > RegisterListener ( this , pEntity - > GetId ( ) ) ; <nl> - m_EntityId = pEntity - > GetId ( ) ; <nl> - m_pGraph = pActInfo - > pGraph ; <nl> - m_nodeID = pActInfo - > myID ; <nl> - } <nl> - <nl> - if ( event = = eFE_Activate ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , IN_REGISTER_INTERESTING ) ) <nl> - { <nl> - pCIM - > RegisterListener ( this , pEntity - > GetId ( ) ) ; <nl> - float radius = GetPortFloat ( pActInfo , IN_RADIUS ) ; <nl> - float interestLevel = GetPortFloat ( pActInfo , IN_INTEREST_LEVEL ) ; <nl> - const string & action = GetPortString ( pActInfo , IN_ACTION ) ; <nl> - Vec3 offset = GetPortVec3 ( pActInfo , IN_OFFSET ) ; <nl> - float pause = GetPortFloat ( pActInfo , IN_PAUSE ) ; <nl> - int shared = GetPortInt ( pActInfo , IN_SHARED ) ; <nl> - <nl> - pCIM - > ChangeInterestingEntityProperties ( pEntity , radius , interestLevel , action . c_str ( ) , offset , pause , shared ) ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_UNREGISTER_INTERESTING ) ) <nl> - { <nl> - pCIM - > DeregisterInterestingEntity ( pEntity ) ; <nl> - / / if there are pending notifications , and we unregister , they would be missed . Not unregistering here should not be an issue anyway . <nl> - / / pCIM - > UnRegisterListener ( this , pEntity - > GetId ( ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void OnInterestEvent ( EInterestEvent event , EntityId idInterestedActor , EntityId idInterestingEntity ) <nl> - { <nl> - if ( m_pGraph ! = NULL & & m_nodeID ! = 0 & & idInterestingEntity = = m_EntityId ) <nl> - { <nl> - CRY_ASSERT ( m_pGraph - > IsEnabled ( ) & & ! m_pGraph - > IsSuspended ( ) & & m_pGraph - > IsActive ( ) ) ; <nl> - switch ( event ) <nl> - { <nl> - case IInterestListener : : eIE_InterestStart : <nl> - m_pGraph - > ActivatePort ( SFlowAddress ( m_nodeID , OUT_ACTOR_INTERESTED , true ) , idInterestedActor ) ; <nl> - break ; <nl> - case IInterestListener : : eIE_InterestStop : <nl> - m_pGraph - > ActivatePort ( SFlowAddress ( m_nodeID , OUT_ACTOR_NOT_INTERESTED , true ) , idInterestedActor ) ; <nl> - break ; <nl> - case IInterestListener : : eIE_InterestActionComplete : <nl> - m_pGraph - > ActivatePort ( SFlowAddress ( m_nodeID , OUT_ACTOR_ACTION_COMPLETE , true ) , idInterestedActor ) ; <nl> - break ; <nl> - case IInterestListener : : eIE_InterestActionAbort : <nl> - m_pGraph - > ActivatePort ( SFlowAddress ( m_nodeID , OUT_ACTOR_ACTION_ABORT , true ) , idInterestedActor ) ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - private : <nl> - <nl> - IFlowGraph * m_pGraph ; <nl> - TFlowNodeId m_nodeID ; <nl> - EntityId m_EntityId ; <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Register an entity with the interest system <nl> - class CFlowNode_Interested : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - enum EInputs <nl> - { <nl> - IN_REGISTER_INTERESTED , <nl> - IN_UNREGISTER_INTERESTED , <nl> - IN_INTEREST_FILTER , <nl> - IN_ANGLE <nl> - } ; <nl> - <nl> - CFlowNode_Interested ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - / / declare input ports <nl> - static const SInputPortConfig in_ports [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Register " , _HELP ( " Register entity as interested " ) ) , <nl> - InputPortConfig_Void ( " Unregister " , _HELP ( " Unregister entity as interested " ) ) , <nl> - InputPortConfig < float > ( " InterestFilter " , - 1 . 0f , _HELP ( " Minimum interest level of actor . Negative value will use previous setup " ) ) , <nl> - InputPortConfig < float > ( " Angle " , - 1 . 0f , _HELP ( " Actor will ignore object out of this angle . Negative value will use previous setup " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_ports ; <nl> - config . pOutputPorts = 0 ; <nl> - config . sDescription = _HELP ( " Registers an entity with the interest system " ) ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = pActInfo - > pEntity ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - if ( event = = eFE_Activate ) <nl> - { <nl> - ICentralInterestManager * pCIM = gEnv - > pAISystem - > GetCentralInterestManager ( ) ; <nl> - <nl> - if ( IsPortActive ( pActInfo , IN_REGISTER_INTERESTED ) ) <nl> - { <nl> - float interestLevel = GetPortFloat ( pActInfo , IN_INTEREST_FILTER ) ; <nl> - <nl> - float fAngleCos ; <nl> - float fAngleInDegrees = GetPortFloat ( pActInfo , IN_ANGLE ) ; <nl> - if ( fAngleInDegrees > = 0 . f ) <nl> - { <nl> - clamp_tpl ( fAngleInDegrees , 0 . f , 360 . f ) ; <nl> - fAngleCos = cos ( DEG2RAD ( . 5f * fAngleInDegrees ) ) ; <nl> - } <nl> - else <nl> - { <nl> - fAngleCos = - 100 ; / / Leave the angle ( cosine ) intact <nl> - } <nl> - <nl> - pCIM - > ChangeInterestedAIActorProperties ( pEntity , interestLevel , fAngleCos ) ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_UNREGISTER_INTERESTED ) ) <nl> - { <nl> - pCIM - > DeregisterInterestedAIActor ( pEntity ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> class CFlowNode_AICommunication : public CFlowBaseNode < eNCT_Instanced > <nl> class CFlowNode_AIFaction : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " AI : AIActiveCount " , CFlowNode_AIActiveCount ) <nl> + REGISTER_FLOW_NODE ( " AI : ActiveCount " , CFlowNode_AIActiveCount ) <nl> REGISTER_FLOW_NODE ( " AI : ActiveCountInFaction " , CFlowNode_AIActiveCountInFaction ) <nl> REGISTER_FLOW_NODE ( " AI : ActiveCountMonitor " , CFlowNode_AIActiveCountMonitor ) <nl> - REGISTER_FLOW_NODE ( " AI : AlertnessFilter " , CFlowNode_AIAlertnessFilter ) <nl> - / / REGISTER_FLOW_NODE ( " AI : AISignal " , CFlowNode_AISignal ) <nl> - REGISTER_FLOW_NODE ( " AI : AIEnable " , CFlowNode_AIEnable ) <nl> - REGISTER_FLOW_NODE ( " AI : AIIgnore " , CFlowNode_AIIgnore ) <nl> + REGISTER_FLOW_NODE ( " AI : IgnoreState " , CFlowNode_AIIgnore ) <nl> REGISTER_FLOW_NODE ( " AI : FactionReaction " , CFlowNode_AIFactionReaction ) <nl> REGISTER_FLOW_NODE ( " AI : SetFaction " , CFlowNode_AISetFaction ) <nl> - <nl> - REGISTER_FLOW_NODE ( " AI : Interested " , CFlowNode_Interested ) <nl> - REGISTER_FLOW_NODE ( " AI : InterestingEntity " , CFlowNode_InterestingEntity ) <nl> - <nl> REGISTER_FLOW_NODE ( " AI : ActionStart " , CFlowNode_AIActionStart ) <nl> REGISTER_FLOW_NODE ( " AI : ActionEnd " , CFlowNode_AIActionEnd ) <nl> REGISTER_FLOW_NODE ( " AI : ActionAbort " , CFlowNode_AIActionAbort ) <nl> - REGISTER_FLOW_NODE ( " AI : AIAttTarget " , CFlowNode_AIAttTarget ) <nl> + REGISTER_FLOW_NODE ( " AI : AttentionTarget " , CFlowNode_AIAttTarget ) <nl> REGISTER_FLOW_NODE ( " AI : SmartObjectHelper " , CFlowNode_AISOHelper ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGroupAlertness " , CFlowNode_AIGroupAlertness ) <nl> - REGISTER_FLOW_NODE ( " AI : AIMergeGroups " , CFlowNode_AIMergeGroups ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGroupBeacon " , CFlowNode_AIGroupBeacon ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGroupID " , CFlowNode_AIGroupID ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGroupCount " , CFlowNode_AIGroupCount ) <nl> + REGISTER_FLOW_NODE ( " AI : GroupAlertness " , CFlowNode_AIGroupAlertness ) <nl> + REGISTER_FLOW_NODE ( " AI : GroupIDSet " , CFlowNode_AIMergeGroups ) <nl> + REGISTER_FLOW_NODE ( " AI : GroupIDGet " , CFlowNode_AIGroupID ) <nl> + REGISTER_FLOW_NODE ( " AI : GroupCount " , CFlowNode_AIGroupCount ) <nl> REGISTER_FLOW_NODE ( " AI : SmartObjectEvent " , CFlowNode_AISmartObjectEvent ) <nl> REGISTER_FLOW_NODE ( " AI : PerceptionScale " , CFlowNode_AIPerceptionScale ) <nl> - REGISTER_FLOW_NODE ( " AI : ChangeParameter " , CFlowNode_AIChangeParameter ) <nl> - REGISTER_FLOW_NODE ( " AI : AISetNavCostFactor " , CFlowNode_AISetNavCostFactor ) <nl> + REGISTER_FLOW_NODE ( " AI : NavCostFactor " , CFlowNode_AISetNavCostFactor ) <nl> REGISTER_FLOW_NODE ( " AI : AutoDisable " , CFlowNode_AIAutoDisable ) <nl> - REGISTER_FLOW_NODE ( " Crysis : HunterShootTarget " , CFlowNode_HunterShootTarget ) <nl> - REGISTER_FLOW_NODE ( " Crysis : HunterBeamSweep " , CFlowNode_HunterBeamSweep ) <nl> - REGISTER_FLOW_NODE ( " AI : AIEnableShape " , CFlowNode_AIEnableShape ) <nl> - REGISTER_FLOW_NODE ( " AI : EventListener " , CFlowNode_AIEventListener ) <nl> + REGISTER_FLOW_NODE ( " AI : ShapeState " , CFlowNode_AIEnableShape ) <nl> + REGISTER_FLOW_NODE ( " Game : EventListener " , CFlowNode_AIEventListener ) <nl> REGISTER_FLOW_NODE ( " AI : Communication " , CFlowNode_AICommunication ) <nl> REGISTER_FLOW_NODE ( " AI : IsAliveCheck " , CFlowNode_AIIsAliveCheck ) <nl> REGISTER_FLOW_NODE ( " AI : AIGlobalPerceptionScaling " , CFlowNode_AIGlobalPerceptionScaling ) <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAIAction . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAIAction . cpp <nl> void CFlowNode_AISetState : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pAc <nl> m_EntityId = 0 ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Modify States <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIModifyStates : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig < string > ( " sostates_states " ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Adds / removes smart object states " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIModifyStates ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIModifyStates : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - gEnv - > pAISystem - > GetSmartObjectManager ( ) - > ModifySmartObjectStates ( GetEntity ( pActInfo ) , GetPortString ( pActInfo , 1 ) ) ; <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - ActivateOutput ( pActInfo , 1 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Check States <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AICheckStates : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Sync " , _HELP ( " for synchronization only " ) ) , <nl> - InputPortConfig < string > ( " sopattern_Pattern " , _HELP ( " states pattern to check " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " True " , _HELP ( " outputs the EntityId of the owner entity if its current smart object states are matching with the pattern " ) ) , <nl> - OutputPortConfig < EntityId > ( " False " , _HELP ( " outputs the EntityId of the owner entity if its current smart object states are not matching with the pattern " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " checks smart object states of the owner if they match the specified pattern " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AICheckStates ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AICheckStates : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( gEnv - > pAISystem - > GetSmartObjectManager ( ) - > CheckSmartObjectStates ( GetEntity ( pActInfo ) , GetPortString ( pActInfo , 1 ) ) ) <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - else <nl> - ActivateOutput ( pActInfo , 1 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Follow Path <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIFollowPath : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " sync " ) ) , <nl> - InputPortConfig_Void ( " Cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < bool > ( " PathFindToStart " , _HELP ( " Path - find to start of path " ) ) , <nl> - InputPortConfig < bool > ( " Reverse " , _HELP ( " Reverse the path direction " ) ) , <nl> - InputPortConfig < bool > ( " StartNearest " , false , _HELP ( " Starts the path at nearest point on path " ) ) , <nl> - InputPortConfig < int > ( " Loops " , 0 , _HELP ( " Number of times to loop around the path ( - 1 = forever ) " ) ) , <nl> - InputPortConfig < string > ( " PathName " , _HELP ( " Name of the path to follow " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " Done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " Succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " Fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " follow path action " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIFollowPath ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIFollowPath : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - bool pathFindToStart = GetPortBool ( pActInfo , 2 ) ; <nl> - bool reverse = GetPortBool ( pActInfo , 3 ) ; <nl> - bool nearest = GetPortBool ( pActInfo , 4 ) ; <nl> - int loops = GetPortInt ( pActInfo , 5 ) ; <nl> - const string & pathName = GetPortString ( pActInfo , 6 ) ; <nl> - <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - unsigned short int nType = pAI - > GetAIType ( ) ; <nl> - if ( ( nType ! = AIOBJECT_ACTOR ) & & ( nType ! = AIOBJECT_VEHICLE ) ) <nl> - return ; <nl> - <nl> - pAI - > CastToIAIActor ( ) - > SetPathToFollow ( pathName . c_str ( ) ) ; / / , pathFindToStart , reverse ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > point2 . x = ( float ) loops ; <nl> - pData - > fValue = 10 . 0f ; <nl> - pData - > point . x = pathFindToStart ? 1 . 0f : 0 . 0f ; <nl> - pData - > point . y = reverse ? 1 . 0f : 0 . 0f ; <nl> - pData - > point . z = nearest ? 1 . 0f : 0 . 0f ; <nl> - Execute ( pActInfo , " ACT_FOLLOWPATH " , pData ) ; <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Follow Path Speed Stance <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIFollowPathSpeedStance : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < bool > ( " PathFindToStart " , _HELP ( " Path - find to start of path " ) ) , <nl> - InputPortConfig < bool > ( " Reverse " , _HELP ( " Reverse the path direction " ) ) , <nl> - InputPortConfig < bool > ( " StartNearest " , false , _HELP ( " Starts the path at nearest point on path " ) ) , <nl> - InputPortConfig < int > ( " Loops " , 0 , _HELP ( " Number of times to loop around the path ( - 1 = forever ) " ) ) , <nl> - InputPortConfig < string > ( " path_name " , _HELP ( " Name of the path to follow " ) , " Path Name " ) , <nl> - InputPortConfig < int > ( " Run " , 1 , _HELP ( " Speed " ) , _HELP ( " Run " ) , _UICONFIG ( RUN_SPEED_UICONFIG ) ) , <nl> - InputPortConfig < int > ( " Stance " , 4 , _HELP ( " Stance " ) , _HELP ( " Stance " ) , _UICONFIG ( STANCE_UICONFIG ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Follow path speed stance action " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIFollowPathSpeedStance ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIFollowPathSpeedStance : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - bool pathFindToStart = GetPortBool ( pActInfo , 2 ) ; <nl> - bool reverse = GetPortBool ( pActInfo , 3 ) ; <nl> - bool nearest = GetPortBool ( pActInfo , 4 ) ; <nl> - int loops = GetPortInt ( pActInfo , 5 ) ; <nl> - const string & pathName = GetPortString ( pActInfo , 6 ) ; <nl> - int iSpeed = GetPortInt ( pActInfo , 7 ) ; <nl> - int iStance = GetPortInt ( pActInfo , 8 ) ; <nl> - <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - if ( IAIObject * pAI = pEntity - > GetAI ( ) ) <nl> - { <nl> - uint16 nType = pAI - > GetAIType ( ) ; <nl> - if ( ( nType ! = AIOBJECT_ACTOR ) & & ( nType ! = AIOBJECT_VEHICLE ) ) <nl> - return ; <nl> - <nl> - SetForceMethod ( pAI , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - SetStance ( pAI , iStance ) ; <nl> - SetSpeed ( pAI , iSpeed ) ; <nl> - <nl> - pAI - > CastToIAIActor ( ) - > SetPathToFollow ( pathName . c_str ( ) ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > point2 . x = ( float ) loops ; <nl> - pData - > point . x = pathFindToStart ? 1 . 0f : 0 . 0f ; <nl> - pData - > point . y = reverse ? 1 . 0f : 0 . 0f ; <nl> - pData - > point . z = nearest ? 1 . 0f : 0 . 0f ; <nl> - pData - > fValue = ( float ) iSpeed ; <nl> - Execute ( pActInfo , " ACT_FOLLOWPATH " , pData ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - CFlowNode_AIFollowPathSpeedStance : : EForceMethod CFlowNode_AIFollowPathSpeedStance : : GetForceMethod ( SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 9 ) ) ; / / Replace this number with an enum value <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Vehicle Follow Path <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CFlowNode_AIVehicleChaseTarget : : OnEntityEvent ( IEntity * pEntity , SEntityEven <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / GOTO <nl> + / / Look At <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGoto : : GetConfiguration ( SFlowNodeConfig & config ) <nl> + void CFlowNode_AILookAt : : GetConfiguration ( SFlowNodeConfig & config ) <nl> { <nl> static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < Vec3 > ( " pos " ) , <nl> - InputPortConfig < float > ( " distance " , 0 . 0f , _HELP ( " How accurately to position at the path end " ) , " EndAccuracy " ) , <nl> - InputPortConfig < float > ( " StopDistance " , 0 . 0f , _HELP ( " Stop this amount before the end of the path " ) ) , <nl> + InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> + InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> + InputPortConfig < Vec3 > ( " pos " , _HELP ( " point to look at " ) , _HELP ( " Point " ) ) , <nl> + InputPortConfig < Vec3 > ( " Direction " , _HELP ( " direction to look at " ) ) , <nl> + InputPortConfig < EntityId > ( " objectId " , _HELP ( " ID of the object to look at " ) ) , <nl> + InputPortConfig < float > ( " Duration " , _HELP ( " how long to look at [ in seconds ] " ) ) , <nl> + InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> { 0 } <nl> } ; <nl> static const SOutputPortConfig out_config [ ] = { <nl> void CFlowNode_AIGoto : : GetConfiguration ( SFlowNodeConfig & config ) <nl> OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> { 0 } <nl> } ; <nl> - config . sDescription = _HELP ( " goto action " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> + config . sDescription = _HELP ( " Sets AI to look at a point , entity or direction . " ) ; <nl> + config . nFlags | = EFLN_TARGET_ENTITY | EFLN_AISEQUENCE_SUPPORTED ; <nl> config . pInputPorts = in_config ; <nl> config . pOutputPorts = out_config ; <nl> config . SetCategory ( EFLN_APPROVED ) ; <nl> } <nl> <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGoto : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - / / Dynamically update the point to approach to . <nl> - if ( m_EntityId & & event = = eFE_Activate & & IsPortActive ( pActInfo , 2 ) ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - m_vDestination = GetPortVec3 ( pActInfo , 2 ) ; <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( pAI ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - / / First check is the current goal pipe the one which belongs to this node <nl> - if ( pPipeUser - > GetGoalPipeId ( ) = = m_GoalPipeId ) <nl> - { <nl> - pPipeUser - > SetRefPointPos ( m_vDestination ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ) <nl> - { <nl> - pAIActor - > GoTo ( m_vDestination ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - TBase : : ProcessEvent ( event , pActInfo ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIGoto ) <nl> + DEF_CLONE ( CFlowNode_AILookAt ) <nl> <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGoto : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> + CFlowNode_AILookAt : : EForceMethod CFlowNode_AILookAt : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> { <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > point = m_vDestination = GetPortVec3 ( pActInfo , 2 ) ; <nl> - pData - > fValue = GetPortFloat ( pActInfo , 3 ) ; <nl> - pData - > point2 . x = GetPortFloat ( pActInfo , 4 ) ; <nl> - Execute ( pActInfo , " ACT_GOTO " , pData ) ; <nl> + return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 6 ) ) ; <nl> } <nl> <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGoto : : OnResume ( SActivationInfo * pActInfo ) <nl> + void CFlowNode_AILookAt : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> { <nl> - if ( ! m_GoalPipeId ) <nl> + IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> + if ( ! pEntity ) <nl> return ; <nl> <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> + IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> + if ( ! pAI ) <nl> { <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - unsigned short int nType = pAI - > GetAIType ( ) ; <nl> - if ( ( nType ! = AIOBJECT_ACTOR ) & & ( nType ! = AIOBJECT_VEHICLE ) ) <nl> - return ; <nl> + Cancel ( ) ; <nl> + return ; <nl> + } <nl> <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - / / First check is the current goal pipe the one which belongs to this node <nl> - if ( pPipeUser - > GetGoalPipeId ( ) = = m_GoalPipeId ) <nl> - { <nl> - / / restore his refPoint position <nl> - pPipeUser - > SetRefPointPos ( m_vDestination ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ) <nl> - { <nl> - pAIActor - > GoTo ( m_vDestination ) ; <nl> - } <nl> - } <nl> + IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ; <nl> + if ( ! pAIActor ) <nl> + { <nl> + Cancel ( ) ; <nl> + return ; <nl> } <nl> - } <nl> <nl> - void CFlowNode_AIGoto : : Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - TBase : : Serialize ( pActInfo , ser ) ; <nl> - ser . Value ( " m_vDestination " , m_vDestination ) ; <nl> - } <nl> + Vec3 pos = GetPortVec3 ( pActInfo , 2 ) ; <nl> + Vec3 dir = GetPortVec3 ( pActInfo , 3 ) ; <nl> + EntityId objectEntityId = GetPortEntityId ( pActInfo , 4 ) ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / GOTO - Also sets speed and stance <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGotoSpeedStance : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < Vec3 > ( " pos " ) , <nl> - InputPortConfig < float > ( " distance " , 0 . 0f , _HELP ( " How accurately to position at the path end " ) , " EndAccuracy " ) , <nl> - InputPortConfig < float > ( " StopDistance " , 0 . 0f , _HELP ( " Stop this amount before the end of the path " ) ) , <nl> - InputPortConfig < int > ( " Run " , 1 , _HELP ( " Speed " ) , _HELP ( " Run " ) , _UICONFIG ( RUN_SPEED_UICONFIG ) ) , <nl> - InputPortConfig < int > ( " Stance " , 4 , _HELP ( " Stance " ) , _HELP ( " Stance " ) , _UICONFIG ( STANCE_UICONFIG ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - InputPortConfig < bool > ( " allowStrafing " , false , _HELP ( " Allow strafing " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Goto speed stance action . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - <nl> - CFlowNode_AIGotoSpeedStance : : EForceMethod CFlowNode_AIGotoSpeedStance : : GetForceMethod ( SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 7 ) ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIGotoSpeedStance : : OnResume ( SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - unsigned short int nType = pAI - > GetAIType ( ) ; <nl> - if ( ( nType ! = AIOBJECT_ACTOR ) & & ( nType ! = AIOBJECT_VEHICLE ) ) <nl> - return ; <nl> - <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - / / First check is the current goal pipe the one which belongs to this node <nl> - if ( pPipeUser - > GetGoalPipeId ( ) = = m_GoalPipeId ) <nl> - { <nl> - / / restore his refPoint position <nl> - pPipeUser - > SetRefPointPos ( m_vDestination ) ; <nl> - <nl> - / / restore his speed , stance and allowstrafing <nl> - SetStance ( pAI , m_iStance ) ; <nl> - SetSpeed ( pAI , m_iSpeed ) ; <nl> - SetAllowStrafing ( pAI , m_bAllowStrafing ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ) <nl> - { <nl> - pAIActor - > GoTo ( m_vDestination ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGotoSpeedStance : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( m_EntityId & & event = = eFE_Activate & & IsPortActive ( pActInfo , 2 ) ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - m_vDestination = GetPortVec3 ( pActInfo , 2 ) ; <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( pAI ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - / / First check is the current goal pipe the one which belongs to this node <nl> - if ( pPipeUser - > GetGoalPipeId ( ) = = m_GoalPipeId ) <nl> - { <nl> - pPipeUser - > SetRefPointPos ( m_vDestination ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ) <nl> - { <nl> - pAIActor - > GoTo ( m_vDestination ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - TBase : : ProcessEvent ( event , pActInfo ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIGotoSpeedStance ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGotoSpeedStance : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - m_iSpeed = GetPortInt ( pActInfo , 5 ) ; <nl> - m_iStance = GetPortInt ( pActInfo , 6 ) ; <nl> - m_bAllowStrafing = GetPortBool ( pActInfo , 8 ) ; <nl> - <nl> - IAIObject * pAI = GetEntity ( pActInfo ) - > GetAI ( ) ; <nl> - if ( pAI ) <nl> - { <nl> - SetStance ( pAI , m_iStance ) ; <nl> - SetSpeed ( pAI , m_iSpeed ) ; <nl> - SetAllowStrafing ( pAI , m_bAllowStrafing ) ; <nl> - } <nl> - <nl> - SetForceMethod ( pAI , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > point = m_vDestination = GetPortVec3 ( pActInfo , 2 ) ; <nl> - pData - > fValue = GetPortFloat ( pActInfo , 3 ) ; <nl> - pData - > point2 . x = GetPortFloat ( pActInfo , 4 ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_GOTO " , pData ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIGotoSpeedStance : : Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - TBase : : Serialize ( pActInfo , ser ) ; <nl> - <nl> - ser . Value ( " m_vDestination " , m_vDestination ) ; <nl> - ser . Value ( " m_iStance " , m_iStance ) ; <nl> - ser . Value ( " m_iSpeed " , m_iSpeed ) ; <nl> - ser . Value ( " m_bAllowStrafing " , m_bAllowStrafing ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Look At <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AILookAt : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < Vec3 > ( " pos " , _HELP ( " point to look at " ) , _HELP ( " Point " ) ) , <nl> - InputPortConfig < Vec3 > ( " Direction " , _HELP ( " direction to look at " ) ) , <nl> - InputPortConfig < EntityId > ( " objectId " , _HELP ( " ID of the object to look at " ) ) , <nl> - InputPortConfig < float > ( " Duration " , _HELP ( " how long to look at [ in seconds ] " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Sets AI to look at a point , entity or direction . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY | EFLN_AISEQUENCE_SUPPORTED ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AILookAt ) <nl> - <nl> - CFlowNode_AILookAt : : EForceMethod CFlowNode_AILookAt : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 6 ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AILookAt : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - { <nl> - Cancel ( ) ; <nl> - return ; <nl> - } <nl> - <nl> - IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ; <nl> - if ( ! pAIActor ) <nl> - { <nl> - Cancel ( ) ; <nl> - return ; <nl> - } <nl> - <nl> - Vec3 pos = GetPortVec3 ( pActInfo , 2 ) ; <nl> - Vec3 dir = GetPortVec3 ( pActInfo , 3 ) ; <nl> - EntityId objectEntityId = GetPortEntityId ( pActInfo , 4 ) ; <nl> - <nl> - if ( ! pos . IsZero ( 0 . 001f ) | | ! dir . IsZero ( 0 . 001f ) | | ( objectEntityId ! = 0 ) ) <nl> - { <nl> - / / activate look at <nl> - m_startTime = 0 . f ; <nl> - m_bExecuted = true ; <nl> - ClearLookTarget ( ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> + if ( ! pos . IsZero ( 0 . 001f ) | | ! dir . IsZero ( 0 . 001f ) | | ( objectEntityId ! = 0 ) ) <nl> + { <nl> + / / activate look at <nl> + m_startTime = 0 . f ; <nl> + m_bExecuted = true ; <nl> + ClearLookTarget ( ) ; <nl> + pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> <nl> SetForceMethod ( pAI , GetForceMethod ( pActInfo ) ) ; <nl> } <nl> void CFlowNode_AIUnload : : UnregisterEvents ( ) <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / speed controller <nl> + / / drop object <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AISpeed : : GetConfiguration ( SFlowNodeConfig & config ) <nl> + void CFlowNode_AIDropObject : : GetConfiguration ( SFlowNodeConfig & config ) <nl> { <nl> static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig < int > ( " run " , 1 , _HELP ( " 0 = very slow \ n1 = normal ( walk ) \ n2 = fast ( run ) \ n3 = very fast ( sprint ) - ve should reverse " ) ) , <nl> + InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> + InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> + InputPortConfig < Vec3 > ( " impulse " , _HELP ( " use for throwing " ) ) , <nl> + InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> { 0 } <nl> } ; <nl> static const SOutputPortConfig out_config [ ] = { <nl> void CFlowNode_AISpeed : : GetConfiguration ( SFlowNodeConfig & config ) <nl> OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> { 0 } <nl> } ; <nl> - config . sDescription = _HELP ( " movement speed controller " ) ; <nl> + config . sDescription = _HELP ( " Drops grabbed object . " ) ; <nl> config . pInputPorts = in_config ; <nl> config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> + config . nFlags | = EFLN_TARGET_ENTITY | EFLN_AISEQUENCE_SUPPORTED ; <nl> config . SetCategory ( EFLN_APPROVED ) ; <nl> } <nl> <nl> - DEF_CLONE ( CFlowNode_AISpeed ) <nl> + DEF_CLONE ( CFlowNode_AIDropObject ) <nl> <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AISpeed : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> + CFlowNode_AIDropObject : : EForceMethod CFlowNode_AIDropObject : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> { <nl> - / / AISIGNAL_EXTRA_DATA data ( GetPortInt ( pActInfo , 1 ) ) ; <nl> - / / Execute ( pActInfo , " ACT_SPEED " , & data ) ; <nl> - <nl> - / / signal version replaced with immediate version to avoid making this action blocking <nl> - IAIObject * pAI = GetEntity ( pActInfo ) - > GetAI ( ) ; <nl> - if ( ! pAI ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - ActivateOutput ( pActInfo , 2 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> - return ; <nl> - } <nl> + return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> + } <nl> <nl> - int iSpeed = GetPortInt ( pActInfo , 1 ) ; <nl> - SetSpeed ( pAI , iSpeed ) ; <nl> + / / <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + void CFlowNode_AIDropObject : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> + { <nl> + IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> + SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - ActivateOutput ( pActInfo , 1 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> + IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> + pData - > point = GetPortVec3 ( pActInfo , 2 ) ; <nl> + Execute ( pActInfo , " ACT_DROP_OBJECT " , pData ) ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / Uses an object <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_DebugAISpeed : : GetConfiguration ( SFlowNodeConfig & config ) <nl> + void CFlowNode_AIUseObject : : GetConfiguration ( SFlowNodeConfig & config ) <nl> { <nl> static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig < float > ( " speed " , 0 . 4f , _HELP ( " 0 . 0 - stop \ n0 . 1 - very slow ( AI lower limit ) \ n0 . 2 - slow \ n0 . 4 - walk \ n1 . 0 - run \ n1 . 3 - sprint \ n1 . 6 - AI upper limit " ) ) , <nl> + InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> + InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> + InputPortConfig < EntityId > ( " objectId " , " Entity ID of the object which should be used by the agent " ) , <nl> + InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> { 0 } <nl> } ; <nl> static const SOutputPortConfig out_config [ ] = { <nl> void CFlowNode_DebugAISpeed : : GetConfiguration ( SFlowNodeConfig & config ) <nl> OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> { 0 } <nl> } ; <nl> - config . sDescription = _HELP ( " This node should be used only for debugging ! \ nSets the speed urgency ( pseudospeed ) in the same range as AI would request it from game . " ) ; <nl> + config . sDescription = _HELP ( " Uses an object " ) ; <nl> + config . nFlags | = EFLN_TARGET_ENTITY ; <nl> config . pInputPorts = in_config ; <nl> config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> config . SetCategory ( EFLN_APPROVED ) ; <nl> } <nl> <nl> - DEF_CLONE ( CFlowNode_DebugAISpeed ) <nl> + DEF_CLONE ( CFlowNode_AIUseObject ) <nl> <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_DebugAISpeed : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> + CFlowNode_AIUseObject : : EForceMethod CFlowNode_AIUseObject : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> { <nl> - IAIActor * pAIActor = CastToIAIActorSafe ( GetEntity ( pActInfo ) - > GetAI ( ) ) ; <nl> - if ( ! pAIActor ) <nl> - { <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - ActivateOutput ( pActInfo , 2 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> - return ; <nl> - } <nl> + return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> + } <nl> <nl> - pAIActor - > GetState ( ) . fMovementUrgency = GetPortFloat ( pActInfo , 1 ) ; <nl> + / / <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + void CFlowNode_AIUseObject : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> + { <nl> + IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> + SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> <nl> - ActivateOutput ( pActInfo , 0 , m_EntityId ) ; <nl> - ActivateOutput ( pActInfo , 1 , m_EntityId ) ; <nl> - m_bExecuted = false ; <nl> - m_bSynchronized = false ; <nl> - m_EntityId = 0 ; <nl> + Execute ( pActInfo , " ACT_USEOBJECT " , NULL , GetPortEntityId ( pActInfo , 2 ) ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / animation controller <nl> + / / Makes ai enter specified seat of specified vehicle <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - CFlowNode_AIAnim : : ~ CFlowNode_AIAnim ( ) <nl> + void CFlowNode_AIEnterVehicle : : GetConfiguration ( SFlowNodeConfig & config ) <nl> { <nl> - OnCancel ( ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnim : : OnCancelPortActivated ( IPipeUser * pPipeUser , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( m_iMethod = = 2 ) / / is method = = Action ? <nl> - { <nl> - pPipeUser - > RemoveSubPipe ( m_GoalPipeId , true ) ; <nl> - OnCancel ( ) ; / / only to reuse unregistering code <nl> - } <nl> - else <nl> - pPipeUser - > CancelSubPipe ( m_GoalPipeId ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnim : : OnCancel ( ) <nl> - { <nl> - if ( m_pAGState ) <nl> - { <nl> - m_pAGState - > RemoveListener ( this ) ; <nl> - <nl> - switch ( m_iMethod ) <nl> - { <nl> - case 0 : <nl> - if ( ! m_bStarted ) <nl> - m_pAGState - > ClearForcedStates ( ) ; <nl> - break ; <nl> - case 1 : <nl> - if ( ! m_bStarted ) <nl> - m_pAGState - > SetInput ( " Signal " , " none " ) ; <nl> - m_pAGState - > Hurry ( ) ; <nl> - break ; <nl> - case 2 : <nl> - m_pAGState - > SetInput ( " Action " , " idle " ) ; <nl> - break ; <nl> - } <nl> - <nl> - m_pAGState = NULL ; <nl> - m_queryID = 0 ; <nl> - m_bStarted = false ; <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIAnim : : DestroyedState ( IAnimationGraphState * ) <nl> - { <nl> - m_pAGState = NULL ; <nl> - m_queryID = 0 ; <nl> - m_bStarted = false ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnim : : OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) <nl> - { <nl> - TBase : : OnEntityEvent ( pEntity , event ) ; <nl> - <nl> - if ( event . event = = ENTITY_EVENT_POST_SERIALIZE ) <nl> - { <nl> - if ( IActor * pActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) - > GetActor ( m_EntityId ) ) <nl> - { <nl> - m_pAGState = pActor - > GetAnimationGraphState ( ) ; <nl> - if ( m_pAGState ! = NULL ) <nl> - { <nl> - m_pAGState - > AddListener ( " aianim " , this ) ; <nl> - <nl> - if ( ! m_bStarted ) <nl> - { <nl> - IAnimationGraphState : : InputID inputID = ( IAnimationGraphState : : InputID ) - 1 ; <nl> - switch ( m_iMethod ) <nl> - { <nl> - case 1 : / / use " signal " <nl> - inputID = m_pAGState - > GetInputId ( " Signal " ) ; <nl> - break ; <nl> - case 2 : / / use " action " <nl> - inputID = m_pAGState - > GetInputId ( " Action " ) ; <nl> - break ; <nl> - } <nl> - if ( inputID ! = ( IAnimationGraphState : : InputID ) - 1 ) <nl> - { <nl> - char inputValue [ 256 ] ; <nl> - m_pAGState - > GetInput ( inputID , inputValue ) ; <nl> - m_pAGState - > SetInput ( inputID , inputValue , & m_queryID ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( m_iMethod < = 1 ) <nl> - m_pAGState - > QueryLeaveState ( & m_queryID ) ; <nl> - else <nl> - m_pAGState - > QueryChangeInput ( " Action " , & m_queryID ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIAnim : : Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - TBase : : Serialize ( pActInfo , ser ) ; <nl> - <nl> - ser . Value ( " m_bStarted " , m_bStarted ) ; <nl> - ser . Value ( " m_iMethod " , m_iMethod ) ; <nl> - <nl> - if ( ser . IsReading ( ) & & m_pAGState ! = NULL ) <nl> - { <nl> - m_pAGState - > RemoveListener ( this ) ; <nl> - m_pAGState = NULL ; <nl> - } <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIAnim : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution ( or stops the action ) " ) ) , <nl> - InputPortConfig < string > ( " animstateEx_name " , _HELP ( " name of animation to be played " ) ) , <nl> - InputPortConfig < int > ( " signal " , 1 , _HELP ( " which method to use " ) , _HELP ( " Method " ) , _UICONFIG ( " enum_int : Signal = 1 , Action = 2 " ) ) , <nl> - / / InputPortConfig < int > ( " count " , 1 , _HELP ( " OBSOLETE PORT ! ! ! Don ' t use it ! Will be removed soon . . . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - OutputPortConfig < EntityId > ( " start " , _HELP ( " activated on animation start " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Plays animation " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIAnim ) <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIAnim : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IActor * pActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) - > GetActor ( m_EntityId ) ; <nl> - if ( pActor ) <nl> - { <nl> - m_pAGState = pActor - > GetAnimationGraphState ( ) ; <nl> - if ( ! m_pAGState ) <nl> - return ; <nl> - m_pAGState - > AddListener ( " aianim " , this ) ; <nl> - <nl> - m_iMethod = GetPortInt ( pActInfo , 3 ) ; <nl> - switch ( m_iMethod ) <nl> - { <nl> - case 0 : / / forced state <nl> - m_pAGState - > PushForcedState ( GetPortString ( pActInfo , 2 ) , & m_queryID ) ; <nl> - break ; <nl> - case 1 : / / use " signal " <nl> - m_pAGState - > SetInput ( " Signal " , GetPortString ( pActInfo , 2 ) , & m_queryID ) ; <nl> - break ; <nl> - case 2 : / / use " action " <nl> - m_pAGState - > SetInput ( " Action " , GetPortString ( pActInfo , 2 ) , & m_queryID ) ; <nl> - break ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - CRY_ASSERT ( 0 ) ; <nl> - } <nl> - <nl> - if ( ! m_bStarted ) <nl> - Execute ( pActInfo , " ACT_ANIM " ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIAnim : : QueryComplete ( TAnimationGraphQueryID queryID , bool succeeded ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - if ( queryID ! = m_queryID ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - <nl> - if ( succeeded | | m_bStarted & & m_iMethod = = 2 ) <nl> - { <nl> - if ( ! m_bStarted ) <nl> - { <nl> - m_bStarted = true ; <nl> - <nl> - / / if " signal " wait to leave current state <nl> - / / if " action " wait for input value change <nl> - if ( m_iMethod < = 1 ) <nl> - m_pAGState - > QueryLeaveState ( & m_queryID ) ; <nl> - else <nl> - m_pAGState - > QueryChangeInput ( " Action " , & m_queryID ) ; <nl> - <nl> - / / activate " Start " output port <nl> - SFlowAddress start ( m_nodeID , 3 , true ) ; <nl> - m_pGraph - > ActivatePort ( start , m_EntityId ) ; <nl> - } <nl> - else <nl> - { <nl> - if ( pAI ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - pPipeUser - > RemoveSubPipe ( m_GoalPipeId , true ) ; <nl> - } <nl> - <nl> - if ( m_pAGState ) <nl> - { <nl> - m_pAGState - > RemoveListener ( this ) ; <nl> - <nl> - m_pAGState = NULL ; <nl> - m_queryID = 0 ; <nl> - m_bStarted = false ; <nl> - } <nl> - } <nl> - } <nl> - else if ( pAI ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - pPipeUser - > CancelSubPipe ( m_GoalPipeId ) ; <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / AIAnimEx <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - void CFlowNode_AIAnimEx : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Sync " , _HELP ( " for synchronization only " ) ) , <nl> - InputPortConfig_Void ( " Cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < bool > ( " OneShot " , true , _HELP ( " True if it ' s an one shot animation ( signal ) \ nFalse if it ' s a looping animation ( action ) " ) ) , <nl> - InputPortConfig < string > ( " animstateEx_Animation " , _HELP ( " name of animation to be played " ) ) , <nl> - InputPortConfig < int > ( " Speed " , - 1 , _HELP ( " speed while approaching the point " ) , <nl> - NULL , _UICONFIG ( " enum_int : < ignore > = - 1 , Very Slow = 0 , Normal / Walk = 1 , Fast / Run = 2 , Very Fast / Sprint = 3 " ) ) , <nl> - InputPortConfig < int > ( " Stance " , - 1 , _HELP ( " body stance while approaching the point " ) , <nl> - NULL , _UICONFIG ( " enum_int : < ignore > = - 1 , Prone = 0 , Crouch = 1 , Combat = 2 , CombatAlerted = 3 , Relaxed = 4 , Stealth = 5 " ) ) , <nl> - InputPortConfig < Vec3 > ( " Position " , _HELP ( " where to play the animation " ) ) , <nl> - InputPortConfig < Vec3 > ( " StartRadius " , Vec3 ( . 1f , . 1f , . 1f ) , _HELP ( " tolerance from where to start the animation " ) ) , <nl> - InputPortConfig < Vec3 > ( " Direction " , _HELP ( " forward dir . while playing the animation " ) ) , <nl> - InputPortConfig < float > ( " DirTolerance " , 180 . 0f , _HELP ( " direction tolerance " ) ) , <nl> - InputPortConfig < float > ( " TargetRadius " , . 05f , _HELP ( " tolerance where to end the animation " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - OutputPortConfig < EntityId > ( " start " , _HELP ( " activated on animation start " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Plays an exactly positioned animation " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIAnimEx ) <nl> - <nl> - void CFlowNode_AIAnimEx : : DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) return ; <nl> - <nl> - if ( pAI - > GetAIType ( ) ! = AIOBJECT_ACTOR ) <nl> - return ; <nl> - <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( ! pPipeUser ) <nl> - return ; <nl> - <nl> - m_bOneShot = GetPortBool ( pActInfo , 2 ) ; <nl> - const string & sAnimation = GetPortString ( pActInfo , 3 ) ; <nl> - m_iSpeed = GetPortInt ( pActInfo , 4 ) ; <nl> - m_iStance = GetPortInt ( pActInfo , 5 ) ; <nl> - m_vPos = GetPortVec3 ( pActInfo , 6 ) ; <nl> - if ( m_vPos . IsZero ( ) ) <nl> - m_vPos = pAI - > GetPos ( ) ; <nl> - Vec3 vStartRadius = GetPortVec3 ( pActInfo , 7 ) ; <nl> - m_vDir = GetPortVec3 ( pActInfo , 8 ) ; <nl> - if ( m_vDir . IsZero ( ) ) <nl> - m_vDir = pAI - > GetMoveDir ( ) ; <nl> - m_vDir . Normalize ( ) ; <nl> - float fDirTolerance = GetPortFloat ( pActInfo , 9 ) ; <nl> - float fTargetRadius = GetPortFloat ( pActInfo , 10 ) ; <nl> - <nl> - / / Check if animation is valid <nl> - if ( ! gEnv - > IsEditor ( ) | | IsValidAnimationInputValue ( pEntity , sAnimation . c_str ( ) , m_bOneShot ) ) <nl> - { <nl> - / / set the stance and speed <nl> - if ( m_iStance > = 0 ) <nl> - SetStance ( pAI , m_iStance ) ; <nl> - if ( m_iSpeed > = 0 ) <nl> - SetSpeed ( pAI , m_iSpeed ) ; <nl> - <nl> - / / set the refPoint position and orientation <nl> - pPipeUser - > SetRefPointPos ( m_vPos , m_vDir ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > iValue2 = m_bOneShot ? 1 : 0 ; <nl> - pData - > SetObjectName ( sAnimation ) ; <nl> - pData - > point = vStartRadius ; <nl> - pData - > fValue = fDirTolerance ; <nl> - pData - > point2 . x = fTargetRadius ; <nl> - <nl> - CRY_ASSERT ( m_State = = eS_Disabled ) ; <nl> - m_State = eS_Requested ; <nl> - <nl> - Execute ( pActInfo , " ACT_ANIMEX " , pData ) ; <nl> - } <nl> - else <nl> - { <nl> - CryWarning ( VALIDATOR_MODULE_FLOWGRAPH , VALIDATOR_WARNING , " AI : AnimEx node has invalid animation input for entity \ ' % s \ ' : % s " , pEntity - > GetName ( ) , sAnimation . c_str ( ) ) ; <nl> - Cancel ( ) ; <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : OnResume ( IFlowNode : : SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( ! pAI ) return ; <nl> - <nl> - if ( pAI - > GetAIType ( ) ! = AIOBJECT_ACTOR ) <nl> - return ; <nl> - <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( ! pPipeUser ) <nl> - return ; <nl> - <nl> - / / First check is the current goal pipe the one which belongs to this node <nl> - if ( pPipeUser - > GetGoalPipeId ( ) = = m_GoalPipeId ) <nl> - { <nl> - / / restore the refPoint position <nl> - pPipeUser - > SetRefPointPos ( m_vPos , m_vDir ) ; <nl> - <nl> - / / restore the speed and stance <nl> - if ( m_iStance > = 0 ) <nl> - SetStance ( pAI , m_iStance ) ; <nl> - if ( m_iSpeed > = 0 ) <nl> - SetSpeed ( pAI , m_iSpeed ) ; <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : OnCancel ( ) <nl> - { <nl> - if ( IEntity * entity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ) <nl> - { <nl> - if ( IAIObject * ai = entity - > GetAI ( ) ) <nl> - { <nl> - if ( IAIActor * actor = ai - > CastToIAIActor ( ) ) <nl> - { <nl> - actor - > SetSignal ( AISIGNAL_DEFAULT , " AnimationCanceled " ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : OnGoalPipeEvent ( IPipeUser * pPipeUser , EGoalPipeEvent event , int goalPipeId , bool & unregisterListenerAfterEvent ) <nl> - { <nl> - TBase : : OnGoalPipeEvent ( pPipeUser , event , goalPipeId , unregisterListenerAfterEvent ) ; <nl> - if ( m_GoalPipeId = = goalPipeId & & event = = ePN_AnimStarted ) <nl> - { <nl> - / / activate " Start " output port <nl> - SFlowAddress start ( m_nodeID , 3 , true ) ; <nl> - m_pGraph - > ActivatePort ( start , m_EntityId ) ; <nl> - <nl> - CRY_ASSERT ( m_State = = eS_Requested ) ; <nl> - m_State = eS_Started ; <nl> - } <nl> - } <nl> - <nl> - bool CFlowNode_AIAnimEx : : IsValidAnimationInputValue ( IEntity * pEntity , const char * szAnimation , bool bIsOneShot ) const <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : OnCancelPortActivated ( IPipeUser * pPipeUser , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( m_State ! = eS_Disabled ) <nl> - { <nl> - / / Cancel actortarget request <nl> - / / note this doesn ' t properly cancel the exactpositioning yet : AIHandler doesn ' t handle canceling and exactpositioning doesn ' t seem to support it <nl> - pPipeUser - > ClearActorTargetRequest ( ) ; <nl> - <nl> - / / Cancel pending or running animation ( this should be handled by canceling exactpositioning imo ) <nl> - if ( IActor * pActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetIActorSystem ( ) - > GetActor ( m_EntityId ) ) <nl> - { <nl> - IAnimationGraphState * pAGState = pActor - > GetAnimationGraphState ( ) ; <nl> - <nl> - if ( m_bOneShot ) <nl> - { <nl> - if ( m_State = = eS_Requested ) <nl> - { <nl> - pAGState - > SetInput ( " Signal " , " none " ) ; / / cancel any pending signals in case they haven ' t been processed yet <nl> - } <nl> - pAGState - > Hurry ( ) ; / / Force graph out of any signaled , hurryable state <nl> - } <nl> - else <nl> - { <nl> - / / Unfortunately this doesn ' t work as the exactpositioning code is not properly canceled when the actor <nl> - / / target request is removed , and it keeps forcing the Action to whatever it was <nl> - / / pAGState - > SetInput ( " Action " , " idle " ) ; / / cancel any pending or running actions <nl> - } <nl> - } <nl> - } <nl> - <nl> - TBase : : OnCancelPortActivated ( pPipeUser , pActInfo ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - TBase : : Serialize ( pActInfo , ser ) ; <nl> - <nl> - ser . Value ( " m_bOneShot " , m_bOneShot ) ; <nl> - ser . Value ( " m_State " , * alias_cast < int * > ( & m_State ) ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIAnimEx : : PreExecute ( SActivationInfo * pActInfo ) <nl> - { <nl> - TBase : : PreExecute ( pActInfo ) ; <nl> - <nl> - m_State = eS_Disabled ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / grab object <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGrabObject : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < EntityId > ( " objectId " , _HELP ( " object to be grabbed " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Grabs an object . " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIGrabObject ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIGrabObject : : EForceMethod CFlowNode_AIGrabObject : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIGrabObject : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_GRAB_OBJECT " , NULL , GetPortEntityId ( pActInfo , 2 ) ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / drop object <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIDropObject : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < Vec3 > ( " impulse " , _HELP ( " use for throwing " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Drops grabbed object . " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY | EFLN_AISEQUENCE_SUPPORTED ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIDropObject ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIDropObject : : EForceMethod CFlowNode_AIDropObject : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIDropObject : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > point = GetPortVec3 ( pActInfo , 2 ) ; <nl> - Execute ( pActInfo , " ACT_DROP_OBJECT " , pData ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / draws weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponDraw : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Force AI to draw holstered weapon . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIWeaponDraw ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIWeaponDraw : : EForceMethod CFlowNode_AIWeaponDraw : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 1 ) ) ; <nl> - } <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponDraw : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_WEAPONDRAW " ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / holsters weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponHolster : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Force AI to holster current weapon . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIWeaponHolster ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIWeaponHolster : : EForceMethod CFlowNode_AIWeaponHolster : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 1 ) ) ; <nl> - } <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponHolster : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_WEAPONHOLSTER " ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Shoot at given point <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < Vec3 > ( " targetPos " , _HELP ( " Position to shoot or aim at ( dynamically updated ) . If TargetId is specified it will override this parameter . " ) , _HELP ( " TargetPos " ) ) , <nl> - InputPortConfig < float > ( " time " , 1 . 0f , _HELP ( " How long to shoot " ) , _HELP ( " Duration " ) ) , <nl> - InputPortConfig < int > ( " shots " , - 1 , _HELP ( " How many shots to do " ) , _HELP ( " ShotsCount " ) ) , <nl> - InputPortConfig < bool > ( " AimOnly " , _HELP ( " Only aim at target position instead of shooting " ) ) , <nl> - InputPortConfig < EntityId > ( " TargetId " , _HELP ( " Entity to shoot or aim at ( dynamically updated ) , uses the position the AI system aims at if the entity has AI object . If not set TargetPos is used instead . " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - InputPortConfig < bool > ( " AutoReload " , _HELP ( " Automatically reload when the clip is empty " ) ) , <nl> - InputPortConfig < int > ( " UseSecondary " , _HELP ( " Use the secondary weapon to fire " ) , _HELP ( " UseSecondary " ) , _UICONFIG ( SECONDARY_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - OutputPortConfig_Void ( " OnShoot " , _HELP ( " shot is done " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Set AI to shoot at position or entity . " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIShootAt ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIShootAt : : EForceMethod CFlowNode_AIShootAt : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 7 ) ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - TBase : : Serialize ( pActInfo , ser ) ; <nl> - ser . Value ( " m_isShootingAtEntity " , m_isShootingAtEntity ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - m_actInfo = * pActInfo ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - <nl> - / / Choose the shoot at position based on the targetPos or targetId . <nl> - EntityId targetId = GetPortEntityId ( pActInfo , 6 ) ; <nl> - IEntity * pTargetEntity = 0 ; <nl> - if ( targetId ) <nl> - pTargetEntity = gEnv - > pEntitySystem - > GetEntity ( targetId ) ; <nl> - if ( pTargetEntity ) <nl> - { <nl> - / / Use ' targetId ' <nl> - if ( IAIObject * aiObject = pTargetEntity - > GetAI ( ) ) <nl> - pData - > point = aiObject - > GetPos ( ) ; <nl> - else <nl> - pData - > point = pTargetEntity - > GetPos ( ) ; <nl> - m_isShootingAtEntity = true ; <nl> - } <nl> - else <nl> - { <nl> - / / Use ' targetPos ' <nl> - pData - > point = GetPortVec3 ( pActInfo , 2 ) ; <nl> - m_isShootingAtEntity = false ; <nl> - } <nl> - pData - > fValue = GetPortFloat ( pActInfo , 3 ) ; / / Time <nl> - pData - > iValue2 = GetPortInt ( pActInfo , 9 ) ; / / ? 1 : 0 ; / / UseSecondary <nl> - pData - > nID = targetId ; <nl> - / / if in relaxed stance now - change to combat before shooting ; no animations for shooting in relaxed stance <nl> - IAIActor * pAIActor = CastToIAIActorSafe ( GetEntity ( pActInfo ) - > GetAI ( ) ) ; <nl> - if ( pAIActor & & pAIActor - > GetProxy ( ) ) <nl> - { <nl> - SAIBodyInfo bodyInfo ; <nl> - pAIActor - > GetProxy ( ) - > QueryBodyInfo ( bodyInfo ) ; <nl> - if ( bodyInfo . stance = = STANCE_RELAXED ) <nl> - { <nl> - pAIActor - > GetState ( ) . bodystate = STANCE_STAND ; <nl> - } <nl> - } <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - } <nl> - if ( GetPortBool ( pActInfo , 5 ) ) <nl> - { <nl> - Execute ( pActInfo , " ACT_AIMAT " , pData ) ; <nl> - } <nl> - else <nl> - { <nl> - Execute ( pActInfo , " ACT_SHOOTAT " , pData ) ; <nl> - / / prepare shoots counting <nl> - m_ShotsNumber = GetPortInt ( pActInfo , 4 ) ; <nl> - } <nl> - if ( m_isShootingAtEntity ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - } <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - void CFlowNode_AIShootAt : : UnregisterWithWeapon ( ) <nl> - { <nl> - if ( m_weaponId ) <nl> - { <nl> - IItem * pItem = gEnv - > pGame - > GetIGameFramework ( ) - > GetIItemSystem ( ) - > GetItem ( m_weaponId ) ; <nl> - if ( pItem & & pItem - > GetIWeapon ( ) ) <nl> - pItem - > GetIWeapon ( ) - > RemoveEventListener ( this ) ; <nl> - <nl> - m_weaponId = 0 ; <nl> - } <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : OnGoalPipeEvent ( IPipeUser * pPipeUser , EGoalPipeEvent event , int goalPipeId , bool & unregisterListenerAfterEvent ) <nl> - { <nl> - TBase : : OnGoalPipeEvent ( pPipeUser , event , goalPipeId , unregisterListenerAfterEvent ) ; <nl> - if ( m_GoalPipeId = = goalPipeId & & event = = ePN_Inserted ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( & m_actInfo ) ; <nl> - if ( pEntity ) <nl> - { <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - IAIActorProxy * pProxy = pAI ? pAI - > GetProxy ( ) : NULL ; <nl> - if ( pProxy ) <nl> - { <nl> - EntityId currentWeaponId = 0 ; <nl> - if ( IWeapon * pWeapon = pProxy - > QueryCurrentWeapon ( currentWeaponId ) ) <nl> - { <nl> - pWeapon - > AddEventListener ( this , __FUNCTION__ ) ; <nl> - m_weaponId = currentWeaponId ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Activate ) <nl> - { <nl> - m_autoReload = GetPortBool ( pActInfo , 8 ) ; <nl> - <nl> - if ( m_EntityId & & IsPortActive ( pActInfo , 2 ) ) <nl> - UpdateShootFromInputs ( pActInfo ) ; <nl> - } <nl> - else if ( event = = eFE_Initialize ) <nl> - { <nl> - m_isShootingAtEntity = false ; <nl> - } <nl> - <nl> - TBase : : ProcessEvent ( event , pActInfo ) ; <nl> - } <nl> - <nl> - bool CFlowNode_AIShootAt : : OnUpdate ( SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - if ( ! pEntity ) <nl> - return false ; <nl> - <nl> - if ( m_isShootingAtEntity ) <nl> - { <nl> - UpdateShootFromInputs ( pActInfo ) ; <nl> - return true ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : UpdateShootFromInputs ( SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - / / Choose the shoot at position based on the targetPos or targetId . <nl> - Vec3 target ; <nl> - EntityId targetId = GetPortEntityId ( pActInfo , 6 ) ; <nl> - IEntity * pTargetEntity = 0 ; <nl> - <nl> - if ( targetId ) <nl> - pTargetEntity = gEnv - > pEntitySystem - > GetEntity ( targetId ) ; <nl> - <nl> - if ( pTargetEntity ) <nl> - { <nl> - / / Use ' targetId ' <nl> - if ( IAIObject * aiObject = pTargetEntity - > GetAI ( ) ) <nl> - target = aiObject - > GetPos ( ) ; <nl> - else <nl> - target = pTargetEntity - > GetPos ( ) ; <nl> - } <nl> - else <nl> - { <nl> - / / Use ' targetPos ' <nl> - target = GetPortVec3 ( pActInfo , 2 ) ; <nl> - } <nl> - <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( pAI ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - Vec3 dir = target - pAI - > GetPos ( ) ; <nl> - dir . NormalizeSafe ( ) ; <nl> - pAI - > SetViewDir ( dir ) ; <nl> - <nl> - IAIObject * pAIObject = pPipeUser - > GetSpecialAIObject ( " refpoint " ) ; <nl> - if ( pAIObject ) <nl> - { <nl> - pAIObject - > SetPos ( target ) ; <nl> - if ( pTargetEntity ) <nl> - pAIObject - > SetEntityID ( targetId ) ; <nl> - } <nl> - <nl> - pAIObject = pPipeUser - > GetSpecialAIObject ( " lookat_target " ) ; <nl> - if ( pAIObject ) <nl> - pAIObject - > SetPos ( target ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : OnCancel ( ) <nl> - { <nl> - UnregisterWithWeapon ( ) ; <nl> - <nl> - TBase : : OnCancel ( ) ; <nl> - OnStopAction ( ) ; <nl> - <nl> - if ( m_EntityId ) <nl> - { <nl> - IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ; <nl> - if ( pEntity ) <nl> - { <nl> - IAIObject * pAI = pEntity - > GetAI ( ) ; <nl> - if ( pAI ) <nl> - { <nl> - IAIActor * pAIActor = pAI - > CastToIAIActor ( ) ; <nl> - if ( pAIActor ) <nl> - { <nl> - pAIActor - > ResetLookAt ( ) ; <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - { <nl> - pPipeUser - > SetFireMode ( FIREMODE_OFF ) ; <nl> - / / if ( pPipeUser - > GetFireMode ( ) = = FIREMODE_AIM ) <nl> - / / pPipeUser - > SetFireMode ( FIREMODE_BURST , false ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : OnStopAction ( ) <nl> - { <nl> - m_pGraph - > SetRegularlyUpdated ( m_nodeID , false ) ; <nl> - m_isShootingAtEntity = false ; <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : OnFinish ( ) <nl> - { <nl> - TBase : : OnFinish ( ) ; <nl> - OnStopAction ( ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : UnregisterEvents ( ) <nl> - { <nl> - UnregisterWithWeapon ( ) ; <nl> - <nl> - if ( m_UnregisterEntityId & & ! m_EntityId ) <nl> - m_EntityId = m_UnregisterEntityId ; <nl> - <nl> - TBase : : UnregisterEvents ( ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIShootAt : : OnOutOfAmmo ( IWeapon * pWeapon , IEntityClass * pAmmoType ) <nl> - { <nl> - if ( m_autoReload ) <nl> - pWeapon - > Reload ( true ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : OnDropped ( IWeapon * pWeapon , EntityId actorId ) <nl> - { <nl> - UnregisterWithWeapon ( ) ; <nl> - <nl> - if ( ! m_EntityId ) <nl> - return ; <nl> - <nl> - if ( IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ) <nl> - { <nl> - if ( IAIObject * pAI = pEntity - > GetAI ( ) ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - pPipeUser - > CancelSubPipe ( m_GoalPipeId ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIShootAt : : OnShoot ( IWeapon * pWeapon , EntityId shooterId , EntityId ammoId , IEntityClass * pAmmoType , <nl> - const Vec3 & pos , const Vec3 & dir , const Vec3 & vel ) <nl> - { <nl> - if ( ! m_EntityId | | ! m_GoalPipeId ) <nl> - return ; <nl> - <nl> - if ( m_ShotsNumber > 0 ) <nl> - { <nl> - if ( ( - - m_ShotsNumber ) = = 0 ) <nl> - { <nl> - if ( IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( m_EntityId ) ) <nl> - { <nl> - if ( IAIObject * pAI = pEntity - > GetAI ( ) ) <nl> - { <nl> - IPipeUser * pPipeUser = pAI - > CastToIPipeUser ( ) ; <nl> - if ( pPipeUser ) <nl> - pPipeUser - > RemoveSubPipe ( m_GoalPipeId , true ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - SFlowAddress done ( m_nodeID , 3 , true ) ; <nl> - m_pGraph - > ActivatePort ( done , true ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Uses an object <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIUseObject : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < EntityId > ( " objectId " , " Entity ID of the object which should be used by the agent " ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Uses an object " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIUseObject ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIUseObject : : EForceMethod CFlowNode_AIUseObject : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIUseObject : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_USEOBJECT " , NULL , GetPortEntityId ( pActInfo , 2 ) ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / select weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponSelect : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " sink " , _HELP ( " for synchronization only " ) , _HELP ( " Sync " ) ) , <nl> - InputPortConfig_Void ( " cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < string > ( " weapon " , _HELP ( " name of weapon to be selected " ) , 0 , _UICONFIG ( " enum_global : weapon " ) ) , <nl> - InputPortConfig < int > ( " Force " , 0 , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Selects specified weapon . " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIWeaponSelect ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIWeaponSelect : : EForceMethod CFlowNode_AIWeaponSelect : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , 3 ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIWeaponSelect : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - IAISignalExtraData * pData = gEnv - > pAISystem - > CreateSignalExtraData ( ) ; <nl> - pData - > SetObjectName ( GetPortString ( pActInfo , 2 ) ) ; <nl> - Execute ( pActInfo , " ACT_WEAPONSELECT " , pData ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Makes ai enter specified seat of specified vehicle <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CFlowNode_AIEnterVehicle : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " for synchronization only " ) ) , <nl> - InputPortConfig_Void ( " Cancel " , _HELP ( " Cancels execution " ) ) , <nl> - InputPortConfig < EntityId > ( " VehicleId " , _HELP ( " Vehicle to be entered " ) ) , <nl> - InputPortConfig < string > ( " SeatNumber " , _HELP ( " Seat to be entered " ) , _HELP ( " Seat " ) , _UICONFIG ( " dt = vehicleSeats , ref_entity = VehicleId " ) ) , <nl> - InputPortConfig < bool > ( " Fast " , _HELP ( " Skip approaching and playing entering animation " ) ) , <nl> - InputPortConfig < int > ( " Force " , eNoForce , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " Done " , _HELP ( " Activated when the action finished " ) ) , <nl> - OutputPortConfig < EntityId > ( " Success " , _HELP ( " Activated when Vehicle : Enter action succeeded " ) ) , <nl> - OutputPortConfig < EntityId > ( " Fail " , _HELP ( " Activated when Vehicle : Enter action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> + static const SInputPortConfig in_config [ ] = { <nl> + InputPortConfig_Void ( " Trigger " , _HELP ( " for synchronization only " ) ) , <nl> + InputPortConfig_Void ( " Cancel " , _HELP ( " Cancels execution " ) ) , <nl> + InputPortConfig < EntityId > ( " VehicleId " , _HELP ( " Vehicle to be entered " ) ) , <nl> + InputPortConfig < string > ( " SeatNumber " , _HELP ( " Seat to be entered " ) , _HELP ( " Seat " ) , _UICONFIG ( " dt = vehicleSeats , ref_entity = VehicleId " ) ) , <nl> + InputPortConfig < bool > ( " Fast " , _HELP ( " Skip approaching and playing entering animation " ) ) , <nl> + InputPortConfig < int > ( " Force " , eNoForce , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> + { 0 } <nl> + } ; <nl> + static const SOutputPortConfig out_config [ ] = { <nl> + OutputPortConfig < EntityId > ( " Done " , _HELP ( " Activated when the action finished " ) ) , <nl> + OutputPortConfig < EntityId > ( " Success " , _HELP ( " Activated when Vehicle : Enter action succeeded " ) ) , <nl> + OutputPortConfig < EntityId > ( " Fail " , _HELP ( " Activated when Vehicle : Enter action failed " ) ) , <nl> + { 0 } <nl> + } ; <nl> <nl> config . sDescription = _HELP ( " Makes AI enter specified seat of specified vehicle " ) ; <nl> config . nFlags | = EFLN_TARGET_ENTITY ; <nl> void CFlowNode_AIEnterVehicle : : DoProcessEvent ( EFlowEvent event , SActivationInfo * <nl> ActivateOutput ( pActInfo , eOut_Success , bSuccess ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Makes ai exit vehicle <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CFlowNode_AIExitVehicle : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Sync " , _HELP ( " for synchronization only " ) ) , <nl> - InputPortConfig_Void ( " Cancel " , _HELP ( " cancels execution " ) ) , <nl> - InputPortConfig < int > ( " Force " , eNoForce , _HELP ( " ForceExecution method " ) , _HELP ( " Force " ) , _UICONFIG ( FORCE_UICONFIG ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < EntityId > ( " done " , _HELP ( " action done " ) ) , <nl> - OutputPortConfig < EntityId > ( " succeed " , _HELP ( " action done successfully " ) ) , <nl> - OutputPortConfig < EntityId > ( " fail " , _HELP ( " action failed " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " makes ai exit a vehicle " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - DEF_CLONE ( CFlowNode_AIExitVehicle ) <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIExitVehicle : : EForceMethod CFlowNode_AIExitVehicle : : GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const <nl> - { <nl> - return static_cast < EForceMethod > ( GetPortInt ( pActInfo , eIn_Force ) ) ; <nl> - } <nl> - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - void CFlowNode_AIExitVehicle : : DoProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - IEntity * pEntity = GetEntity ( pActInfo ) ; <nl> - SetForceMethod ( pEntity ? pEntity - > GetAI ( ) : 0 , GetForceMethod ( pActInfo ) ) ; <nl> - <nl> - Execute ( pActInfo , " ACT_EXITVEHICLE " ) ; <nl> - } <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - class CFlowNode_AILookAtPoint : public CFlowNode_AILookAt <nl> - { <nl> - public : <nl> - CFlowNode_AILookAtPoint ( SActivationInfo * pActInfo ) : CFlowNode_AILookAt ( pActInfo ) { } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - CFlowNode_AILookAt : : GetConfiguration ( config ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - class CFlowNode_AIEnterVehicle_Old : public CFlowNode_AIEnterVehicle <nl> - { <nl> - public : <nl> - CFlowNode_AIEnterVehicle_Old ( SActivationInfo * pActInfo ) : CFlowNode_AIEnterVehicle ( pActInfo ) { } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - CFlowNode_AIEnterVehicle : : GetConfiguration ( config ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - class CFlowNode_AIUnload_Old : public CFlowNode_AIUnload <nl> - { <nl> - public : <nl> - CFlowNode_AIUnload_Old ( SActivationInfo * pActInfo ) : CFlowNode_AIUnload ( pActInfo ) { } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - CFlowNode_AIUnload : : GetConfiguration ( config ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - CFlowNode_AIGoToEx : : CFlowNode_AIGoToEx ( IFlowNode : : SActivationInfo * pActInfo ) <nl> - : m_entityID ( 0 ) <nl> - , m_activateOutput ( false ) <nl> - , m_isPrepared ( false ) <nl> - , m_outputToActivate ( eOut_Succeeded ) <nl> - { <nl> - } <nl> - <nl> - CFlowNode_AIGoToEx : : ~ CFlowNode_AIGoToEx ( ) <nl> - { <nl> - if ( m_entityID ) <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIGoToEx : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig_Void ( " Sync " ) , <nl> - InputPortConfig_Void ( " Cancel " ) , <nl> - InputPortConfig < Vec3 > ( " Position " ) , <nl> - InputPortConfig < float > ( " StopDistance " , 0 . 0f ) , <nl> - InputPortConfig < int > ( " Stance " , 3 , _HELP ( " Note : The crouch stance is only available to the humans . " ) , NULL , _UICONFIG ( " enum_int : Relaxed = 3 , Alerted = 6 , Combat = 0 , Crouch = 4 " ) ) , <nl> - InputPortConfig < int > ( " Speed " , 0 , NULL , NULL , _UICONFIG ( " enum_int : Walk = 0 , Run = 1 , Sprint = 2 " ) ) , <nl> - InputPortConfig < bool > ( " Strafe " , false ) , <nl> - InputPortConfig < bool > ( " AllowFire " , true ) , <nl> - InputPortConfig < bool > ( " BreakOnTarget " , true , _HELP ( " Interrupts the go to command if the agent has an attention target . " ) ) , <nl> - InputPortConfig < bool > ( " BreakOnBulletRain " , false , _HELP ( " Interrupts the go to command if the agent is under enemy fire . " ) ) , <nl> - InputPortConfig < bool > ( " Prepare " , false ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < int > ( " Done " ) , <nl> - OutputPortConfig < int > ( " Succeeded " ) , <nl> - OutputPortConfig < int > ( " Failed " , _HELP ( " Triggers whenever the command is interrupted or failed to get a path . " ) ) , <nl> - OutputPortConfig < int > ( " Interrupted " , _HELP ( " Triggers when the command is interrupted by any of the break conditions , the cancel input or another GoTo command . " ) ) , <nl> - OutputPortConfig < int > ( " NoPath " ) , <nl> - OutputPortConfig < int > ( " Close " ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void CFlowNode_AIGoToEx : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - if ( m_entityID ) <nl> - { <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - m_entityID = 0 ; <nl> - m_isPrepared = false ; <nl> - } <nl> - m_activateOutput = false ; <nl> - break ; <nl> - } <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , eIN_Prepare ) ) <nl> - { <nl> - if ( IEntity * entity = pActInfo - > pEntity ) <nl> - { <nl> - if ( IScriptTable * entityScriptTable = entity - > GetScriptTable ( ) ) <nl> - { <nl> - HSCRIPTFUNCTION functionToCall = 0 ; <nl> - if ( entityScriptTable - > GetValue ( " SetGoToPosition " , functionToCall ) ) <nl> - { <nl> - / / Setup data <nl> - SmartScriptTable goToData ( gEnv - > pScriptSystem ) ; <nl> - <nl> - CScriptVector position ( gEnv - > pScriptSystem ) ; <nl> - position . Set ( GetPortVec3 ( pActInfo , eIN_Position ) ) ; <nl> - goToData - > SetValue ( " Position " , position ) ; <nl> - Script : : CallMethod ( entityScriptTable , functionToCall , goToData ) ; <nl> - gEnv - > pScriptSystem - > ReleaseFunc ( functionToCall ) ; <nl> - <nl> - gEnv - > pAISystem - > SendSignal ( SIGNALFILTER_SENDER , 0 , " OnPrepareGoTo " , entity - > GetAI ( ) ) ; <nl> - <nl> - / / pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - <nl> - m_isPrepared = true ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( IsPortActive ( pActInfo , eIN_Go ) ) <nl> - { <nl> - bool goToTriggered = false ; <nl> - <nl> - if ( IEntity * entity = pActInfo - > pEntity ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - m_entityID = entity - > GetId ( ) ; <nl> - <nl> - if ( ! m_isPrepared ) <nl> - { <nl> - / / Send interrupt event to other goto flownode that could be running <nl> - SEntityEvent entityEvent ( ENTITY_EVENT_SCRIPT_EVENT ) ; <nl> - entityEvent . nParam [ 0 ] = ( INT_PTR ) " GoToInterrupted " ; <nl> - entity - > SendEvent ( entityEvent ) ; <nl> - } <nl> - <nl> - bool breakOnTarget = GetPortBool ( pActInfo , eIN_BreakOnTarget ) ; <nl> - if ( breakOnTarget ) <nl> - { <nl> - bool hasTarget = false ; <nl> - if ( IAIObject * aiobject = entity - > GetAI ( ) ) <nl> - if ( IAIActor * aiactor = aiobject - > CastToIAIActor ( ) ) <nl> - hasTarget = ( aiactor - > GetAttentionTarget ( ) ! = NULL ) ; <nl> - <nl> - if ( hasTarget ) <nl> - { <nl> - if ( IScriptTable * entityScriptTable = entity - > GetScriptTable ( ) ) <nl> - { <nl> - SmartScriptTable currentBehavior ; <nl> - entityScriptTable - > GetValue ( " Behavior " , currentBehavior ) ; <nl> - <nl> - HSCRIPTFUNCTION functionToCall = 0 ; <nl> - if ( currentBehavior & & currentBehavior - > GetValue ( " OnCancelGoTo " , functionToCall ) ) <nl> - { <nl> - Script : : CallMethod ( currentBehavior , functionToCall , entityScriptTable ) ; <nl> - gEnv - > pScriptSystem - > ReleaseFunc ( functionToCall ) ; <nl> - } <nl> - } <nl> - <nl> - TriggerOutput ( pActInfo , eOut_Interrupted ) ; <nl> - return ; <nl> - } <nl> - } <nl> - <nl> - m_activateOutput = false ; <nl> - <nl> - if ( IScriptTable * entityScriptTable = entity - > GetScriptTable ( ) ) <nl> - { <nl> - HSCRIPTFUNCTION functionToCall = 0 ; <nl> - if ( entityScriptTable - > GetValue ( " SetGoToData " , functionToCall ) ) <nl> - { <nl> - / / Setup data <nl> - SmartScriptTable goToData ( gEnv - > pScriptSystem ) ; <nl> - <nl> - CScriptVector position ( gEnv - > pScriptSystem ) ; <nl> - position . Set ( GetPortVec3 ( pActInfo , eIN_Position ) ) ; <nl> - goToData - > SetValue ( " Position " , position ) ; <nl> - goToData - > SetValue ( " StopDistance " , GetPortFloat ( pActInfo , eIN_StopDistance ) ) ; <nl> - goToData - > SetValue ( " Stance " , GetPortInt ( pActInfo , eIN_Stance ) ) ; <nl> - switch ( GetPortInt ( pActInfo , eIN_Speed ) ) <nl> - { <nl> - case 0 : <nl> - goToData - > SetValue ( " Speed " , AISPEED_WALK ) ; <nl> - break ; <nl> - case 1 : <nl> - goToData - > SetValue ( " Speed " , AISPEED_RUN ) ; <nl> - break ; <nl> - case 2 : <nl> - goToData - > SetValue ( " Speed " , AISPEED_SPRINT ) ; <nl> - break ; <nl> - } <nl> - goToData - > SetValue ( " Strafe " , GetPortBool ( pActInfo , eIN_Strafe ) ) ; <nl> - goToData - > SetValue ( " AllowFire " , GetPortBool ( pActInfo , eIN_AllowFire ) ) ; <nl> - goToData - > SetValue ( " BreakOnTarget " , breakOnTarget ) ; <nl> - goToData - > SetValue ( " BreakOnBulletRain " , GetPortBool ( pActInfo , eIN_BreakOnBulletRain ) ) ; <nl> - <nl> - Script : : CallMethod ( entityScriptTable , functionToCall , goToData ) ; <nl> - gEnv - > pScriptSystem - > ReleaseFunc ( functionToCall ) ; <nl> - <nl> - if ( ! m_isPrepared ) <nl> - { <nl> - gEnv - > pAISystem - > SendSignal ( SIGNALFILTER_SENDER , 0 , " OnExecuteGoTo " , entity - > GetAI ( ) ) ; <nl> - } <nl> - <nl> - m_isPrepared = false ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - gEnv - > pEntitySystem - > AddEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - <nl> - goToTriggered = true ; <nl> - } <nl> - } <nl> - <nl> - if ( ! goToTriggered ) <nl> - TriggerOutput ( pActInfo , eOut_Failed ) ; <nl> - } <nl> - } <nl> - if ( IsPortActive ( pActInfo , eIN_Cancel ) ) <nl> - { <nl> - if ( IEntity * entity = pActInfo - > pEntity ) <nl> - { <nl> - if ( IScriptTable * entityScriptTable = entity - > GetScriptTable ( ) ) <nl> - { <nl> - SmartScriptTable currentBehavior ; <nl> - entityScriptTable - > GetValue ( " Behavior " , currentBehavior ) ; <nl> - <nl> - HSCRIPTFUNCTION functionToCall = 0 ; <nl> - if ( currentBehavior & & currentBehavior - > GetValue ( " OnCancelGoTo " , functionToCall ) ) <nl> - { <nl> - Script : : CallMethod ( currentBehavior , functionToCall , entityScriptTable ) ; <nl> - gEnv - > pScriptSystem - > ReleaseFunc ( functionToCall ) ; <nl> - TriggerOutput ( pActInfo , eOut_Interrupted ) ; <nl> - } <nl> - } <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - case eFE_Update : <nl> - { <nl> - if ( m_activateOutput ) <nl> - { <nl> - m_activateOutput = false ; <nl> - <nl> - if ( m_outputToActivate ! = eOut_Close ) <nl> - { <nl> - TriggerOutput ( pActInfo , m_outputToActivate ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - else <nl> - { <nl> - TriggerOutput ( pActInfo , m_outputToActivate , false ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIGoToEx : : OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) <nl> - { <nl> - if ( event . event = = ENTITY_EVENT_SCRIPT_EVENT ) <nl> - { <nl> - const char * eventName = ( const char * ) event . nParam [ 0 ] ; <nl> - if ( ! strcmp ( " GoToSucceeded " , eventName ) ) <nl> - { <nl> - m_activateOutput = true ; <nl> - m_outputToActivate = eOut_Succeeded ; <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - } <nl> - else if ( ! strcmp ( " GoToInterrupted " , eventName ) ) <nl> - { <nl> - m_activateOutput = true ; <nl> - m_outputToActivate = eOut_Interrupted ; <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - } <nl> - else if ( ! strcmp ( " GoToFailed " , eventName ) ) <nl> - { <nl> - m_activateOutput = true ; <nl> - m_outputToActivate = eOut_NoPath ; <nl> - gEnv - > pEntitySystem - > RemoveEntityEventListener ( m_entityID , ENTITY_EVENT_SCRIPT_EVENT , this ) ; <nl> - } <nl> - else if ( ! strcmp ( " GoToCloseToDest " , eventName ) ) <nl> - { <nl> - m_activateOutput = true ; <nl> - m_outputToActivate = eOut_Close ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CFlowNode_AIGoToEx : : TriggerOutput ( SActivationInfo * pActInfo , Outputs output , bool triggerDoneOutput / * = true * / ) <nl> - { <nl> - ActivateOutput ( pActInfo , output , m_entityID ) ; <nl> - <nl> - if ( triggerDoneOutput ) <nl> - ActivateOutput ( pActInfo , eOut_Done , m_entityID ) ; <nl> - <nl> - / / Triggering the failed output whenever the goto was unsuccessful , as requested by level design . / Mario <nl> - if ( output = = eOut_Interrupted | | output = = eOut_NoPath ) <nl> - ActivateOutput ( pActInfo , eOut_Failed , m_entityID ) ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Get vehicle seat helper positions <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CFlowNode_GetSeatHelperVehicle : : ProcessEvent ( EFlowEvent event , SActivationI <nl> / / <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - REGISTER_FLOW_NODE ( " AI : AIExecute " , CFlowNode_AIExecute ) <nl> - REGISTER_FLOW_NODE ( " AI : AISignal " , CFlowNode_AISignal ) <nl> - REGISTER_FLOW_NODE ( " AI : AISetState " , CFlowNode_AISetState ) <nl> - REGISTER_FLOW_NODE ( " AI : AIModifyStates " , CFlowNode_AIModifyStates ) <nl> - REGISTER_FLOW_NODE ( " AI : AICheckStates " , CFlowNode_AICheckStates ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGoto " , CFlowNode_AIGoto ) <nl> - REGISTER_FLOW_NODE ( " AI : AIGotoSpeedStance " , CFlowNode_AIGotoSpeedStance ) <nl> - REGISTER_FLOW_NODE ( " AI : AILookAtPoint " , CFlowNode_AILookAtPoint ) <nl> - REGISTER_FLOW_NODE ( " AI : AILookAt " , CFlowNode_AILookAt ) <nl> - REGISTER_FLOW_NODE ( " AI : AIStance " , CFlowNode_AIStance ) <nl> - REGISTER_FLOW_NODE ( " AI : AISpeed " , CFlowNode_AISpeed ) <nl> - REGISTER_FLOW_NODE ( " AI : DebugAISpeed " , CFlowNode_DebugAISpeed ) <nl> - REGISTER_FLOW_NODE ( " AI : AIAnim " , CFlowNode_AIAnim ) <nl> - REGISTER_FLOW_NODE ( " AI : AIAnimEx " , CFlowNode_AIAnimEx ) <nl> - REGISTER_FLOW_NODE ( " AI : AIFollowPath " , CFlowNode_AIFollowPath ) <nl> - REGISTER_FLOW_NODE ( " AI : AIFollowPathSpeedStance " , CFlowNode_AIFollowPathSpeedStance ) <nl> - REGISTER_FLOW_NODE ( " AI : AIUnload " , CFlowNode_AIUnload_Old ) <nl> + REGISTER_FLOW_NODE ( " AI : Execute " , CFlowNode_AIExecute ) <nl> + REGISTER_FLOW_NODE ( " AI : Signal " , CFlowNode_AISignal ) <nl> + REGISTER_FLOW_NODE ( " AI : SetState " , CFlowNode_AISetState ) <nl> + REGISTER_FLOW_NODE ( " AI : LookAt " , CFlowNode_AILookAt ) <nl> + REGISTER_FLOW_NODE ( " AI : Stance " , CFlowNode_AIStance ) <nl> # ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM <nl> - REGISTER_FLOW_NODE ( " AI : AISetCharacter " , CFlowNode_AISetCharacter ) <nl> + REGISTER_FLOW_NODE ( " AI : CharacterSet " , CFlowNode_AISetCharacter ) <nl> # endif <nl> - REGISTER_FLOW_NODE ( " AI : AIGrabObject " , CFlowNode_AIGrabObject ) <nl> - REGISTER_FLOW_NODE ( " AI : AIDropObject " , CFlowNode_AIDropObject ) <nl> - REGISTER_FLOW_NODE ( " AI : AIWeaponDraw " , CFlowNode_AIWeaponDraw ) <nl> - REGISTER_FLOW_NODE ( " AI : AIWeaponHolster " , CFlowNode_AIWeaponHolster ) <nl> - REGISTER_FLOW_NODE ( " AI : AIShootAt " , CFlowNode_AIShootAt ) <nl> - REGISTER_FLOW_NODE ( " AI : AIUseObject " , CFlowNode_AIUseObject ) <nl> - REGISTER_FLOW_NODE ( " AI : AIWeaponSelect " , CFlowNode_AIWeaponSelect ) <nl> - REGISTER_FLOW_NODE ( " AI : AIEnterVehicle " , CFlowNode_AIEnterVehicle_Old ) <nl> - REGISTER_FLOW_NODE ( " AI : AIAlertMe " , CFlowNode_AISignalAlerted ) <nl> + REGISTER_FLOW_NODE ( " AI : ObjectDrop " , CFlowNode_AIDropObject ) <nl> + REGISTER_FLOW_NODE ( " AI : ObjectUse " , CFlowNode_AIUseObject ) <nl> + REGISTER_FLOW_NODE ( " AI : AlertMe " , CFlowNode_AISignalAlerted ) <nl> REGISTER_FLOW_NODE ( " Vehicle : Enter " , CFlowNode_AIEnterVehicle ) <nl> REGISTER_FLOW_NODE ( " Vehicle : Unload " , CFlowNode_AIUnload ) <nl> - REGISTER_FLOW_NODE ( " Vehicle : Exit " , CFlowNode_AIExitVehicle ) <nl> REGISTER_FLOW_NODE ( " Vehicle : FollowPath " , CFlowNode_AIVehicleFollowPath ) <nl> REGISTER_FLOW_NODE ( " Vehicle : StickPath " , CFlowNode_AIVehicleStickPath ) <nl> REGISTER_FLOW_NODE ( " Vehicle : ChaseTarget " , CFlowNode_AIVehicleChaseTarget ) <nl> REGISTER_FLOW_NODE ( " Vehicle : GetSeatHelper " , CFlowNode_GetSeatHelperVehicle ) <nl> <nl> - REGISTER_FLOW_NODE ( " AI : GoToEx " , CFlowNode_AIGoToEx ) <nl> - <nl> # undef DEF_CLONE <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAIAction . h <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNodeAIAction . h <nl> class CFlowNode_AIBase : public CFlowBaseNode < eNCT_Instanced > , public IEntityEve <nl> virtual bool ExecuteOnEntity ( SActivationInfo * pActInfo , const char * pSignalText , <nl> IAISignalExtraData * pData , IEntity * pEntity , IEntity * pSender ) ; <nl> <nl> - / / Utility function to set an AI ' s speed . Used by CFlowNode_AISpeed and CFlowNode_AIGotoSpeedStance <nl> + / / Utility function to set an AI ' s speed . <nl> void SetSpeed ( IAIObject * pAI , int iSpeed ) ; <nl> <nl> - / / Utility function to set an AI ' s stance . Used by CFlowNode_AIStance and CFlowNode_AIGotoSpeedStance <nl> + / / Utility function to set an AI ' s stance . <nl> void SetStance ( IAIObject * pAI , int stance ) ; <nl> <nl> - / / Utility function to set an AI ' s a . Used by CFlowNode_AIStance and CFlowNode_AIGotoSpeedStance <nl> + / / Utility function to set an AI ' s a . <nl> void SetAllowStrafing ( IAIObject * pAI , bool bAllowStrafing ) ; <nl> <nl> / / should call DoProcessEvent if owner is not too much alerted <nl> class CFlowNode_AISetState <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Modify States <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIModifyStates <nl> - : public CFlowNode_AIBase < false > <nl> - { <nl> - typedef CFlowNode_AIBase < false > TBase ; <nl> - public : <nl> - CFlowNode_AIModifyStates ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Check States <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AICheckStates <nl> - : public CFlowNode_AIBase < false > <nl> - { <nl> - typedef CFlowNode_AIBase < false > TBase ; <nl> - public : <nl> - CFlowNode_AICheckStates ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Follow Path <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIFollowPath <nl> - : public CFlowNode_AIBase < true > <nl> - { <nl> - typedef CFlowNode_AIBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIFollowPath ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Follow Path Speed Stance <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIFollowPathSpeedStance <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIFollowPathSpeedStance ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Vehicle Follow Path <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIVehicleStickPath <nl> void UnregisterFromScriptEvent ( ) ; <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / GOTO <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIGoto <nl> - : public CFlowNode_AIBase < true > <nl> - { <nl> - typedef CFlowNode_AIBase < true > TBase ; <nl> - Vec3 m_vDestination ; <nl> - public : <nl> - CFlowNode_AIGoto ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) , m_vDestination ( ZERO ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void ProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void OnResume ( IFlowNode : : SActivationInfo * pActInfo = NULL ) ; <nl> - virtual void Serialize ( SActivationInfo * , TSerialize ser ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / GOTO - Also sets speed and stance <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIGotoSpeedStance <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - Vec3 m_vDestination ; <nl> - int m_iStance ; <nl> - int m_iSpeed ; <nl> - bool m_bAllowStrafing ; <nl> - public : <nl> - CFlowNode_AIGotoSpeedStance ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) , m_vDestination ( ZERO ) , m_iStance ( 4 ) , m_iSpeed ( 1 ) , m_bAllowStrafing ( false ) { } <nl> - virtual void ProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual void OnResume ( IFlowNode : : SActivationInfo * pActInfo = NULL ) ; <nl> - virtual void Serialize ( SActivationInfo * , TSerialize ser ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Look At <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIUnload <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / speed controller <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AISpeed <nl> - : public CFlowNode_AIBase < false > <nl> - { <nl> - typedef CFlowNode_AIBase < false > TBase ; <nl> - public : <nl> - CFlowNode_AISpeed ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - class CFlowNode_DebugAISpeed <nl> - : public CFlowNode_AIBase < false > <nl> - { <nl> - typedef CFlowNode_AIBase < false > TBase ; <nl> - public : <nl> - CFlowNode_DebugAISpeed ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / animation controller <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIAnim <nl> - : public CFlowNode_AIBase < true > <nl> - , IAnimationGraphStateListener <nl> - { <nl> - typedef CFlowNode_AIBase < true > TBase ; <nl> - protected : <nl> - IAnimationGraphState * m_pAGState ; <nl> - TAnimationGraphQueryID m_queryID ; <nl> - int m_iMethod ; <nl> - bool m_bStarted ; <nl> - <nl> - public : <nl> - CFlowNode_AIAnim ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) , m_pAGState ( 0 ) , m_queryID ( 0 ) , m_iMethod ( 0 ) , m_bStarted ( false ) { } <nl> - ~ CFlowNode_AIAnim ( ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / IEntityEventListener <nl> - virtual void OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) ; <nl> - <nl> - protected : <nl> - virtual void OnCancelPortActivated ( IPipeUser * pPipeUser , SActivationInfo * pActInfo ) ; <nl> - <nl> - / / override this method to unregister listener if the action is canceled <nl> - virtual void OnCancel ( ) ; <nl> - <nl> - / / from IAnimationGraphStateListener <nl> - virtual void SetOutput ( const char * output , const char * value ) { } <nl> - virtual void QueryComplete ( TAnimationGraphQueryID queryID , bool succeeded ) ; <nl> - virtual void DestroyedState ( IAnimationGraphState * ) ; <nl> - <nl> - public : <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / AnimEx <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIAnimEx <nl> - : public CFlowNode_AIBase < true > <nl> - { <nl> - enum EState <nl> - { <nl> - eS_Disabled , <nl> - eS_Requested , <nl> - eS_Started <nl> - } ; <nl> - <nl> - typedef CFlowNode_AIBase < true > TBase ; <nl> - Vec3 m_vPos ; <nl> - Vec3 m_vDir ; <nl> - int m_iStance ; <nl> - int m_iSpeed ; <nl> - bool m_bOneShot ; <nl> - EState m_State ; <nl> - public : <nl> - CFlowNode_AIAnimEx ( IFlowNode : : SActivationInfo * pActInfo ) <nl> - : TBase ( pActInfo ) <nl> - , m_iStance ( 0 ) <nl> - , m_iSpeed ( 0 ) <nl> - , m_bOneShot ( false ) <nl> - , m_State ( eS_Disabled ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void OnResume ( IFlowNode : : SActivationInfo * pActInfo = NULL ) ; <nl> - virtual void OnCancel ( ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - / / IGoalPipeListener <nl> - virtual void OnGoalPipeEvent ( IPipeUser * pPipeUser , EGoalPipeEvent event , int goalPipeId , bool & unregisterListenerAfterEvent ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void OnCancelPortActivated ( IPipeUser * pPipeUser , SActivationInfo * pActInfo ) ; <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) ; <nl> - virtual void PreExecute ( SActivationInfo * pActInfo ) ; <nl> - private : <nl> - bool IsValidAnimationInputValue ( IEntity * pEntity , const char * szAnimation , bool bIsOneShot ) const ; <nl> - <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / grab object <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIGrabObject <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIGrabObject ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / drop object <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIDropObject <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / draw weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIWeaponDraw <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIWeaponDraw ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / holster weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIWeaponHolster <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIWeaponHolster ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Shoot At <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIShootAt <nl> - : public CFlowNode_AIForceableBase < true > <nl> - , public IWeaponEventListener <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - <nl> - public : <nl> - CFlowNode_AIShootAt ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) , m_ShotsNumber ( 0 ) , m_weaponId ( 0 ) , m_isShootingAtEntity ( false ) , m_autoReload ( false ) { } ; <nl> - virtual ~ CFlowNode_AIShootAt ( ) { UnregisterEvents ( ) ; } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void ProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void OnCancel ( ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual bool OnUpdate ( IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual void OnFinish ( ) ; <nl> - virtual void Serialize ( SActivationInfo * , TSerialize ser ) ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmm IWeaponEventListener <nl> - virtual void OnShoot ( IWeapon * pWeapon , EntityId shooterId , EntityId ammoId , IEntityClass * pAmmoType , <nl> - const Vec3 & pos , const Vec3 & dir , const Vec3 & vel ) ; <nl> - virtual void OnStartFire ( IWeapon * pWeapon , EntityId shooterId ) { } ; <nl> - virtual void OnStopFire ( IWeapon * pWeapon , EntityId shooterId ) { } ; <nl> - virtual void OnFireModeChanged ( IWeapon * pWeapon , int currentFireMode ) { } ; <nl> - virtual void OnStartReload ( IWeapon * pWeapon , EntityId shooterId , IEntityClass * pAmmoType ) { } ; <nl> - virtual void OnEndReload ( IWeapon * pWeapon , EntityId shooterId , IEntityClass * pAmmoType ) { } ; <nl> - virtual void OnSetAmmoCount ( IWeapon * pWeapon , EntityId shooterId ) { } ; <nl> - virtual void OnOutOfAmmo ( IWeapon * pWeapon , IEntityClass * pAmmoType ) ; <nl> - virtual void OnReadyToFire ( IWeapon * pWeapon ) { } ; <nl> - virtual void OnPickedUp ( IWeapon * pWeapon , EntityId actorId , bool destroyed ) { } ; <nl> - virtual void OnDropped ( IWeapon * pWeapon , EntityId actorId ) ; <nl> - virtual void OnMelee ( IWeapon * pWeapon , EntityId shooterId ) { } <nl> - virtual void OnStartTargetting ( IWeapon * pWeapon ) { } <nl> - virtual void OnStopTargetting ( IWeapon * pWeapon ) { } <nl> - virtual void OnSelected ( IWeapon * pWeapon , bool select ) { } <nl> - virtual void OnEndBurst ( IWeapon * pWeapon , EntityId shooterId ) { } <nl> - / / mmmmmmmmmmmmmmmmmm ~ IWeaponEventListener <nl> - <nl> - / / IGoalPipeListener <nl> - virtual void OnGoalPipeEvent ( IPipeUser * pPipeUser , EGoalPipeEvent event , int goalPipeId , bool & unregisterListenerAfterEvent ) ; <nl> - <nl> - virtual void UnregisterEvents ( ) ; <nl> - virtual void UnregisterWithWeapon ( ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - private : <nl> - void UpdateShootFromInputs ( SActivationInfo * pActInfo ) ; <nl> - void OnStopAction ( ) ; <nl> - <nl> - SActivationInfo m_actInfo ; <nl> - int m_ShotsNumber ; <nl> - EntityId m_weaponId ; <nl> - bool m_isShootingAtEntity ; <nl> - bool m_autoReload ; <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Uses an object <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIUseObject <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Selects specific weapon <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIWeaponSelect <nl> - : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - CFlowNode_AIWeaponSelect ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Makes ai enter specifyed seat of specifyed vehicle <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_AIEnterVehicle : public CFlowNode_AIForceableBase < true > <nl> } <nl> } ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Makes ai exit a vehicle <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIExitVehicle : public CFlowNode_AIForceableBase < true > <nl> - { <nl> - typedef CFlowNode_AIForceableBase < true > TBase ; <nl> - public : <nl> - enum EInputs <nl> - { <nl> - eIn_Trigger , <nl> - eIn_Cancel , <nl> - eIn_Force , <nl> - } ; <nl> - enum EOutputs <nl> - { <nl> - eOut_Done , <nl> - eOut_Success , <nl> - eOut_Fail <nl> - } ; <nl> - <nl> - CFlowNode_AIExitVehicle ( IFlowNode : : SActivationInfo * pActInfo ) : TBase ( pActInfo ) { } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - void DoProcessEvent ( IFlowNode : : EFlowEvent event , IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual EForceMethod GetForceMethod ( IFlowNode : : SActivationInfo * pActInfo ) const ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - class CFlowNode_AIGoToEx : public CFlowBaseNode < eNCT_Instanced > , public IEntityEventListener <nl> - { <nl> - public : <nl> - <nl> - enum Inputs <nl> - { <nl> - eIN_Go = 0 , <nl> - eIN_Cancel , <nl> - eIN_Position , <nl> - eIN_StopDistance , <nl> - eIN_Stance , <nl> - eIN_Speed , <nl> - eIN_Strafe , <nl> - eIN_AllowFire , <nl> - eIN_BreakOnTarget , <nl> - eIN_BreakOnBulletRain , <nl> - eIN_Prepare , <nl> - } ; <nl> - <nl> - enum Outputs <nl> - { <nl> - eOut_Done = 0 , <nl> - eOut_Succeeded , <nl> - eOut_Failed , <nl> - eOut_Interrupted , <nl> - eOut_NoPath , <nl> - eOut_Close , <nl> - } ; <nl> - <nl> - CFlowNode_AIGoToEx ( IFlowNode : : SActivationInfo * pActInfo ) ; <nl> - virtual ~ CFlowNode_AIGoToEx ( ) ; <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { return new CFlowNode_AIGoToEx ( pActInfo ) ; } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const { s - > Add ( * this ) ; } <nl> - <nl> - / / IEntityEventListener <nl> - virtual void OnEntityEvent ( IEntity * pEntity , SEntityEvent & event ) ; <nl> - <nl> - private : <nl> - EntityId m_entityID ; <nl> - Outputs m_outputToActivate ; <nl> - bool m_activateOutput ; <nl> - bool m_isPrepared ; <nl> - <nl> - void TriggerOutput ( SActivationInfo * pActInfo , Outputs output , bool triggerDoneOutput = true ) ; <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Gets vehicle seat helper positions <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> deleted file mode 100644 <nl> index 537366c109 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowNode_ColliderMode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowBaseNode . h " <nl> - # include " . . / . . / GameObjects / GameObject . h " <nl> - # include " IAnimationGraph . h " <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CFlowNode_ColliderMode : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - <nl> - public : <nl> - <nl> - CFlowNode_ColliderMode ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowNode_ColliderMode ( ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static CryFixedStringT < 256 > cfg ; <nl> - static bool initialized = false ; <nl> - if ( ! initialized ) <nl> - { <nl> - CryFixedStringT < 256 > cfgTemp ( " enum_int : " ) ; <nl> - CryFixedStringT < 256 > mode ; <nl> - for ( int i = 0 ; i < eColliderMode_COUNT ; i + + ) <nl> - { <nl> - mode . Format ( " % s = % d " , g_szColliderModeString [ i ] , i ) ; <nl> - cfgTemp + = mode ; <nl> - <nl> - if ( i < ( eColliderMode_COUNT - 1 ) ) <nl> - cfgTemp + = " , " ; <nl> - } <nl> - <nl> - cfg = cfgTemp ; <nl> - initialized = true ; <nl> - } <nl> - <nl> - static const SInputPortConfig inputs [ ] = <nl> - { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Trigger to request collider mode in animated character . " ) ) , <nl> - InputPortConfig < int > ( " ColliderMode " , eColliderMode_Undefined , 0 , 0 , _UICONFIG ( cfg . c_str ( ) ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - static const SOutputPortConfig outputs [ ] = <nl> - { <nl> - OutputPortConfig_Void ( " Done " , _HELP ( " Triggered when Done . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " ColliderMode Node " ) ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - if ( ! IsPortActive ( pActInfo , 0 ) ) <nl> - return ; <nl> - <nl> - if ( pActInfo - > pEntity = = NULL ) <nl> - return ; <nl> - <nl> - CGameObject * pGameObject = ( CGameObject * ) ( pActInfo - > pEntity - > GetProxy ( ENTITY_PROXY_USER ) ) ; <nl> - if ( pGameObject = = NULL ) <nl> - return ; <nl> - <nl> - IAnimatedCharacter * pAnimChar = ( IAnimatedCharacter * ) ( pGameObject - > QueryExtension ( " AnimatedCharacter " ) ) ; <nl> - if ( pAnimChar = = NULL ) <nl> - return ; <nl> - <nl> - int colliderMode = GetPortInt ( pActInfo , 1 ) ; <nl> - pAnimChar - > RequestPhysicalColliderMode ( ( EColliderMode ) colliderMode , eColliderModeLayer_FlowGraph ) ; <nl> - ActivateOutput ( pActInfo , 0 , true ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * crySizer ) const <nl> - { <nl> - crySizer - > AddObject ( this , sizeof ( * this ) ) ; <nl> - } <nl> - <nl> - } ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - REGISTER_FLOW_NODE ( " AnimatedCharacter : ColliderMode " , CFlowNode_ColliderMode ) ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> deleted file mode 100644 <nl> index 770e09746d . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowPlotNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowBaseNode . h " <nl> - # include < CrySystem / TimeValue . h > <nl> - # include < CryRenderer / IRenderAuxGeom . h > <nl> - <nl> - class CFlowPlotNode : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - enum INPUTS <nl> - { <nl> - PLOTX , <nl> - PLOTY , <nl> - POSX , <nl> - POSY , <nl> - WIDTH , <nl> - HEIGHT , <nl> - MAXPOINTAGE , <nl> - PLOTCOLOR <nl> - } ; <nl> - <nl> - CFlowPlotNode ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_bGotActivation = false ; <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowPlotNode ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - ser . BeginGroup ( " Local " ) ; <nl> - ser . Value ( " m_bGotActivation " , m_bGotActivation ) ; <nl> - / / TODO : ser . Value ( " m_points " , m_points ) ; <nl> - if ( ser . IsReading ( ) ) <nl> - m_points . clear ( ) ; <nl> - <nl> - ser . EndGroup ( ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < float > ( " plotX " , _HELP ( " x - coordinate to plot " ) ) , <nl> - InputPortConfig < float > ( " plotY " , _HELP ( " y - coordinate to plot " ) ) , <nl> - InputPortConfig < float > ( " posX " , 50 . 0f , _HELP ( " x - coordinate of graph " ) ) , <nl> - InputPortConfig < float > ( " posY " , 100 . 0f , _HELP ( " y - coordinate of graph " ) ) , <nl> - InputPortConfig < float > ( " width " , 400 . 0f , _HELP ( " width of graph " ) ) , <nl> - InputPortConfig < float > ( " height " , 300 . 0f , _HELP ( " height of graph " ) ) , <nl> - InputPortConfig < float > ( " maxPointAge " , 10 . 0f , _HELP ( " maximum age of a point on screen in seconds " ) ) , <nl> - InputPortConfig < Vec3 > ( " color " , Vec3 ( 255 . 0f , 255 . 0f , 255 . 0f ) , _HELP ( " Color to plot with " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Plot x , y coordinate pairs in a graph on screen " ) ; <nl> - config . pInputPorts = inputs ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - break ; <nl> - case eFE_Activate : <nl> - m_bGotActivation | = IsPortActive ( pActInfo , PLOTX ) ; <nl> - m_bGotActivation | = IsPortActive ( pActInfo , PLOTY ) ; <nl> - break ; <nl> - case eFE_Update : <nl> - Update ( pActInfo ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - private : <nl> - struct SPoint <nl> - { <nl> - CTimeValue when ; <nl> - Vec2 point ; <nl> - } ; <nl> - std : : deque < SPoint > m_points ; <nl> - bool m_bGotActivation ; <nl> - <nl> - void Update ( SActivationInfo * pActInfo ) <nl> - { <nl> - CTimeValue now = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - IRenderAuxGeom * pRenderAuxGeom ( gEnv - > pRenderer - > GetIRenderAuxGeom ( ) ) ; <nl> - <nl> - / / check for new points <nl> - if ( m_bGotActivation ) <nl> - { <nl> - SPoint pt ; <nl> - pt . when = now ; <nl> - pt . point = Vec2 ( GetPortFloat ( pActInfo , PLOTX ) , GetPortFloat ( pActInfo , PLOTY ) ) ; <nl> - m_points . push_back ( pt ) ; <nl> - } <nl> - m_bGotActivation = false ; <nl> - / / check for too old points <nl> - CTimeValue expired = now - GetPortFloat ( pActInfo , MAXPOINTAGE ) ; <nl> - while ( ! m_points . empty ( ) & & m_points . front ( ) . when < expired ) <nl> - m_points . pop_front ( ) ; <nl> - / / check if we ' ve anything to draw <nl> - if ( m_points . size ( ) < 2 ) <nl> - return ; <nl> - / / calculate bounds <nl> - Vec2 botLeft , topRight ; <nl> - topRight = botLeft = m_points [ 0 ] . point ; <nl> - for ( size_t i = 1 ; i < m_points . size ( ) ; i + + ) <nl> - { <nl> - if ( botLeft . x > m_points [ i ] . point . x ) <nl> - botLeft . x = m_points [ i ] . point . x ; <nl> - if ( botLeft . y > m_points [ i ] . point . y ) <nl> - botLeft . y = m_points [ i ] . point . y ; <nl> - if ( topRight . x < m_points [ i ] . point . x ) <nl> - topRight . x = m_points [ i ] . point . x ; <nl> - if ( topRight . y < m_points [ i ] . point . y ) <nl> - topRight . y = m_points [ i ] . point . y ; <nl> - } <nl> - if ( botLeft . x = = topRight . x | | botLeft . y = = topRight . y ) <nl> - return ; <nl> - / / draw the " chart " <nl> - Vec3 colorBase = GetPortVec3 ( pActInfo , PLOTCOLOR ) / 255 . 0f ; <nl> - float maxAge = GetPortFloat ( pActInfo , MAXPOINTAGE ) ; <nl> - Vec2 scalePoint = Vec2 ( GetPortFloat ( pActInfo , WIDTH ) , GetPortFloat ( pActInfo , HEIGHT ) ) ; <nl> - scalePoint . x / = ( topRight - botLeft ) . x ; <nl> - scalePoint . y / = ( topRight - botLeft ) . y ; <nl> - Vec3 posGraph = Vec3 ( GetPortFloat ( pActInfo , POSX ) , GetPortFloat ( pActInfo , POSY ) , 0 ) ; <nl> - Vec2 p0 = ( m_points [ 0 ] . point - botLeft ) ; <nl> - Vec3 prevPoint ( p0 . x , p0 . y , 0 . 0f ) ; <nl> - prevPoint . x * = scalePoint . x ; <nl> - prevPoint . y * = scalePoint . y ; <nl> - prevPoint + = posGraph ; <nl> - prevPoint . x / = 800 . 0f ; <nl> - prevPoint . y / = 600 . 0f ; <nl> - ColorF prevColor ( colorBase . x , colorBase . y , colorBase . z , 1 . 0f - ( now - m_points [ 0 ] . when ) . GetSeconds ( ) / maxAge ) ; <nl> - SAuxGeomRenderFlags renderFlags ( e_Def2DPublicRenderflags ) ; <nl> - renderFlags . SetAlphaBlendMode ( e_AlphaBlended ) ; <nl> - for ( size_t i = 1 ; i < m_points . size ( ) ; i + + ) <nl> - { <nl> - p0 = ( m_points [ i ] . point - botLeft ) ; <nl> - Vec3 point ( p0 . x , p0 . y , 0 . 0f ) ; <nl> - point . x * = scalePoint . x ; <nl> - point . y * = scalePoint . y ; <nl> - point + = posGraph ; <nl> - point . x / = 800 . 0f ; <nl> - point . y / = 600 . 0f ; <nl> - ColorF color ( colorBase . x , colorBase . y , colorBase . z , 1 . 0f - ( now - m_points [ i ] . when ) . GetSeconds ( ) / maxAge ) ; <nl> - pRenderAuxGeom - > SetRenderFlags ( renderFlags ) ; <nl> - pRenderAuxGeom - > DrawLine ( prevPoint , prevColor , point , color ) ; <nl> - prevPoint = point ; <nl> - prevColor = color ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Log : Plot " , CFlowPlotNode ) ; <nl> deleted file mode 100644 <nl> index 97342bd394 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowSaveGameNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / File name : FlowSaveGameNode . cpp <nl> - / / Version : v1 . 00 <nl> - / / Created : 28 - 08 - 2006 by AlexL <nl> - / / Compilers : Visual Studio . NET 2003 <nl> - / / Description : <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - / / History : <nl> - / / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # include " StdAfx . h " <nl> - # include < FlowSystem / Nodes / FlowBaseNode . h > <nl> - <nl> - # include " CryAction . h " <nl> - # include < CryGame / IGame . h > <nl> - # include " ICheckPointSystem . h " <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - const static int NUM_SAVE_LOAD_ENTITIES = 5 ; <nl> - <nl> - class CFlowNodeCheckpoint : public CFlowBaseNode < eNCT_Instanced > , ICheckpointListener <nl> - { <nl> - public : <nl> - CFlowNodeCheckpoint ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_iSaveId = m_iLoadId = 0 ; <nl> - memset ( m_saveLoadEntities , 0 , sizeof ( m_saveLoadEntities ) ) ; <nl> - CCryAction : : GetCryAction ( ) - > GetICheckpointSystem ( ) - > RegisterListener ( this ) ; <nl> - } <nl> - <nl> - virtual ~ CFlowNodeCheckpoint ( ) <nl> - { <nl> - CCryAction : : GetCryAction ( ) - > GetICheckpointSystem ( ) - > RemoveListener ( this ) ; <nl> - } <nl> - <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) { return new CFlowNodeCheckpoint ( pActInfo ) ; } <nl> - <nl> - / / ICheckpointListener <nl> - void OnSave ( SCheckpointData * pCheckpoint , ICheckpointSystem * pSystem ) <nl> - { <nl> - CRY_ASSERT ( pSystem ) ; <nl> - <nl> - / / output onSave <nl> - m_iSaveId = ( int ) ( pCheckpoint - > m_checkPointId ) ; <nl> - <nl> - / / this saves designer - controlled entities ( breakables , destructables . . . ) <nl> - for ( int i = 0 ; i < NUM_SAVE_LOAD_ENTITIES ; + + i ) <nl> - { <nl> - / / this comes with the ICheckpointListener <nl> - pSystem - > SaveExternalEntity ( m_saveLoadEntities [ i ] ) ; <nl> - } <nl> - } <nl> - void OnLoad ( SCheckpointData * pCheckpoint , ICheckpointSystem * pSystem ) <nl> - { <nl> - / / output onLoad <nl> - m_iLoadId = ( int ) ( pCheckpoint - > m_checkPointId ) ; <nl> - <nl> - / / loading external entities happens inside the CheckpointSystem <nl> - } <nl> - / / ~ ICheckpointListener <nl> - <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - enum <nl> - { <nl> - EIP_LoadLastCheckpoint = 0 , <nl> - EIP_SaveLoadEntityStart <nl> - } ; <nl> - <nl> - enum <nl> - { <nl> - EOP_OnSave = 0 , <nl> - EOP_OnLoad , <nl> - } ; <nl> - <nl> - void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = <nl> - { <nl> - InputPortConfig_Void ( " LoadLastCheckpoint " , _HELP ( " Load the last checkpoint which was saved during the current session . " ) ) , <nl> - InputPortConfig < EntityId > ( " SaveLoadEntity1 " , _HELP ( " Save and load this entity when a checkpoint is triggered . " ) ) , <nl> - InputPortConfig < EntityId > ( " SaveLoadEntity2 " , _HELP ( " Save and load this entity when a checkpoint is triggered . " ) ) , <nl> - InputPortConfig < EntityId > ( " SaveLoadEntity3 " , _HELP ( " Save and load this entity when a checkpoint is triggered . " ) ) , <nl> - InputPortConfig < EntityId > ( " SaveLoadEntity4 " , _HELP ( " Save and load this entity when a checkpoint is triggered . " ) ) , <nl> - InputPortConfig < EntityId > ( " SaveLoadEntity5 " , _HELP ( " Save and load this entity when a checkpoint is triggered . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < int > ( " SaveDone " , _HELP ( " Triggered when saved " ) ) , <nl> - OutputPortConfig < int > ( " LoadDone " , _HELP ( " Triggered when loaded " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Checkpoint System Output " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - <nl> - void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - / / initialization event <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - / / since we cannot send data to the flowgraph at any time , we need to wait for updates . . <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - break ; <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , EIP_LoadLastCheckpoint ) ) <nl> - { <nl> - CCryAction : : GetCryAction ( ) - > GetICheckpointSystem ( ) - > LoadLastCheckpoint ( ) ; <nl> - } <nl> - break ; <nl> - case eFE_Update : <nl> - if ( m_iSaveId > 0 ) <nl> - { <nl> - ActivateOutput ( pActInfo , EOP_OnSave , m_iSaveId ) ; <nl> - m_iSaveId = 0 ; <nl> - } <nl> - if ( m_iLoadId > 0 ) <nl> - { <nl> - ActivateOutput ( pActInfo , EOP_OnLoad , m_iLoadId ) ; <nl> - m_iLoadId = 0 ; <nl> - } <nl> - <nl> - for ( int entityIndex = 0 , portIndex = EIP_SaveLoadEntityStart ; portIndex < ( EIP_SaveLoadEntityStart + NUM_SAVE_LOAD_ENTITIES ) ; + + portIndex , + + entityIndex ) <nl> - { <nl> - m_saveLoadEntities [ entityIndex ] = GetPortEntityId ( pActInfo , portIndex ) ; <nl> - <nl> - } <nl> - / * <nl> - m_saveLoadEntities [ 0 ] = GetPortEntityId ( pActInfo , EIP_SaveLoadEntity1 ) ; <nl> - m_saveLoadEntities [ 1 ] = GetPortEntityId ( pActInfo , EIP_SaveLoadEntity2 ) ; <nl> - m_saveLoadEntities [ 2 ] = GetPortEntityId ( pActInfo , EIP_SaveLoadEntity3 ) ; <nl> - m_saveLoadEntities [ 3 ] = GetPortEntityId ( pActInfo , EIP_SaveLoadEntity4 ) ; <nl> - m_saveLoadEntities [ 4 ] = GetPortEntityId ( pActInfo , EIP_SaveLoadEntity5 ) ; <nl> - * / <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - private : <nl> - <nl> - int m_iSaveId , m_iLoadId ; <nl> - EntityId m_saveLoadEntities [ NUM_SAVE_LOAD_ENTITIES ] ; <nl> - } ; <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Register nodes <nl> - <nl> - REGISTER_FLOW_NODE ( " System : CheckpointSystem " , CFlowNodeCheckpoint ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowStatsNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowStatsNodes . cpp <nl> class CFlowNode_FrameStatsEx : public CFlowBaseNode < eNCT_Singleton > <nl> unsigned long m_lFrameCounter ; <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Stats : Memory " , CFlowNode_MemoryStats ) ; <nl> - REGISTER_FLOW_NODE ( " Stats : Frame " , CFlowNode_FrameStats ) ; <nl> - REGISTER_FLOW_NODE ( " Stats : FrameExtended " , CFlowNode_FrameStatsEx ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : Memory " , CFlowNode_MemoryStats ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : Frame " , CFlowNode_FrameStats ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : FrameExtended " , CFlowNode_FrameStatsEx ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowStringNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowStringNodes . cpp <nl> class CFlowNode_SetString : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - class CFlowNode_MathSetString : public CFlowNode_SetString <nl> - { <nl> - public : <nl> - CFlowNode_MathSetString ( SActivationInfo * pActInfo ) : CFlowNode_SetString ( pActInfo ) { } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - CFlowNode_SetString : : GetConfiguration ( config ) ; <nl> - config . sDescription = _HELP ( " Deprecated . Use String : SetString instead " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class CFlowNode_StringConcat : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> class CFlowNode_StringConcat : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Math : SetString " , CFlowNode_MathSetString ) ; / / Legacy <nl> REGISTER_FLOW_NODE ( " String : SetString " , CFlowNode_SetString ) ; <nl> REGISTER_FLOW_NODE ( " String : Compare " , CFlowNode_CompareStrings ) ; <nl> REGISTER_FLOW_NODE ( " String : Concat " , CFlowNode_StringConcat ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowWeaponNodes . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / FlowWeaponNodes . cpp <nl> class CFlowNode_ChangeFireMode : public CFlowBaseNode < eNCT_Singleton > <nl> <nl> REGISTER_FLOW_NODE ( " Weapon : AutoSightWeapon " , CFlowNode_AutoSightWeapon ) ; <nl> REGISTER_FLOW_NODE ( " Weapon : FireWeapon " , CFlowNode_FireWeapon ) ; <nl> - REGISTER_FLOW_NODE ( " Weapon : WeaponListener " , CFlowNode_WeaponListener ) ; <nl> + REGISTER_FLOW_NODE ( " Weapon : Listener " , CFlowNode_WeaponListener ) ; <nl> REGISTER_FLOW_NODE ( " Weapon : Ammo " , CFlowNode_WeaponAmmo ) ; <nl> REGISTER_FLOW_NODE ( " Weapon : ChangeFireMode " , CFlowNode_ChangeFireMode ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / GameTokenNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / GameTokenNode . cpp <nl> class CFlowNodeGameTokensLevelToLevelRestore : public CFlowBaseNode < eNCT_Singlet <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Mission : ModifyToken " , CModifyGameTokenFlowNode ) ; <nl> - REGISTER_FLOW_NODE ( " Mission : SetGameToken " , CSetGameTokenFlowNode ) ; <nl> - REGISTER_FLOW_NODE ( " Mission : GetGameToken " , CGetGameTokenFlowNode ) ; <nl> - REGISTER_FLOW_NODE ( " Mission : CheckGameToken " , CCheckGameTokenFlowNode ) ; <nl> + REGISTER_FLOW_NODE ( " Mission : GameTokenModify " , CModifyGameTokenFlowNode ) ; <nl> + REGISTER_FLOW_NODE ( " Mission : GameTokenSet " , CSetGameTokenFlowNode ) ; <nl> + REGISTER_FLOW_NODE ( " Mission : GameTokenGet " , CGetGameTokenFlowNode ) ; <nl> + REGISTER_FLOW_NODE ( " Mission : GameTokenCheck " , CCheckGameTokenFlowNode ) ; <nl> REGISTER_FLOW_NODE ( " Mission : GameTokenCheckMulti " , CGameTokenCheckMultiFlowNode ) ; <nl> REGISTER_FLOW_NODE ( " Mission : GameToken " , CGameTokenFlowNode ) ; <nl> REGISTER_FLOW_NODE ( " Mission : GameTokensLevelToLevelStore " , CFlowNodeGameTokensLevelToLevelStore ) ; <nl> deleted file mode 100644 <nl> index 702b9f4ee7 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / LinearInterpolatorNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include < CrySystem / ISystem . h > <nl> - # include " FlowBaseNode . h " <nl> - <nl> - class CMoveTo_Node : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - Vec3 m_position ; <nl> - Vec3 m_destination ; <nl> - float m_lastTime ; <nl> - float m_topSpeed ; <nl> - float m_easeDistance ; <nl> - <nl> - public : <nl> - CMoveTo_Node ( SActivationInfo * pActInfo ) <nl> - : m_position ( ZERO ) , <nl> - m_destination ( ZERO ) , <nl> - m_lastTime ( 0 . 0f ) , <nl> - m_topSpeed ( 0 . 0f ) , <nl> - m_easeDistance ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CMoveTo_Node ( pActInfo ) ; <nl> - } <nl> - <nl> - virtual void Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - ser . BeginGroup ( " Local " ) ; <nl> - ser . Value ( " m_position " , m_position ) ; <nl> - ser . Value ( " m_destination " , m_destination ) ; <nl> - ser . Value ( " m_lastTime " , m_lastTime ) ; <nl> - ser . Value ( " m_topSpeed " , m_topSpeed ) ; <nl> - ser . Value ( " m_easeDistance " , m_easeDistance ) ; <nl> - ser . EndGroup ( ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < Vec3 > ( " Destination " , _HELP ( " Destination " ) ) , <nl> - InputPortConfig < float > ( " Speed " , _HELP ( " speed ( m / sec ) " ) ) , <nl> - InputPortConfig < float > ( " EaseDistance " , _HELP ( " distance at which the speed is changed ( in meters ) " ) ) , <nl> - InputPortConfig < bool > ( " Trigger " , _HELP ( " Starts the motion when triggered " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " Current " , _HELP ( " Current position " ) ) , <nl> - OutputPortConfig < bool > ( " Done " , _HELP ( " Goes to TRUE when the destination is reached " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Move between two positions at a defined speed " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - / / to make eFE_Update get called : <nl> - / / pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - / / to turn it off : <nl> - / / pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , 3 ) ) <nl> - { <nl> - / / start interpolation <nl> - IEntity * pEnt = pActInfo - > pEntity ; <nl> - if ( pEnt ) m_position = pEnt - > GetPos ( ) ; <nl> - m_lastTime = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - m_destination = GetPortVec3 ( pActInfo , 0 ) ; <nl> - m_topSpeed = GetPortFloat ( pActInfo , 1 ) ; <nl> - m_easeDistance = GetPortFloat ( pActInfo , 2 ) ; <nl> - if ( m_topSpeed < 0 . 0f ) m_topSpeed = 0 . 0f ; <nl> - if ( m_easeDistance < 0 . 0f ) m_easeDistance = 0 . 0f ; <nl> - <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - ActivateOutput ( pActInfo , 1 , false ) ; <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Initialize : <nl> - { <nl> - m_position = GetPortVec3 ( pActInfo , 0 ) ; <nl> - m_destination = m_position ; <nl> - m_topSpeed = 0 . 0f ; <nl> - m_lastTime = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - ActivateOutput ( pActInfo , 0 , m_position ) ; <nl> - ActivateOutput ( pActInfo , 1 , false ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - float time = gEnv - > pTimer - > GetFrameStartTime ( ) . GetMilliSeconds ( ) ; <nl> - float timeDifference = time - m_lastTime ; <nl> - m_lastTime = time ; <nl> - <nl> - / / let ' s compute the movement vector now <nl> - if ( m_position . IsEquivalent ( m_destination ) ) <nl> - { <nl> - m_position = m_destination ; <nl> - ActivateOutput ( pActInfo , 1 , true ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - } <nl> - else <nl> - { <nl> - Vec3 direction = m_destination - m_position ; <nl> - float distance = direction . GetLength ( ) ; <nl> - Vec3 directionAndSpeed = direction . normalized ( ) ; <nl> - if ( distance < m_easeDistance ) / / takes care of m_easeDistance being 0 <nl> - { <nl> - directionAndSpeed * = distance / m_easeDistance ; <nl> - } <nl> - directionAndSpeed * = ( m_topSpeed * timeDifference ) / 1000 . 0f ; <nl> - <nl> - if ( direction . GetLength ( ) < directionAndSpeed . GetLength ( ) ) <nl> - m_position = m_destination ; <nl> - else <nl> - m_position + = directionAndSpeed ; <nl> - <nl> - } <nl> - ActivateOutput ( pActInfo , 0 , m_position ) ; <nl> - break ; <nl> - } <nl> - } <nl> - ; <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Movement : MoveTo " , CMoveTo_Node ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / OwnerAngularInterpolatorNode . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / OwnerAngularInterpolatorNode . cpp <nl> <nl> / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " StdAfx . h " <nl> - # include < CrySystem / ISystem . h > <nl> - # include < CryMath / Cry_Math . h > <nl> # include " FlowBaseNode . h " <nl> <nl> - class CRotateEntityTo_Node : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - CTimeValue m_startTime ; <nl> - CTimeValue m_endTime ; <nl> - Quat m_targetQuat ; <nl> - Quat m_sourceQuat ; <nl> - Vec3 m_rotVel ; <nl> - <nl> - public : <nl> - CRotateEntityTo_Node ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_targetQuat . SetIdentity ( ) ; <nl> - m_sourceQuat . SetIdentity ( ) ; <nl> - } ; <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CRotateEntityTo_Node ( pActInfo ) ; <nl> - } <nl> - <nl> - void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - ser . BeginGroup ( " Local " ) ; <nl> - ser . Value ( " m_startTime " , m_startTime ) ; <nl> - ser . Value ( " m_endTime " , m_endTime ) ; <nl> - ser . Value ( " m_sourceQuat " , m_sourceQuat ) ; <nl> - ser . Value ( " m_targetQuat " , m_targetQuat ) ; <nl> - ser . EndGroup ( ) ; <nl> - } <nl> - <nl> - enum EInPorts <nl> - { <nl> - IN_DEST = 0 , <nl> - IN_DYN_DEST , <nl> - IN_DURATION , <nl> - IN_START , <nl> - IN_STOP <nl> - } ; <nl> - enum EOutPorts <nl> - { <nl> - OUT_CURRENT = 0 , <nl> - OUT_CURRENT_RAD , <nl> - OUT_DONE <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < Vec3 > ( " Destination " , _HELP ( " Destination " ) ) , <nl> - InputPortConfig < bool > ( " DynamicUpdate " , true , _HELP ( " Dynamic update of Destination [ follow - during - movement ] " ) , _HELP ( " DynamicUpdate " ) ) , <nl> - InputPortConfig < float > ( " Time " , _HELP ( " Duration in seconds " ) ) , <nl> - InputPortConfig_Void ( " Start " , _HELP ( " Trigger this port to start the movement " ) ) , <nl> - InputPortConfig_Void ( " Stop " , _HELP ( " Trigger this port to stop the movement " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < Vec3 > ( " Current " , _HELP ( " Current Rotation in Degrees " ) ) , <nl> - OutputPortConfig < Vec3 > ( " CurrentRad " , _HELP ( " Current Rotation in Radian " ) ) , <nl> - OutputPortConfig_Void ( " DoneTrigger " , _HELP ( " Triggered when destination rotation is reached or rotation stopped " ) , _HELP ( " Done " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Rotate an entity during a defined period of time " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - void DegToQuat ( const Vec3 & rotation , Quat & destQuat ) <nl> - { <nl> - Ang3 temp ; <nl> - / / snap the angles <nl> - temp . x = Snap_s360 ( rotation . x ) ; <nl> - temp . y = Snap_s360 ( rotation . y ) ; <nl> - temp . z = Snap_s360 ( rotation . z ) ; <nl> - const Ang3 angRad = DEG2RAD ( temp ) ; <nl> - destQuat . SetRotationXYZ ( angRad ) ; <nl> - } <nl> - <nl> - void Interpol ( const float fTime , SActivationInfo * pActInfo ) <nl> - { <nl> - Quat theQuat ; <nl> - theQuat . SetSlerp ( m_sourceQuat , m_targetQuat , fTime ) ; <nl> - if ( pActInfo - > pEntity ) <nl> - { <nl> - pActInfo - > pEntity - > SetRotation ( theQuat ) ; <nl> - if ( pActInfo - > pEntity - > GetPhysics ( ) ) <nl> - { <nl> - pe_action_set_velocity asv ; <nl> - asv . w = m_rotVel ; <nl> - asv . bRotationAroundPivot = 1 ; <nl> - pActInfo - > pEntity - > GetPhysics ( ) - > Action ( & asv ) ; <nl> - } <nl> - } <nl> - Ang3 angles = Ang3 ( theQuat ) ; <nl> - Ang3 anglesDeg = RAD2DEG ( angles ) ; <nl> - ActivateOutput ( pActInfo , OUT_CURRENT_RAD , Vec3 ( angles ) ) ; <nl> - ActivateOutput ( pActInfo , OUT_CURRENT , Vec3 ( anglesDeg ) ) ; <nl> - } <nl> - <nl> - void StopInterpol ( SActivationInfo * pActInfo ) <nl> - { <nl> - if ( pActInfo - > pEntity & & pActInfo - > pEntity - > GetPhysics ( ) ) <nl> - { <nl> - pe_action_set_velocity asv ; <nl> - asv . w . zero ( ) ; <nl> - asv . bRotationAroundPivot = 1 ; <nl> - pActInfo - > pEntity - > GetPhysics ( ) - > Action ( & asv ) ; <nl> - } <nl> - } <nl> - <nl> - void SnapToTarget ( SActivationInfo * pActInfo ) <nl> - { <nl> - if ( pActInfo - > pEntity ) <nl> - { <nl> - pActInfo - > pEntity - > SetRotation ( m_targetQuat ) ; <nl> - if ( pActInfo - > pEntity - > GetPhysics ( ) ) <nl> - { <nl> - pe_action_set_velocity asv ; <nl> - asv . w . zero ( ) ; <nl> - asv . bRotationAroundPivot = 1 ; <nl> - pActInfo - > pEntity - > GetPhysics ( ) - > Action ( & asv ) ; <nl> - <nl> - pe_params_pos pos ; <nl> - pos . pos = pActInfo - > pEntity - > GetWorldPos ( ) ; <nl> - pos . q = m_targetQuat ; <nl> - pActInfo - > pEntity - > GetPhysics ( ) - > SetParams ( & pos ) ; <nl> - } <nl> - } <nl> - Ang3 angles = Ang3 ( m_targetQuat ) ; <nl> - Ang3 anglesDeg = RAD2DEG ( angles ) ; <nl> - ActivateOutput ( pActInfo , OUT_CURRENT_RAD , Vec3 ( angles ) ) ; <nl> - ActivateOutput ( pActInfo , OUT_CURRENT , Vec3 ( anglesDeg ) ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , IN_STOP ) ) / / Stop <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - ActivateOutput ( pActInfo , OUT_DONE , true ) ; <nl> - StopInterpol ( pActInfo ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , IN_DEST ) & & GetPortBool ( pActInfo , IN_DYN_DEST ) = = true ) <nl> - { <nl> - const Vec3 & destRotDeg = GetPortVec3 ( pActInfo , IN_DEST ) ; <nl> - DegToQuat ( destRotDeg , m_targetQuat ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , IN_START ) ) <nl> - { <nl> - m_startTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - m_endTime = m_startTime + GetPortFloat ( pActInfo , IN_DURATION ) ; <nl> - <nl> - const Vec3 & destRotDeg = GetPortVec3 ( pActInfo , IN_DEST ) ; <nl> - DegToQuat ( destRotDeg , m_targetQuat ) ; <nl> - <nl> - IEntity * pEnt = pActInfo - > pEntity ; <nl> - if ( pEnt ) <nl> - m_sourceQuat = pEnt - > GetRotation ( ) ; <nl> - else <nl> - m_sourceQuat = m_targetQuat ; <nl> - <nl> - Quat targetQuat = ( m_sourceQuat | m_targetQuat ) < 0 ? - m_targetQuat : m_targetQuat ; <nl> - m_rotVel = Quat : : log ( targetQuat * ! m_sourceQuat ) * ( 2 . 0f / max ( 0 . 01f , ( m_endTime - m_startTime ) . GetSeconds ( ) ) ) ; <nl> - <nl> - Interpol ( 0 . 0f , pActInfo ) ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Initialize : <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - break ; <nl> - } <nl> - <nl> - case eFE_Update : <nl> - { <nl> - CTimeValue curTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - const float fDuration = ( m_endTime - m_startTime ) . GetSeconds ( ) ; <nl> - float fPosition ; <nl> - if ( fDuration < = 0 . 0 ) <nl> - fPosition = 1 . 0 ; <nl> - else <nl> - { <nl> - fPosition = ( curTime - m_startTime ) . GetSeconds ( ) / fDuration ; <nl> - fPosition = clamp_tpl ( fPosition , 0 . 0f , 1 . 0f ) ; <nl> - } <nl> - if ( curTime > = m_endTime ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - ActivateOutput ( pActInfo , OUT_DONE , true ) ; <nl> - SnapToTarget ( pActInfo ) ; <nl> - } <nl> - else <nl> - { <nl> - Interpol ( fPosition , pActInfo ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - ; <nl> - } ; <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_RotateSpeed : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - CFlowNode_RotateSpeed ( SActivationInfo * pActInfo ) <nl> - : m_flags ( 0 ) <nl> - , m_speed ( 0 . 0f ) <nl> - , m_interpolate ( 0 . 0f ) <nl> - { <nl> - m_rot . SetIdentity ( ) ; <nl> - m_dest . SetIdentity ( ) ; <nl> - m_iniRot . SetIdentity ( ) ; <nl> - } <nl> - <nl> - ~ CFlowNode_RotateSpeed ( ) <nl> - { <nl> - <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowNode_RotateSpeed ( pActInfo ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - ser . Value ( " m_flags " , m_flags ) ; <nl> - ser . Value ( " m_speed " , m_speed ) ; <nl> - ser . Value ( " m_interpolate " , m_interpolate ) ; <nl> - ser . Value ( " m_rot " , m_rot ) ; <nl> - ser . Value ( " m_dest " , m_dest ) ; <nl> - ser . Value ( " m_iniRot " , m_iniRot ) ; <nl> - <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - if ( EF_RUNNING = = ( m_flags & EF_RUNNING ) ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - ActivateOutput ( pActInfo , EOP_Start , true ) ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_SpeedChanged , m_speed ) ; <nl> - } <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Destination = 0 , <nl> - EIP_Speed , <nl> - EIP_Start , <nl> - EIP_Stop , <nl> - EIP_Reset , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Start = 0 , <nl> - EOP_Stop , <nl> - EOP_Finish , <nl> - EOP_SpeedChanged , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < Vec3 > ( " Destination " , _HELP ( " Angles that define the final orientation in local space " ) ) , <nl> - InputPortConfig < float > ( " Speed " , 1 . 0f , _HELP ( " How fast to rotate ( degrees per second ) " ) ) , <nl> - InputPortConfig_Void ( " Start " , _HELP ( " Start / resume rotating the entity using the desired speed " ) ) , <nl> - InputPortConfig_Void ( " Stop " , _HELP ( " Stop / pause rotating the entity " ) ) , <nl> - InputPortConfig_Void ( " Reset " , _HELP ( " Reset entity rotation to its starting point ( when start was first called ) " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig_Void ( " Start " , _HELP ( " Called when rotation is started " ) ) , <nl> - OutputPortConfig_Void ( " Stop " , _HELP ( " Called when rotation is stopped " ) ) , <nl> - OutputPortConfig_Void ( " Finish " , _HELP ( " Called when rotation is completed " ) ) , <nl> - OutputPortConfig < float > ( " SpeedChange " , _HELP ( " Called when speed is updated " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Rotate an entity to a final destination at a configurable speed " ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - case eFE_SetEntityId : <nl> - { <nl> - / / Stop rotation and reset first start <nl> - m_flags = 0 ; <nl> - m_speed = 0 . 0f ; <nl> - m_interpolate = 0 . 0f ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - m_flags & = ~ ( EF_RUNNING | EF_FIRSTSTART ) ; <nl> - } <nl> - break ; <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - IEntity * pEntity = pActInfo - > pEntity ; <nl> - if ( ! pEntity ) <nl> - return ; <nl> - <nl> - if ( IsPortActive ( pActInfo , EIP_Start ) ) <nl> - { <nl> - if ( EF_RUNNING = = ( m_flags & EF_RUNNING ) ) <nl> - return ; <nl> - <nl> - if ( EF_FIRSTSTART ! = ( m_flags & EF_FIRSTSTART ) ) <nl> - { <nl> - m_flags | = EF_FIRSTSTART ; <nl> - m_iniRot = pEntity - > GetRotation ( ) ; <nl> - m_interpolate = 0 . 0f ; <nl> - m_rot = m_iniRot ; <nl> - } <nl> - if ( EF_FIRSTSTART = = ( m_flags & EF_FIRSTSTART ) ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - m_flags | = EF_RUNNING ; <nl> - ActivateOutput ( pActInfo , EOP_Start , true ) ; <nl> - <nl> - GetNewDestination ( pActInfo ) ; <nl> - m_rot = pEntity - > GetRotation ( ) ; <nl> - GetNewSpeed ( pActInfo ) ; <nl> - m_interpolate = 0 . 0f ; <nl> - } <nl> - } <nl> - if ( IsPortActive ( pActInfo , EIP_Stop ) ) <nl> - { <nl> - if ( EF_RUNNING ! = ( m_flags & EF_RUNNING ) ) <nl> - return ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - m_flags & = ~ EF_RUNNING ; <nl> - ActivateOutput ( pActInfo , EOP_Stop , true ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , EIP_Reset ) ) <nl> - { <nl> - if ( EF_FIRSTSTART = = ( m_flags & EF_FIRSTSTART ) ) <nl> - { <nl> - pEntity - > SetRotation ( m_iniRot ) ; <nl> - m_rot = m_iniRot ; <nl> - m_interpolate = 0 . 0f ; <nl> - } <nl> - } <nl> - if ( IsPortActive ( pActInfo , EIP_Destination ) ) <nl> - { <nl> - GetNewDestination ( pActInfo ) ; <nl> - m_rot = pEntity - > GetRotation ( ) ; <nl> - GetNewSpeed ( pActInfo ) ; <nl> - <nl> - m_interpolate = 0 . 0f ; <nl> - } <nl> - <nl> - if ( IsPortActive ( pActInfo , EIP_Speed ) ) <nl> - { <nl> - GetNewSpeed ( pActInfo ) ; <nl> - } <nl> - <nl> - } <nl> - break ; <nl> - <nl> - case eFE_Update : <nl> - { <nl> - if ( EF_RUNNING ! = ( m_flags & EF_RUNNING ) ) <nl> - return ; <nl> - <nl> - / / Interpolation value increased by speed <nl> - const float speed = m_speed * gEnv - > pTimer - > GetFrameTime ( ) ; <nl> - m_interpolate + = speed ; <nl> - <nl> - / / Update rotation <nl> - Quat quat ; <nl> - quat . SetSlerp ( m_rot , m_dest , min ( m_interpolate , 1 . 0f ) ) ; <nl> - pActInfo - > pEntity - > SetRotation ( quat ) ; <nl> - <nl> - / / Are we at the desired point ? <nl> - if ( m_interpolate > = 1 . 0f ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , false ) ; <nl> - m_flags & = ~ EF_RUNNING ; <nl> - ActivateOutput ( pActInfo , EOP_Finish , true ) ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - / / ! Gets new destination and converts it <nl> - void GetNewDestination ( SActivationInfo * pActInfo ) <nl> - { <nl> - const Vec3 & v = GetPortVec3 ( pActInfo , EIP_Destination ) ; <nl> - const Ang3 ang ( DEG2RAD ( v . x ) , DEG2RAD ( v . y ) , DEG2RAD ( v . z ) ) ; <nl> - m_dest = Quat : : CreateRotationXYZ ( ang ) ; <nl> - } <nl> - <nl> - / / ! Gets new speed and converts it <nl> - void GetNewSpeed ( SActivationInfo * pActInfo ) <nl> - { <nl> - Quat qOriInv = m_rot . GetInverted ( ) ; <nl> - Quat qDist = qOriInv * m_dest ; <nl> - qDist . NormalizeSafe ( ) ; <nl> - <nl> - assert ( qDist . IsValid ( ) ) ; <nl> - assert ( qDist . IsUnit ( ) ) ; <nl> - <nl> - float angDiff = RAD2DEG ( 2 * acosf ( qDist . w ) ) ; <nl> - if ( angDiff > 180 . f ) <nl> - { <nl> - angDiff = 360 . 0f - angDiff ; <nl> - } <nl> - <nl> - const float desiredSpeed = fabsf ( GetPortFloat ( pActInfo , EIP_Speed ) ) ; <nl> - const float speed = ( fabsf ( angDiff ) < 0 . 01f ) ? 0 . 0f : ( desiredSpeed * ( 1 . 0f / 360 . f ) ) * ( 360 . f / angDiff ) ; <nl> - assert ( NumberValid ( speed ) ) ; <nl> - if ( speed ! = m_speed ) <nl> - { <nl> - m_speed = speed ; <nl> - ActivateOutput ( pActInfo , EOP_SpeedChanged , desiredSpeed ) ; <nl> - } <nl> - } <nl> - <nl> - private : <nl> - / / EFlags - Settings for node <nl> - enum EFlags <nl> - { <nl> - EF_FIRSTSTART = 0x01 , <nl> - EF_RUNNING = 0x02 , <nl> - } ; <nl> - <nl> - unsigned char m_flags ; / / See EFlags <nl> - float m_speed ; / / Rotation speed ( deg per sec ) <nl> - float m_interpolate ; / / Interpolation ratio for SLERP <nl> - Quat m_iniRot ; / / Initial rotation ( on first start ) <nl> - Quat m_rot ; / / initial rotation in the current movement <nl> - Quat m_dest ; / / Destination rotation <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> class CRotateEntityToExNode : public CFlowBaseNode < eNCT_Instanced > <nl> class CRotateEntityToExNode : public CFlowBaseNode < eNCT_Instanced > <nl> <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Movement : RotateEntityTo " , CRotateEntityTo_Node ) ; <nl> - REGISTER_FLOW_NODE ( " Movement : RotateEntitySpeed " , CFlowNode_RotateSpeed ) ; <nl> REGISTER_FLOW_NODE ( " Movement : RotateEntityToEx " , CRotateEntityToExNode ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleDamage . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleDamage . cpp <nl> class CFlowVehicleDestroy : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleDamage " , CFlowVehicleDamage ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Damage " , CFlowVehicleDamage ) ; <nl> REGISTER_FLOW_NODE ( " Vehicle : Destroy " , CFlowVehicleDestroy ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleHorn . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleHorn . cpp <nl> class CFlowVehicleHonk <nl> float m_timeout ; <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleHonk " , CFlowVehicleHonk ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Honk " , CFlowVehicleHonk ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleLights . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleLights . cpp <nl> void CFlowVehicleLights : : ProcessEvent ( EFlowEvent flowEvent , SActivationInfo * pAc <nl> } <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleLights " , CFlowVehicleLights ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Lights " , CFlowVehicleLights ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleMoveActionMult . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleMoveActionMult . cpp <nl> void CFlowVehicleMoveActionMult : : OnProcessActions ( SVehicleMovementAction & moveme <nl> movementAction . power = max ( 0 . 0f , movementAction . power ) ; <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleMoveActionMult " , CFlowVehicleMoveActionMult ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : MoveActionMult " , CFlowVehicleMoveActionMult ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleMovement . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleMovement . cpp <nl> void CFlowVehicleMovementParams : : ProcessEvent ( EFlowEvent flowEvent , SActivationI <nl> } <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleMovement " , CFlowVehicleMovement ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Movement " , CFlowVehicleMovement ) ; <nl> REGISTER_FLOW_NODE ( " Vehicle : MovementParams " , CFlowVehicleMovementParams ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehiclePassenger . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehiclePassenger . cpp <nl> void CFlowVehiclePassenger : : OnVehicleEvent ( EVehicleEvent event , const SVehicleEv <nl> } <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehiclePassenger " , CFlowVehiclePassenger ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Passenger " , CFlowVehiclePassenger ) ; <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleSeat . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleSeat . cpp <nl> class CFlowVehicleLock : public CFlowBaseNode < eNCT_Singleton > <nl> <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleSeat " , CFlowVehicleSeat ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Seat " , CFlowVehicleSeat ) ; <nl> REGISTER_FLOW_NODE ( " Vehicle : ChangeSeat " , CFlowVehicleChangeSeat ) <nl> REGISTER_FLOW_NODE ( " Vehicle : Lock " , CFlowVehicleLock ) <nl> mmm a / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleTurret . cpp <nl> ppp b / Code / CryEngine / CryAction / FlowSystem / Nodes / Vehicle / FlowVehicleTurret . cpp <nl> void CFlowVehicleTurret : : Serialize ( SActivationInfo * pActivationInfo , TSerialize <nl> CFlowVehicleBase : : Serialize ( pActivationInfo , ser ) ; <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " Vehicle : VehicleTurret " , CFlowVehicleTurret ) ; <nl> + REGISTER_FLOW_NODE ( " Vehicle : Turret " , CFlowVehicleTurret ) ; <nl> mmm a / Code / CryEngine / CryAction / cryaction . waf_files <nl> ppp b / Code / CryEngine / CryAction / cryaction . waf_files <nl> <nl> " CryAction_flowsystem_nodes_uber . cpp " : { <nl> " Flow System / Nodes " : [ <nl> " FlowSystem / Nodes / FlowVRNodes . cpp " , <nl> - " FlowSystem / Nodes / AngularInterpolatorNode . cpp " , <nl> " FlowSystem / Nodes / ComputeLightingNode . cpp " , <nl> " FlowSystem / Nodes / EntitiesInRangeNode . cpp " , <nl> " FlowSystem / Nodes / FlowCVarsNode . cpp " , <nl> <nl> " FlowSystem / Nodes / FlowActionMapNodes . cpp " , <nl> " FlowSystem / Nodes / FlowInterpolNodes . cpp " , <nl> " FlowSystem / Nodes / FlowInventoryNodes . cpp " , <nl> - " FlowSystem / Nodes / FlowLogInput . cpp " , <nl> " FlowSystem / Nodes / FlowLogNode . cpp " , <nl> " FlowSystem / Nodes / FlowLogicNodes . cpp " , <nl> " FlowSystem / Nodes / FlowMathNodes . cpp " , <nl> <nl> " FlowSystem / Nodes / FlowNodeAI . cpp " , <nl> " FlowSystem / Nodes / FlowNodeAIAction . cpp " , <nl> " FlowSystem / Nodes / FlowNodesAIActionSequence . cpp " , <nl> - " FlowSystem / Nodes / FlowNode_ColliderMode . cpp " , <nl> " FlowSystem / Nodes / FlowNoiseNodes . cpp " , <nl> " FlowSystem / Nodes / FlowPhysicsNodes . cpp " , <nl> - " FlowSystem / Nodes / FlowPlotNode . cpp " , <nl> - " FlowSystem / Nodes / FlowSaveGameNode . cpp " , <nl> " FlowSystem / Nodes / FlowScriptedNode . cpp " , <nl> " FlowSystem / Nodes / FlowStartNode . cpp " , <nl> " FlowSystem / Nodes / FlowStopNode . cpp " , <nl> <nl> " FlowSystem / Nodes / FlowWeaponNodes . cpp " , <nl> " FlowSystem / Nodes / GameTokenNode . cpp " , <nl> " FlowSystem / Nodes / IndexerNode . cpp " , <nl> - " FlowSystem / Nodes / LinearInterpolatorNode . cpp " , <nl> " FlowSystem / Nodes / MultiplexerNode . cpp " , <nl> " FlowSystem / Nodes / OwnerAngularInterpolatorNode . cpp " , <nl> " FlowSystem / Nodes / OwnerAngularRotationNode . cpp " , <nl> <nl> " FlowSystem / Nodes / FlowAudioTriggerNode . cpp " , <nl> " FlowSystem / Nodes / FlowAttachmentNodes . cpp " , <nl> " FlowSystem / Nodes / FlowCustomActionNodes . cpp " , <nl> - " FlowSystem / Nodes / FlowKinectNodes . cpp " , <nl> - " FlowSystem / Nodes / FlowNaturalPointNodes . cpp " , <nl> " FlowSystem / Nodes / AnimationEventListenerNode . cpp " , <nl> " FlowSystem / Nodes / FlowPrefabNodes . cpp " , <nl> " FlowSystem / Nodes / FlowMouseInfo . cpp " , <nl> <nl> " FlowSystem / Nodes / FlowPrefabNodes . h " , <nl> " FlowSystem / Nodes / FlowBaseNode . h " , <nl> " FlowSystem / Nodes / FlowCompositeNode . h " , <nl> - " FlowSystem / Nodes / FlowConditionNode . h " , <nl> " FlowSystem / Nodes / FlowDelayNode . h " , <nl> " FlowSystem / Nodes / FlowEntityNode . h " , <nl> " FlowSystem / Nodes / FlowLogNode . h " , <nl> deleted file mode 100644 <nl> index 50026cbd7a . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Environment / FlowTornado . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowTornado . h " <nl> - <nl> - REGISTER_FLOW_NODE ( " Crysis : TornadoWander " , CFlowTornadoWander ) ; <nl> deleted file mode 100644 <nl> index c1f9516421 . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Environment / FlowTornado . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # ifndef __FLOWTORNADO_H__ <nl> - # define __FLOWTORNADO_H__ <nl> - <nl> - # include " . . / Game . h " <nl> - # include " Tornado . h " <nl> - # include " Nodes / G2FlowBaseNode . h " <nl> - <nl> - class CFlowTornadoWander : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - CFlowTornadoWander ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowTornadoWander ( pActInfo ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " Activate " , _HELP ( " Tell the tornado to actually wander to the new [ Target ] " ) ) , <nl> - InputPortConfig < EntityId > ( " Target " , _HELP ( " Set a new wandering target for the tornado " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig_Void ( " Done " , _HELP ( " Triggered when target has been reached " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . sDescription = _HELP ( " Tells a tornado entity to wander in the direction of the [ Target ] entity " ) ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - m_actInfo = * pActInfo ; <nl> - break ; <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , 0 ) & & pActInfo - > pEntity ) <nl> - { <nl> - CTornado * pTornado = ( CTornado * ) g_pGame - > GetIGameFramework ( ) - > QueryGameObjectExtension ( pActInfo - > pEntity - > GetId ( ) , " Tornado " ) ; <nl> - <nl> - if ( pTornado ) <nl> - { <nl> - IEntity * pTarget = gEnv - > pEntitySystem - > GetEntity ( GetPortEntityId ( pActInfo , 1 ) ) ; <nl> - if ( pTarget ) <nl> - { <nl> - pTornado - > SetTarget ( pTarget , this ) ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - void Done ( ) <nl> - { <nl> - if ( m_actInfo . pGraph ) <nl> - ActivateOutput ( & m_actInfo , 0 , true ) ; <nl> - } <nl> - private : <nl> - SActivationInfo m_actInfo ; <nl> - } ; <nl> - <nl> - # endif / / __FLOWTORNADO_H__ <nl> mmm a / Code / GameSDK / GameDll / Environment / Tornado . cpp <nl> ppp b / Code / GameSDK / GameDll / Environment / Tornado . cpp <nl> <nl> # include " Tornado . h " <nl> # include " . . / Game . h " <nl> # include " . . / Actor . h " <nl> - # include " Environment / FlowTornado . h " <nl> # include < CryAction / IMaterialEffects . h > <nl> # include < IEffectSystem . h > <nl> # include < IVehicleSystem . h > <nl> CTornado : : CTornado ( ) <nl> , m_radius ( 300 . f ) <nl> , m_curMatID ( 0 ) <nl> , m_wanderSpeed ( 10 . 0f ) <nl> - , m_pTargetCallback ( nullptr ) <nl> , m_nextEntitiesCheck ( 0 . 0f ) <nl> , m_spinImpulse ( 9 . 0f ) <nl> , m_attractionImpulse ( 13 . 0f ) <nl> void CTornado : : Update ( SEntityUpdateContext & ctx , int updateSlot ) <nl> bool bValue = true ; <nl> event . nParam [ 2 ] = ( INT_PTR ) & bValue ; <nl> GetEntity ( ) - > SendEvent ( event ) ; <nl> - if ( m_pTargetCallback ) <nl> - m_pTargetCallback - > Done ( ) ; <nl> <nl> m_pTargetEntity = 0 ; <nl> - m_pTargetCallback = 0 ; <nl> } <nl> <nl> targetSteer = ( target - dir ) ; <nl> void CTornado : : SetAuthority ( bool auth ) <nl> { <nl> } <nl> <nl> - void CTornado : : SetTarget ( IEntity * pTargetEntity , CFlowTornadoWander * pCallback ) <nl> + void CTornado : : SetTarget ( IEntity * pTargetEntity ) <nl> { <nl> m_pTargetEntity = pTargetEntity ; <nl> - m_pTargetCallback = pCallback ; <nl> } <nl> <nl> <nl> mmm a / Code / GameSDK / GameDll / Environment / Tornado . h <nl> ppp b / Code / GameSDK / GameDll / Environment / Tornado . h <nl> Description : Tornado entity <nl> <nl> # include < IGameObject . h > <nl> <nl> - class CFlowTornadoWander ; <nl> struct IGroundEffect ; <nl> <nl> class CTornado : public CGameObjectExtensionHelper < CTornado , IGameObjectExtension > <nl> class CTornado : public CGameObjectExtensionHelper < CTornado , IGameObjectExtensio <nl> <nl> / / ~ IGameObjectExtension <nl> <nl> - void SetTarget ( IEntity * pTargetEntity , CFlowTornadoWander * pCallback ) ; <nl> + void SetTarget ( IEntity * pTargetEntity ) ; <nl> <nl> bool Reset ( ) ; <nl> <nl> class CTornado : public CGameObjectExtensionHelper < CTornado , IGameObjectExtensio <nl> <nl> / / target <nl> IEntity * m_pTargetEntity ; / / the tornado will try to reach this entity <nl> - CFlowTornadoWander * m_pTargetCallback ; <nl> <nl> / / <nl> float m_nextEntitiesCheck ; <nl> mmm a / Code / GameSDK / GameDll / FlowVehicleNodes . cpp <nl> ppp b / Code / GameSDK / GameDll / FlowVehicleNodes . cpp <nl> CVehicleActionEntityAttachment * CFlowVehicleEntityAttachment : : GetVehicleAction ( ) <nl> return NULL ; <nl> } <nl> <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - class CFlowVehicleSetAltitudeLimit <nl> - : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - <nl> - CFlowVehicleSetAltitudeLimit ( SActivationInfo * pActivationInfo ) { } ; <nl> - ~ CFlowVehicleSetAltitudeLimit ( ) { } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - enum Inputs <nl> - { <nl> - EIP_SetLimit , <nl> - EIP_Limit <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & nodeConfig ) <nl> - { <nl> - static const SInputPortConfig pInConfig [ ] = <nl> - { <nl> - InputPortConfig_Void ( " SetLimit " , _HELP ( " Trigger to set limit " ) ) , <nl> - InputPortConfig < float > ( " Limit " , _HELP ( " Altitude limit in meters " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - nodeConfig . sDescription = _HELP ( " Set Vehicle ' s Maximum Altitude " ) ; <nl> - nodeConfig . pInputPorts = pInConfig ; <nl> - nodeConfig . pOutputPorts = 0 ; <nl> - nodeConfig . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent flowEvent , SActivationInfo * pActivationInfo ) <nl> - { <nl> - if ( flowEvent = = eFE_Activate & & IsPortActive ( pActivationInfo , EIP_SetLimit ) ) <nl> - { <nl> - const float fVal = GetPortFloat ( pActivationInfo , EIP_Limit ) ; <nl> - char buf [ 64 ] ; <nl> - cry_sprintf ( buf , " % g " , fVal ) ; <nl> - g_pGameCVars - > pAltitudeLimitCVar - > ForceSet ( buf ) ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> class CFlowVehicleDriveForward : public CFlowBaseNode < eNCT_Instanced > , IVehicleEventListener <nl> { <nl> class CFlowNode_VehicleDebugDraw : public CFlowBaseNode < eNCT_Instanced > <nl> } ; <nl> <nl> REGISTER_FLOW_NODE ( " Vehicle : EntityAttachment " , CFlowVehicleEntityAttachment ) ; <nl> - REGISTER_FLOW_NODE ( " Game : SetVehicleAltitudeLimit " , CFlowVehicleSetAltitudeLimit ) ; <nl> REGISTER_FLOW_NODE ( " Vehicle : DriveForward " , CFlowVehicleDriveForward ) ; <nl> REGISTER_FLOW_NODE ( " Vehicle : DebugDraw " , CFlowNode_VehicleDebugDraw ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / AINodes . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / AINodes . cpp <nl> void CFlowNode_AICorpses : : GetMemoryUsage ( ICrySizer * sizer ) const <nl> REGISTER_FLOW_NODE ( " AI : BattleFrontControl " , CFlowNode_BattleFrontControl ) <nl> REGISTER_FLOW_NODE ( " AI : SetTurretFaction " , CFlowNode_SetTurretFaction ) ; <nl> REGISTER_FLOW_NODE ( " AI : AIAwarenessToPlayer " , CFlowNode_AIAwarenessToPlayer ) ; <nl> - REGISTER_FLOW_NODE ( " AI : AIAlertness " , CFlowNode_AIAlertness ) <nl> + REGISTER_FLOW_NODE ( " AI : AlertnessState " , CFlowNode_AIAlertness ) <nl> REGISTER_FLOW_NODE ( " AI : Corpses " , CFlowNode_AICorpses ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / ColorGradientNode . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / ColorGradientNode . cpp <nl> void CFlowNode_ColorGradient : : GetMemoryUsage ( ICrySizer * sizer ) const <nl> sizer - > Add ( * this ) ; <nl> } <nl> <nl> - REGISTER_FLOW_NODE ( " CrysisFX : ColorGradient " , CFlowNode_ColorGradient ) ; <nl> + REGISTER_FLOW_NODE ( " Image : ColorGradient " , CFlowNode_ColorGradient ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowActorNodes . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowActorNodes . cpp <nl> class CFlowNode_AIBodyCount : public CFlowBaseNode < eNCT_Instanced > , SGameRulesLi <nl> int m_enemyDeaths ; <nl> } ; <nl> <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Global AI enemies awareness of player . <nl> - / / this supposed to represent how much player is exposed to the AI enemies <nl> - / / currently <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - class CFlowNode_AIAwareness : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowNode_AIAwareness ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig < float > ( " awareness " , _HELP ( " Global AI enemies awareness of the player \ n0 - Minimum ( Green ) \ n100 - Maximum ( Red ) " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . sDescription = _HELP ( " Global AI enemies awareness of the player " ) ; <nl> - config . pInputPorts = 0 ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - } <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event = = eFE_Update ) <nl> - { <nl> - const float awareness = g_pGame - > GetGameAISystem ( ) - > GetAIAwarenessToPlayerHelper ( ) . GetFloatAwareness ( ) ; <nl> - ActivateOutput ( pActInfo , 0 , awareness ) ; <nl> - } <nl> - else if ( event = = eFE_Initialize ) <nl> - { <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - ActivateOutput ( pActInfo , 0 , 0 ) ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - <nl> class CFlowActorAliveCheck : public CFlowBaseNode < eNCT_Instanced > <nl> { <nl> bool m_errorLogSent ; <nl> class CFlowActorMovementParameter : public CFlowBaseNode < eNCT_Instanced > <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> REGISTER_FLOW_NODE ( " AI : BodyCount " , CFlowNode_AIBodyCount ) ; <nl> - REGISTER_FLOW_NODE ( " AI : AIAwareness " , CFlowNode_AIAwareness ) ; <nl> REGISTER_FLOW_NODE ( " Actor : FacialAnim " , CFlowActorFacialAnim ) ; <nl> REGISTER_FLOW_NODE ( " Actor : FacialExpression " , CFlowActorFacialExpression ) ; <nl> REGISTER_FLOW_NODE ( " Actor : PlayerKnockDown " , CFlowNode_PlayerKnockDown ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowActorSensor . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowActorSensor . cpp <nl> class CFlowNode_ScreenPosToWorldPos : public CFlowBaseNode < eNCT_Instanced > , publ <nl> } ; <nl> <nl> <nl> - REGISTER_FLOW_NODE ( " Game : ActorSensor " , CFlowNode_ActorSensor ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : Sensor " , CFlowNode_ActorSensor ) ; <nl> REGISTER_FLOW_NODE ( " Game : WeaponSensor " , CFlowNode_WeaponSensor ) ; <nl> REGISTER_FLOW_NODE ( " Game : DifficultyLevel " , CFlowNode_DifficultyLevel ) ; <nl> REGISTER_FLOW_NODE ( " Camera : OverrideFOV " , CFlowNode_OverrideFOV ) ; <nl> deleted file mode 100644 <nl> index 596abbdf96 . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowConvoyNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " FlowConvoyNode . h " <nl> - # include < CryAISystem / INavigation . h > <nl> - # include " Player . h " <nl> - # include " Item . h " <nl> - # include " GameCVars . h " <nl> - <nl> - # define MAX_TRAIN_SPEED 8 . f / / for sound <nl> - # define COACH_NUMBER_SOUND_TOGETHER 2 <nl> - <nl> - <nl> - float CFlowConvoyNode : : m_playerMaxVelGround = 0 ; <nl> - <nl> - CConvoyPathIterator : : CConvoyPathIterator ( ) <nl> - { <nl> - Invalidate ( ) ; <nl> - } <nl> - <nl> - void CConvoyPathIterator : : Invalidate ( ) <nl> - { <nl> - Segment = 0 ; <nl> - LastDistance = 0 ; <nl> - } <nl> - <nl> - CConvoyPath : : CConvoyPath ( ) <nl> - : m_totalLength ( 0 . 0f ) <nl> - { <nl> - } <nl> - <nl> - void CConvoyPath : : SetPath ( const std : : vector < Vec3 > & path ) <nl> - { <nl> - int num_path_nodes = path . size ( ) ; <nl> - m_path . resize ( num_path_nodes ) ; <nl> - m_totalLength = 0 . 0f ; <nl> - for ( int i = 0 ; i < num_path_nodes ; i + + ) <nl> - { <nl> - m_path [ i ] . Position = path [ i ] ; <nl> - if ( i < num_path_nodes - 1 ) <nl> - m_path [ i ] . Length = path [ i ] . GetDistance ( path [ i + 1 ] ) ; <nl> - else <nl> - m_path [ i ] . Length = 0 ; <nl> - <nl> - m_path [ i ] . TotalLength = m_totalLength ; <nl> - m_totalLength + = m_path [ i ] . Length ; <nl> - } <nl> - } <nl> - <nl> - Vec3 CConvoyPath : : GetPointAlongPath ( float dist , CConvoyPathIterator & iterator ) <nl> - { <nl> - int size = m_path . size ( ) ; <nl> - <nl> - if ( ! size ) <nl> - return Vec3 ( 0 , 0 , 0 ) ; <nl> - if ( dist < = 0 ) <nl> - return m_path [ 0 ] . Position ; <nl> - if ( dist < iterator . LastDistance ) <nl> - iterator . Invalidate ( ) ; <nl> - <nl> - while ( iterator . Segment + 1 < size & & dist > m_path [ iterator . Segment + 1 ] . TotalLength ) <nl> - iterator . Segment + + ; <nl> - <nl> - iterator . LastDistance = dist ; <nl> - <nl> - if ( iterator . Segment + 1 = = size ) <nl> - return m_path [ iterator . Segment ] . Position ; <nl> - <nl> - return Vec3 : : CreateLerp ( m_path [ iterator . Segment ] . Position , m_path [ iterator . Segment + 1 ] . Position , ( dist - m_path [ iterator . Segment ] . TotalLength ) / m_path [ iterator . Segment ] . Length ) ; <nl> - } <nl> - <nl> - CFlowConvoyNode : : SConvoyCoach : : SConvoyCoach ( ) <nl> - { <nl> - m_pEntity = NULL ; <nl> - m_frontWheelBase = m_backWheelBase = - 1 ; <nl> - m_wheelDistance = 0 . f ; <nl> - m_coachOffset = 0 . f ; <nl> - m_distanceOnPath = 0 . f ; <nl> - m_pEntitySoundsProxy = NULL ; <nl> - / / m_runSoundID = INVALID_SOUNDID ; <nl> - / / m_breakSoundID = INVALID_SOUNDID ; <nl> - } <nl> - <nl> - <nl> - int CFlowConvoyNode : : OnPhysicsPostStep_static ( const EventPhys * pEvent ) <nl> - { <nl> - for ( std : : vector < CFlowConvoyNode * > : : iterator it = gFlowConvoyNodes . begin ( ) ; gFlowConvoyNodes . end ( ) ! = it ; + + it ) <nl> - { <nl> - CFlowConvoyNode * node = * it ; <nl> - <nl> - if ( node - > m_processNode ) <nl> - { <nl> - node - > OnPhysicsPostStep ( pEvent ) ; <nl> - } <nl> - } <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - CFlowConvoyNode : : CFlowConvoyNode ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_distanceOnPath = 0 ; <nl> - m_bFirstUpdate = true ; <nl> - m_bXAxisFwd = false ; <nl> - m_speed = 0 . 0f ; <nl> - m_desiredSpeed = 0 . 0f ; <nl> - m_ShiftTime = 0 . 0f ; <nl> - m_splitSpeed = 0 ; <nl> - m_coachIndex = - 1 ; <nl> - m_splitCoachIndex = 0 ; <nl> - m_loopCount = 0 ; <nl> - m_loopTotal = 0 ; <nl> - m_offConvoyStartTime = 0 . f ; <nl> - m_splitDistanceOnPath = 0 ; <nl> - / / m_hornSoundID = INVALID_SOUNDID ; <nl> - / / m_engineStartSoundID = INVALID_SOUNDID ; <nl> - m_startBreakSoundShifted = 0 ; <nl> - pActInfo - > pGraph - > SetRegularlyUpdated ( pActInfo - > myID , true ) ; <nl> - if ( gFlowConvoyNodes . empty ( ) ) <nl> - gEnv - > pPhysicalWorld - > AddEventClient ( EventPhysPostStep : : id , OnPhysicsPostStep_static , 0 ) ; <nl> - gFlowConvoyNodes . push_back ( this ) ; <nl> - <nl> - ICVar * pICVar = gEnv - > pConsole - > GetCVar ( " es_UsePhysVisibilityChecks " ) ; <nl> - if ( pICVar ) / / prevent distance problem between coaches <nl> - pICVar - > Set ( 0 ) ; <nl> - <nl> - m_processNode = false ; <nl> - m_atEndOfPath = false ; <nl> - } <nl> - <nl> - CFlowConvoyNode : : ~ CFlowConvoyNode ( ) <nl> - { <nl> - for ( size_t i = 0 ; i < gFlowConvoyNodes . size ( ) ; + + i ) <nl> - { <nl> - if ( gFlowConvoyNodes [ i ] = = this ) <nl> - { <nl> - gFlowConvoyNodes . erase ( gFlowConvoyNodes . begin ( ) + i ) ; <nl> - break ; <nl> - } <nl> - } <nl> - if ( gFlowConvoyNodes . empty ( ) ) <nl> - { <nl> - gEnv - > pPhysicalWorld - > RemoveEventClient ( EventPhysPostStep : : id , OnPhysicsPostStep_static , 0 ) ; <nl> - stl : : free_container ( gFlowConvoyNodes ) ; <nl> - } <nl> - <nl> - ICVar * pICVar = gEnv - > pConsole - > GetCVar ( " es_UsePhysVisibilityChecks " ) ; <nl> - if ( pICVar ) <nl> - pICVar - > Set ( 1 ) ; <nl> - } <nl> - <nl> - IFlowNodePtr CFlowConvoyNode : : Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowConvoyNode ( pActInfo ) ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : Serialize ( SActivationInfo * , TSerialize ser ) <nl> - { <nl> - ser . BeginGroup ( " Local " ) ; <nl> - ser . Value ( " m_distanceOnPath " , m_distanceOnPath ) ; <nl> - ser . Value ( " m_speed " , m_speed ) ; <nl> - ser . Value ( " m_desiredSpeed " , m_desiredSpeed ) ; <nl> - ser . Value ( " m_offConvoyStartTime " , m_offConvoyStartTime ) ; <nl> - ser . Value ( " m_coachIndex " , m_coachIndex ) ; <nl> - ser . Value ( " m_loopCount " , m_loopCount ) ; <nl> - ser . Value ( " m_loopTotal " , m_loopTotal ) ; <nl> - ser . Value ( " m_splitCoachIndex " , m_splitCoachIndex ) ; <nl> - ser . Value ( " m_splitSpeed " , m_splitSpeed ) ; <nl> - ser . Value ( " m_splitDistanceOnPath " , m_splitDistanceOnPath ) ; <nl> - ser . Value ( " m_startBreakSoundShifted " , m_startBreakSoundShifted ) ; <nl> - ser . Value ( " m_bXAxisFwd " , m_bXAxisFwd ) ; <nl> - ser . Value ( " m_atEndOfPath " , m_atEndOfPath ) ; <nl> - ser . EndGroup ( ) ; <nl> - <nl> - if ( ser . IsReading ( ) ) / / after load must do some initializing in first update <nl> - m_bFirstUpdate = true ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig in_config [ ] = { <nl> - InputPortConfig < string > ( " Path " , _HELP ( " Path to move the train on " ) ) , <nl> - InputPortConfig < int > ( " LoopCount " , 0 , _HELP ( " How many times to loop along the path ( - 1 for infinite ) " ) ) , <nl> - InputPortConfig < float > ( " Speed " , _HELP ( " Speed in m / s ( not work with negative speed ) " ) ) , <nl> - InputPortConfig < float > ( " DesiredSpeed " , _HELP ( " Speed in m / s ( not work with negative speed ) " ) ) , <nl> - InputPortConfig < bool > ( " Shift " , _HELP ( " dO SHIFT " ) ) , <nl> - InputPortConfig < float > ( " ShiftTime " , _HELP ( " Speed in m / s ( not work with negative speed ) " ) ) , <nl> - InputPortConfig < float > ( " StartDistance " , _HELP ( " Start distance of the last coach end ( from the start of the path ) " ) ) , <nl> - InputPortConfig < int > ( " SplitCoachNumber " , _HELP ( " If acticated , the train splits from this coach " ) ) , <nl> - InputPortConfig < bool > ( " XAxisIsForward " , false , _HELP ( " If true , and coaches are not CHRs , will make X axis forward instead of Y " ) ) , <nl> - InputPortConfig_Void ( " PlayHornSound " , _HELP ( " If acticated , train horn sound played " ) ) , <nl> - InputPortConfig_Void ( " PlayBreakSound " , _HELP ( " If acticated , train break sound played " ) ) , <nl> - InputPortConfig_Void ( " Start " , _HELP ( " Trigger to start the convoy " ) ) , <nl> - InputPortConfig_Void ( " Stop " , _HELP ( " Trigger to stop the convoy " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig out_config [ ] = { <nl> - OutputPortConfig_Void ( " onPathEnd " , _HELP ( " Triggers when first coach reaches the end of the path " ) ) , <nl> - OutputPortConfig < int > ( " PlayerCoachIndex " , _HELP ( " gives the coach index Player is standing on , ( - 1 ) if not on train for at least 4 seconds " ) ) , <nl> - { 0 } <nl> - } ; <nl> - <nl> - config . sDescription = _HELP ( " Convoy node will move a special entity on an AIPath with speed " ) ; <nl> - config . pInputPorts = in_config ; <nl> - config . pOutputPorts = out_config ; <nl> - config . SetCategory ( EFLN_APPROVED ) ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - } <nl> - <nl> - # define PATH_DERIVATION_TIME 0 . 1f <nl> - <nl> - static float breakValue = 0 . 5f ; <nl> - <nl> - int CFlowConvoyNode : : OnPhysicsPostStep ( const EventPhys * pEvent ) <nl> - { <nl> - FUNCTION_PROFILER ( GetISystem ( ) , PROFILE_GAME ) ; <nl> - <nl> - if ( m_bFirstUpdate ) <nl> - return 0 ; / / after QuickLoad OnPhysicsPostStep called before ProcessEvent <nl> - <nl> - const EventPhysPostStep * pPhysPostStepEvent = ( const EventPhysPostStep * ) pEvent ; <nl> - <nl> - IPhysicalEntity * pEventPhysEnt = pPhysPostStepEvent - > pEntity ; <nl> - <nl> - Vec3 posBack , posFront , posCenter ; <nl> - <nl> - for ( size_t i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - { <nl> - IPhysicalEntity * pPhysEnt = m_coaches [ i ] . m_pEntity - > GetPhysics ( ) ; <nl> - <nl> - if ( pEventPhysEnt = = pPhysEnt ) <nl> - { <nl> - if ( m_ShiftTime > 0 . 0f ) <nl> - { <nl> - m_speed = m_speed * ( 1 . 0f - breakValue * pPhysPostStepEvent - > dt / m_MaxShiftTime ) ; <nl> - m_ShiftTime - = pPhysPostStepEvent - > dt ; <nl> - } <nl> - else <nl> - { <nl> - m_speed = m_speed + min ( 1 . 0f , ( pPhysPostStepEvent - > dt / 5 . 0f ) ) * ( m_desiredSpeed - m_speed ) ; <nl> - } <nl> - <nl> - <nl> - float speed = ( m_splitCoachIndex > 0 & & ( int ) i > = m_splitCoachIndex ) ? m_splitSpeed : m_speed ; <nl> - float distance = ( m_coaches [ i ] . m_distanceOnPath + = pPhysPostStepEvent - > dt * speed ) ; <nl> - <nl> - if ( m_splitCoachIndex > 0 ) <nl> - { / / train splitted <nl> - if ( i = = m_splitCoachIndex - 1 ) / / update m_distanceOnPath for serialization <nl> - m_distanceOnPath = distance - m_coaches [ i ] . m_coachOffset ; <nl> - else if ( i = = m_coaches . size ( ) - 1 ) / / update m_splitDistanceOnPath for serialization <nl> - m_splitDistanceOnPath = distance - m_coaches [ i ] . m_coachOffset ; <nl> - } <nl> - else <nl> - { / / train in one piece <nl> - if ( i = = m_coaches . size ( ) - 1 ) / / update m_distanceOnPath for serialization <nl> - m_distanceOnPath = distance - m_coaches [ i ] . m_coachOffset ; <nl> - } <nl> - <nl> - posBack = m_path . GetPointAlongPath ( distance - m_coaches [ i ] . m_wheelDistance , m_coaches [ i ] . m_backWheelIterator [ 0 ] ) ; <nl> - posFront = m_path . GetPointAlongPath ( distance + m_coaches [ i ] . m_wheelDistance , m_coaches [ i ] . m_frontWheelIterator [ 0 ] ) ; <nl> - posCenter = ( posBack + posFront ) * 0 . 5f ; <nl> - <nl> - <nl> - Vec3 posDiff = posFront - posBack ; <nl> - float magnitude = posDiff . GetLength ( ) ; <nl> - <nl> - if ( magnitude > FLT_EPSILON ) <nl> - { <nl> - posDiff * = 1 . 0f / magnitude ; <nl> - <nl> - pe_params_pos ppos ; <nl> - ppos . pos = posCenter ; <nl> - ppos . q = Quat : : CreateRotationVDir ( posDiff ) ; <nl> - if ( m_bXAxisFwd ) <nl> - ppos . q * = Quat : : CreateRotationZ ( gf_PI * - 0 . 5f ) ; <nl> - pPhysEnt - > SetParams ( & ppos , 0 / * bThreadSafe = 0 * / ) ; / / as we are calling from the physics thread <nl> - <nl> - Vec3 futurePositionBack , futurePositionFront ; <nl> - futurePositionBack = m_path . GetPointAlongPath ( distance + PATH_DERIVATION_TIME * speed - m_coaches [ i ] . m_wheelDistance , m_coaches [ i ] . m_backWheelIterator [ 1 ] ) ; <nl> - futurePositionFront = m_path . GetPointAlongPath ( distance + PATH_DERIVATION_TIME * speed + m_coaches [ i ] . m_wheelDistance , m_coaches [ i ] . m_frontWheelIterator [ 1 ] ) ; <nl> - <nl> - Vec3 futurePosDiff = futurePositionFront - futurePositionBack ; <nl> - magnitude = futurePosDiff . GetLength ( ) ; <nl> - <nl> - if ( magnitude > FLT_EPSILON ) <nl> - { <nl> - futurePosDiff * = 1 . 0f / magnitude ; <nl> - <nl> - pe_action_set_velocity setVel ; <nl> - setVel . v = ( ( futurePositionBack + futurePositionFront ) * 0 . 5f - posCenter ) * ( 1 . 0f / PATH_DERIVATION_TIME ) ; <nl> - <nl> - / / Vec3 dir = ( posFront - posBack ) . GetNormalized ( ) ; <nl> - / / Vec3 future_dir = ( futurePositionFront - futurePositionBack ) . GetNormalized ( ) ; <nl> - Vec3 w = posDiff . Cross ( futurePosDiff ) ; <nl> - float angle = asin_tpl ( w . GetLength ( ) ) ; <nl> - setVel . w = ( angle / PATH_DERIVATION_TIME ) * w . GetNormalized ( ) ; <nl> - pPhysEnt - > Action ( & setVel , 0 / * bThreadSafe = 0 * / ) ; / / as we are calling from the physics thread <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / Done processing once we reach end of path <nl> - if ( m_atEndOfPath ) <nl> - m_processNode = false ; <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - bool CFlowConvoyNode : : PlayerIsOnaConvoy ( ) <nl> - { <nl> - for ( size_t i = 0 ; i < gFlowConvoyNodes . size ( ) ; + + i ) <nl> - { <nl> - if ( gFlowConvoyNodes [ i ] - > m_coachIndex > = 0 ) <nl> - return true ; <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : DiscoverConvoyCoaches ( IEntity * pEntity ) <nl> - { <nl> - m_coaches . resize ( 0 ) ; <nl> - <nl> - while ( pEntity ) <nl> - { <nl> - SConvoyCoach tc ; <nl> - <nl> - ICharacterInstance * pCharacterInstance = pEntity - > GetCharacter ( 0 ) ; <nl> - ISkeletonPose * pSkeletonPose = pCharacterInstance ? pCharacterInstance - > GetISkeletonPose ( ) : NULL ; <nl> - IDefaultSkeleton * pIDefaultSkeleton = pCharacterInstance ? & pCharacterInstance - > GetIDefaultSkeleton ( ) : NULL ; <nl> - IPhysicalEntity * pPhysics = pEntity - > GetPhysics ( ) ; <nl> - if ( ! pPhysics ) <nl> - { <nl> - / / don ' t need physics here , but need it later , so don ' t use entity if it ' s not physicalized <nl> - GameWarning ( " Convoy entity [ % s ] is not physicalized " , pEntity - > GetName ( ) ) ; <nl> - break ; <nl> - } <nl> - <nl> - AABB bbox ; <nl> - pEntity - > GetLocalBounds ( bbox ) ; <nl> - <nl> - / / tc . m_coachOffset = ( bbox . max . y - bbox . min . y ) * . 5f ; <nl> - tc . m_coachOffset = 10 . 0f ; <nl> - <nl> - tc . m_frontWheelBase = pIDefaultSkeleton ? pIDefaultSkeleton - > GetJointIDByName ( " wheel_base1 " ) : - 1 ; <nl> - tc . m_backWheelBase = pIDefaultSkeleton ? pIDefaultSkeleton - > GetJointIDByName ( " wheel_base2 " ) : - 1 ; <nl> - <nl> - if ( tc . m_frontWheelBase > = 0 & & tc . m_backWheelBase > = 0 ) <nl> - { <nl> - QuatT qt1 = pSkeletonPose - > GetRelJointByID ( tc . m_frontWheelBase ) ; <nl> - QuatT qt2 = pSkeletonPose - > GetRelJointByID ( tc . m_backWheelBase ) ; <nl> - tc . m_wheelDistance = qt1 . t . GetDistance ( qt2 . t ) * . 5f ; <nl> - } <nl> - else <nl> - { <nl> - / / Fallback for entities that don ' t have wheel_base joints <nl> - if ( m_bXAxisFwd ) <nl> - tc . m_wheelDistance = ( bbox . max . x - bbox . min . x ) * . 5f ; <nl> - else <nl> - tc . m_wheelDistance = ( bbox . max . y - bbox . min . y ) * . 5f ; <nl> - } <nl> - <nl> - tc . m_pEntity = pEntity ; <nl> - / / pEntity - > SetConvoyEntity ( ) ; <nl> - / / for ( int i = 0 ; i < pEntity - > GetChildCount ( ) ; i + + ) <nl> - / / pEntity - > GetChild ( i ) - > SetConvoyEntity ( ) ; <nl> - <nl> - / / tc . m_pEntitySoundsProxy = ( IEntityAudioProxy * ) tc . m_pEntity - > CreateProxy ( ENTITY_PROXY_AUDIO ) ; <nl> - / / assert ( tc . m_pEntitySoundsProxy ) ; <nl> - <nl> - m_coaches . push_back ( tc ) ; <nl> - IEntityLink * pEntityLink = pEntity - > GetEntityLinks ( ) ; <nl> - pEntity = pEntityLink ? gEnv - > pEntitySystem - > GetEntity ( pEntityLink - > entityId ) : NULL ; <nl> - } <nl> - } <nl> - <nl> - <nl> - void CFlowConvoyNode : : InitConvoyCoaches ( ) <nl> - { <nl> - float distance = m_splitCoachIndex > 0 ? m_splitDistanceOnPath : m_distanceOnPath ; <nl> - <nl> - for ( int i = m_coaches . size ( ) - 1 ; i > = 0 ; - - i ) <nl> - { <nl> - if ( m_splitCoachIndex > 0 & & i = = m_splitCoachIndex - 1 ) <nl> - distance = m_distanceOnPath ; / / find the first train part end distance <nl> - <nl> - distance + = m_coaches [ i ] . m_coachOffset ; <nl> - m_coaches [ i ] . m_distanceOnPath = distance ; <nl> - distance + = m_coaches [ i ] . m_coachOffset ; <nl> - <nl> - IPhysicalEntity * pPhysics = m_coaches [ i ] . m_pEntity - > GetPhysics ( ) ; <nl> - pe_params_flags flags ; <nl> - flags . flagsOR = pef_monitor_poststep | pef_fixed_damping ; <nl> - pPhysics - > SetParams ( & flags ) ; <nl> - <nl> - pe_params_foreign_data pfd ; <nl> - pfd . iForeignFlagsOR = 0 ; / / PFF_ALWAYS_VISIBLE ; <nl> - pPhysics - > SetParams ( & pfd ) ; <nl> - <nl> - pe_simulation_params sp ; <nl> - sp . mass = - 1 ; <nl> - sp . damping = sp . dampingFreefall = 0 ; <nl> - pPhysics - > SetParams ( & sp ) ; <nl> - } <nl> - } <nl> - <nl> - void CFlowConvoyNode : : AwakeCoaches ( ) / / awake the physics <nl> - { <nl> - pe_action_awake aa ; <nl> - aa . bAwake = 1 ; <nl> - for ( size_t i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - { <nl> - IPhysicalEntity * pPhysics = m_coaches [ i ] . m_pEntity - > GetPhysics ( ) ; <nl> - pPhysics - > Action ( & aa ) ; <nl> - } <nl> - } <nl> - <nl> - int CFlowConvoyNode : : GetCoachIndexPlayerIsOn ( ) <nl> - { <nl> - IPhysicalEntity * pGroundCollider = NULL ; <nl> - IActor * pPlayerActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ; <nl> - <nl> - / / if player use a mounted weapon on the train , the GroundCollider check not good <nl> - if ( m_coachIndex > = 0 ) <nl> - { / / player can catch mounted weapon on the train if he were on it before <nl> - CItem * pCurrentItem = static_cast < CItem * > ( pPlayerActor - > GetCurrentItem ( ) ) ; <nl> - if ( pCurrentItem ! = NULL & & pCurrentItem - > IsMounted ( ) ) <nl> - return m_coachIndex ; / / give back the last m_coachIndex , it should be valid <nl> - } <nl> - <nl> - IPhysicalEntity * pPhysicalEntity = pPlayerActor - > GetEntity ( ) - > GetPhysics ( ) ; <nl> - if ( pPhysicalEntity ) <nl> - { <nl> - pe_status_living livStat ; <nl> - if ( pPhysicalEntity - > GetStatus ( & livStat ) ) <nl> - pGroundCollider = livStat . pGroundCollider ; <nl> - } <nl> - <nl> - if ( ! pGroundCollider ) <nl> - return - 1 ; <nl> - <nl> - for ( size_t i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - { <nl> - if ( m_coaches [ i ] . m_pEntity - > GetPhysics ( ) = = pGroundCollider ) <nl> - return i ; <nl> - else <nl> - { / / attached objects <nl> - IEntity * pCoachEntity = m_coaches [ i ] . m_pEntity ; <nl> - for ( int j = 0 ; j < pCoachEntity - > GetChildCount ( ) ; + + j ) <nl> - { <nl> - if ( pCoachEntity - > GetChild ( j ) - > GetPhysics ( ) = = pGroundCollider ) <nl> - return i ; <nl> - } <nl> - } <nl> - } <nl> - return - 1 ; <nl> - } <nl> - <nl> - int CFlowConvoyNode : : GetCoachIndexPlayerIsOn2 ( ) <nl> - { <nl> - IActor * pPlayerActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ; <nl> - Vec3 playerPos = pPlayerActor - > GetEntity ( ) - > GetWorldPos ( ) ; <nl> - for ( size_t i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - { <nl> - AABB bbox ; <nl> - m_coaches [ i ] . m_pEntity - > GetLocalBounds ( bbox ) ; <nl> - Vec3 localpos = m_coaches [ i ] . m_pEntity - > GetWorldTM ( ) . GetInverted ( ) . TransformPoint ( playerPos ) ; <nl> - if ( bbox . min . x < = localpos . x & & bbox . min . y < = localpos . y & & bbox . max . x > = localpos . x & & bbox . max . y > = localpos . y ) <nl> - return i ; <nl> - } <nl> - return - 1 ; <nl> - } <nl> - <nl> - float CFlowConvoyNode : : GetPlayerMaxVelGround ( ) <nl> - { <nl> - IActor * pPlayerActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ; <nl> - if ( pPlayerActor ) <nl> - { <nl> - IPhysicalEntity * pPhysicalEntity = pPlayerActor - > GetEntity ( ) - > GetPhysics ( ) ; <nl> - if ( pPhysicalEntity ) <nl> - { <nl> - pe_player_dynamics ppd ; <nl> - pPhysicalEntity - > GetParams ( & ppd ) ; <nl> - return ppd . maxVelGround ; <nl> - } <nl> - } <nl> - return 0 ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : SetPlayerMaxVelGround ( float vel ) <nl> - { <nl> - IActor * pPlayerActor = gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ; <nl> - if ( pPlayerActor ) <nl> - { <nl> - IPhysicalEntity * pPhysicalEntity = pPlayerActor - > GetEntity ( ) - > GetPhysics ( ) ; <nl> - if ( pPhysicalEntity ) <nl> - { <nl> - pe_player_dynamics ppd ; <nl> - ppd . maxVelGround = vel ; <nl> - pPhysicalEntity - > SetParams ( & ppd ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - # define SHIFT_FRAME 5 <nl> - <nl> - void CFlowConvoyNode : : StartBreakSoundShifted ( ) <nl> - { <nl> - / / if ( m_startBreakSoundShifted % SHIFT_FRAME = = 1 ) <nl> - / / { <nl> - / / bool isPlaying = false ; <nl> - / / int index = m_startBreakSoundShifted / SHIFT_FRAME ; <nl> - / / if ( m_coaches [ index ] . m_breakSoundID ! = INVALID_SOUNDID ) <nl> - / / { <nl> - / / ISound * i_sound = m_coaches [ index ] . m_pEntitySoundsProxy - > GetSound ( m_coaches [ index ] . m_breakSoundID ) ; <nl> - / / if ( i_sound & & i_sound - > IsPlaying ( ) ) <nl> - / / isPlaying = true ; <nl> - / / } <nl> - / / if ( ! isPlaying ) <nl> - / / m_coaches [ index ] . m_breakSoundID = m_coaches [ index ] . m_pEntitySoundsProxy - > PlaySound ( " sounds / vehicles_exp1 : train : breaking " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_OneY , FLAG_SOUND_DEFAULT_3D , eSoundSemantic_Vehicle ) ; <nl> - / / if ( index = = m_coaches . size ( ) - 1 ) <nl> - / / m_startBreakSoundShifted = - 1 ; <nl> - / / } <nl> - / / m_startBreakSoundShifted + + ; <nl> - } <nl> - <nl> - # define BIG_MAX_VEL_GROUND 1000000 . f <nl> - # define SPLIT_ACCEL - 0 . 5f / / splitted coaches acceleration <nl> - # define OFF_TRAIN_TIME 4 . f <nl> - <nl> - void CFlowConvoyNode : : ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Update : <nl> - { <nl> - if ( m_processNode ) <nl> - Update ( pActInfo ) ; <nl> - } <nl> - break ; <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , IN_SPEED ) | | IsPortActive ( pActInfo , IN_DESIREDSPEED ) ) <nl> - { <nl> - float speed = 0 ; <nl> - <nl> - speed = GetPortFloat ( pActInfo , IN_DESIREDSPEED ) ; <nl> - <nl> - if ( speed < 0 ) / / do not use negative speed <nl> - speed = 0 ; <nl> - if ( speed > m_speed & & m_speed < 0 . 01f ) <nl> - { <nl> - AwakeCoaches ( ) ; / / if speed is too small Physics go to sleep and callback does not work . . . <nl> - / / have to awake if train start again . should make more elegant . . . ( keep awake somehow ) <nl> - StartSounds ( ) ; <nl> - } <nl> - <nl> - if ( speed = = 0 . f & & m_speed > 0 . f ) <nl> - ConvoyStopSounds ( ) ; <nl> - <nl> - m_desiredSpeed = speed ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_SPLIT_COACH ) ) <nl> - { <nl> - if ( ! m_splitCoachIndex ) <nl> - { <nl> - int splitCoachIndex = GetPortInt ( pActInfo , IN_SPLIT_COACH ) ; <nl> - if ( splitCoachIndex > 0 & & splitCoachIndex < ( int ) m_coaches . size ( ) ) <nl> - { <nl> - m_splitCoachIndex = splitCoachIndex ; <nl> - m_splitDistanceOnPath = m_distanceOnPath ; <nl> - m_distanceOnPath = m_coaches [ m_splitCoachIndex - 1 ] . m_distanceOnPath - m_coaches [ m_splitCoachIndex - 1 ] . m_coachOffset ; <nl> - m_splitSpeed = m_speed ; <nl> - if ( ! ( m_splitCoachIndex & 1 ) ) <nl> - SplitLineSound ( ) ; / / have to split the lineSound ( there is 1 sound for 2 coaches ) <nl> - } <nl> - } <nl> - else <nl> - CryWarning ( VALIDATOR_MODULE_GAME , VALIDATOR_WARNING , " SplitCoachIndex has been set ! Do not set it again ! FlowConvoyNode : % s " , m_coaches [ 0 ] . m_pEntity - > GetName ( ) ) ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_HORN_SOUND ) ) <nl> - { <nl> - / / bool isPlaying = false ; <nl> - / / if ( m_hornSoundID ! = INVALID_SOUNDID ) <nl> - / / { <nl> - / / ISound * i_sound = m_coaches [ 0 ] . m_pEntitySoundsProxy - > GetSound ( m_hornSoundID ) ; <nl> - / / if ( i_sound & & i_sound - > IsPlaying ( ) ) <nl> - / / isPlaying = true ; <nl> - / / } <nl> - / / if ( ! isPlaying ) <nl> - / / m_hornSoundID = m_coaches [ 0 ] . m_pEntitySoundsProxy - > PlaySound ( " sounds / vehicles_exp1 : train : horn " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_OneY , FLAG_SOUND_DEFAULT_3D , eSoundSemantic_Vehicle ) ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_BREAK_SOUND ) & & m_speed > 0 . f ) <nl> - m_startBreakSoundShifted = 1 ; <nl> - else if ( IsPortActive ( pActInfo , IN_START_DISTANCE ) ) <nl> - { <nl> - m_distanceOnPath = GetPortFloat ( pActInfo , IN_START_DISTANCE ) ; <nl> - InitConvoyCoaches ( ) ; <nl> - } <nl> - <nl> - if ( IsPortActive ( pActInfo , IN_SHIFT ) ) <nl> - { <nl> - m_ShiftTime = m_MaxShiftTime = GetPortFloat ( pActInfo , IN_SHIFTTIME ) ; <nl> - bool * p_x = ( pActInfo - > pInputPorts [ IN_SHIFT ] . GetPtr < bool > ( ) ) ; <nl> - <nl> - * p_x = false ; <nl> - } <nl> - } <nl> - <nl> - if ( IsPortActive ( pActInfo , IN_START ) ) <nl> - { <nl> - m_processNode = true ; <nl> - } <nl> - else if ( IsPortActive ( pActInfo , IN_STOP ) ) <nl> - { <nl> - m_processNode = false ; <nl> - } <nl> - break ; <nl> - case eFE_Initialize : <nl> - m_distanceOnPath = GetPortFloat ( pActInfo , IN_START_DISTANCE ) ; <nl> - m_speed = GetPortFloat ( pActInfo , IN_SPEED ) ; <nl> - m_desiredSpeed = GetPortFloat ( pActInfo , IN_DESIREDSPEED ) ; <nl> - <nl> - <nl> - std : : vector < Vec3 > temp ; <nl> - temp . resize ( 1000 ) ; <nl> - uint32 count = gEnv - > pAISystem - > GetINavigation ( ) - > GetPath ( GetPortString ( pActInfo , IN_PATH ) , & temp [ 0 ] , 1000 ) ; <nl> - temp . resize ( count ) ; <nl> - <nl> - m_path . SetPath ( temp ) ; <nl> - m_splitCoachIndex = GetPortInt ( pActInfo , IN_SPLIT_COACH ) ; <nl> - m_loopCount = 0 ; <nl> - m_loopTotal = GetPortInt ( pActInfo , IN_LOOPCOUNT ) ; <nl> - m_bXAxisFwd = GetPortBool ( pActInfo , IN_XAXIS_FWD ) ; <nl> - m_bFirstUpdate = true ; <nl> - m_atEndOfPath = false ; <nl> - StopAllSounds ( ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - void CFlowConvoyNode : : Update ( SActivationInfo * pActInfo ) <nl> - { <nl> - assert ( pActInfo ) ; <nl> - <nl> - if ( m_bFirstUpdate ) <nl> - { <nl> - DiscoverConvoyCoaches ( pActInfo - > pEntity ) ; <nl> - InitConvoyCoaches ( ) ; <nl> - AwakeCoaches ( ) ; <nl> - if ( m_speed > 0 . f ) <nl> - StartSounds ( ) ; <nl> - if ( ! m_playerMaxVelGround ) <nl> - m_playerMaxVelGround = GetPlayerMaxVelGround ( ) ; <nl> - if ( m_coachIndex < 0 ) <nl> - SetPlayerMaxVelGround ( m_playerMaxVelGround ) ; <nl> - else <nl> - SetPlayerMaxVelGround ( BIG_MAX_VEL_GROUND ) ; <nl> - m_bFirstUpdate = false ; <nl> - } <nl> - <nl> - / / int coachIndex = GetCoachIndexPlayerIsOn ( ) ; <nl> - int coachIndex = GetCoachIndexPlayerIsOn2 ( ) ; <nl> - <nl> - if ( coachIndex = = - 1 & & m_coachIndex ! = - 1 ) <nl> - { / / before on the train but get off <nl> - / * if ( m_offConvoyStartTime = = 0 . f ) <nl> - m_offConvoyStartTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - else <nl> - if ( ( gEnv - > pTimer - > GetFrameStartTime ( ) - m_offConvoyStartTime ) . GetSeconds ( ) > OFF_TRAIN_TIME ) * / <nl> - { <nl> - m_coachIndex = - 1 ; <nl> - m_offConvoyStartTime = 0 . f ; <nl> - ActivateOutput ( pActInfo , OUT_COACHINDEX , m_coachIndex ) ; <nl> - SetPlayerMaxVelGround ( m_playerMaxVelGround ) ; <nl> - return ; <nl> - } <nl> - } <nl> - else if ( coachIndex ! = m_coachIndex ) <nl> - { / / changed coach or get on another <nl> - m_coachIndex = coachIndex ; <nl> - ActivateOutput ( pActInfo , OUT_COACHINDEX , m_coachIndex ) ; <nl> - SetPlayerMaxVelGround ( BIG_MAX_VEL_GROUND ) ; <nl> - } <nl> - else if ( m_offConvoyStartTime ! = 0 . f & & coachIndex > - 1 ) <nl> - m_offConvoyStartTime = 0 . f ; / / was off train but get on the same coach within time <nl> - <nl> - if ( m_splitCoachIndex > 0 & & m_splitSpeed > 0 ) <nl> - { / / slow down splitted coaches automatically <nl> - m_splitSpeed + = SPLIT_ACCEL * gEnv - > pTimer - > GetFrameTime ( ) ; <nl> - if ( m_splitSpeed < 0 ) <nl> - m_splitSpeed = 0 ; <nl> - } <nl> - <nl> - if ( m_speed | | m_splitSpeed ) <nl> - { <nl> - SetSoundParams ( ) ; <nl> - UpdateLineSounds ( ) ; <nl> - if ( m_startBreakSoundShifted ) <nl> - StartBreakSoundShifted ( ) ; <nl> - } <nl> - <nl> - / / Stop if first coach reaches path end <nl> - if ( ! m_coaches . empty ( ) & & m_coaches [ 0 ] . m_distanceOnPath > = m_path . GetTotalLength ( ) ) <nl> - { <nl> - / / Check for looping case <nl> - if ( + + m_loopCount < = m_loopTotal | | m_loopTotal < 0 ) <nl> - { <nl> - m_distanceOnPath = 0 . 0f ; <nl> - InitConvoyCoaches ( ) ; <nl> - } <nl> - else <nl> - { <nl> - m_speed = 0 . 0f ; <nl> - m_atEndOfPath = true ; <nl> - } <nl> - <nl> - ActivateOutput ( pActInfo , OUT_ONPATHEND , true ) ; <nl> - } <nl> - } <nl> - <nl> - float CFlowConvoyNode : : GetSpeedSoundParam ( int coachIndex ) <nl> - { <nl> - float speedParam ; <nl> - if ( m_splitCoachIndex > 0 & & coachIndex > = m_splitCoachIndex ) <nl> - speedParam = m_splitSpeed ; <nl> - else <nl> - speedParam = m_speed ; <nl> - <nl> - speedParam = speedParam / MAX_TRAIN_SPEED ; <nl> - return speedParam > 1 . f ? 1 . f : speedParam ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : SetSoundParams ( ) <nl> - { <nl> - / / for ( int i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_runSoundID ! = INVALID_SOUNDID & & m_coaches [ i ] . m_pEntitySoundsProxy ) <nl> - / / { <nl> - / / ISound * i_sound = m_coaches [ i ] . m_pEntitySoundsProxy - > GetSound ( m_coaches [ i ] . m_runSoundID ) ; <nl> - / / if ( i_sound ) <nl> - / / i_sound - > SetParam ( " speed " , GetSpeedSoundParam ( i ) , false ) ; <nl> - / / / / else <nl> - / / / / CryLogAlways ( " No ISound : % d " , i ) ; <nl> - / / } <nl> - / / } <nl> - } <nl> - <nl> - / / tSoundID CFlowConvoyNode : : PlayLineSound ( int coachIndex , const char * sGroupAndSoundName , const Vec3 & vStart , const Vec3 & vEnd ) <nl> - / / { <nl> - / / / / IEntityAudioProxy * pIEntityAudioProxy = m_coaches [ coachIndex ] . m_pEntitySoundsProxy ; <nl> - / / / / EntityId SkipEntIDs [ 1 ] ; <nl> - / / / / SkipEntIDs [ 0 ] = m_coaches [ coachIndex ] . m_pEntity - > GetId ( ) ; <nl> - / / <nl> - / / tSoundID ID = INVALID_SOUNDID ; <nl> - / / <nl> - / / / / if ( ! gEnv - > pSoundSystem ) <nl> - / / / / return ID ; <nl> - / / <nl> - / / / / ISound * pSound = gEnv - > pSoundSystem - > CreateLineSound ( sGroupAndSoundName , FLAG_SOUND_DEFAULT_3D , vStart , vEnd ) ; <nl> - / / <nl> - / / / / if ( pSound ) <nl> - / / / / { <nl> - / / / / pSound - > SetSemantic ( eSoundSemantic_Vehicle ) ; <nl> - / / / / pSound - > SetPhysicsToBeSkipObstruction ( SkipEntIDs , 1 ) ; <nl> - / / <nl> - / / / / if ( pIEntityAudioProxy - > PlaySound ( pSound , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_OneY ) ) <nl> - / / / / ID = pSound - > GetId ( ) ; <nl> - / / / / } <nl> - / / <nl> - / / return ID ; <nl> - / / } <nl> - <nl> - void CFlowConvoyNode : : UpdateLineSounds ( ) <nl> - { <nl> - / / for ( int i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_runSoundID ! = INVALID_SOUNDID & & m_coaches [ i ] . m_pEntitySoundsProxy ) <nl> - / / { <nl> - / / ISound * i_sound = m_coaches [ i ] . m_pEntitySoundsProxy - > GetSound ( m_coaches [ i ] . m_runSoundID ) ; <nl> - / / if ( i_sound ) <nl> - / / { <nl> - / / bool splitSound1 = m_splitCoachIndex & & ! ( m_splitCoachIndex & 1 ) & & ( m_splitCoachIndex = = i | | m_splitCoachIndex = = i + 1 ) ; <nl> - / / bool splitSound2 = ( splitSound1 & & i = = m_splitCoachIndex & & m_splitCoachIndex + 1 = = m_coaches . size ( ) - 1 ) ; <nl> - / / Vec3 lineStart , lineEnd ; <nl> - / / if ( ! i | | ( splitSound1 & & ! splitSound2 ) ) <nl> - / / { / / line sound for train engine or one split coach <nl> - / / Vec3 pos = m_coaches [ i ] . m_pEntity - > GetWorldPos ( ) ; <nl> - / / Vec3 forwardDir = m_coaches [ i ] . m_pEntity - > GetWorldTM ( ) . GetColumn1 ( ) ; <nl> - / / lineStart = pos - forwardDir * m_coaches [ i ] . m_coachOffset ; <nl> - / / lineEnd = pos + forwardDir * m_coaches [ i ] . m_coachOffset ; <nl> - / / } <nl> - / / else <nl> - / / { <nl> - / / Vec3 pos2 ; <nl> - / / float halfLineLength ; <nl> - / / Vec3 pos1 = m_coaches [ i ] . m_pEntity - > GetWorldPos ( ) ; <nl> - / / if ( i + 2 = = m_coaches . size ( ) - 1 ) <nl> - / / { / / line sound for two coaches and the last coach ( 3 together ) <nl> - / / pos2 = m_coaches [ i + 2 ] . m_pEntity - > GetWorldPos ( ) ; <nl> - / / halfLineLength = m_coaches [ i ] . m_coachOffset + m_coaches [ i + 1 ] . m_coachOffset + m_coaches [ i + 2 ] . m_coachOffset ; <nl> - / / } <nl> - / / else <nl> - / / { / / line sound for two coaches <nl> - / / pos2 = m_coaches [ i + 1 ] . m_pEntity - > GetWorldPos ( ) ; <nl> - / / halfLineLength = m_coaches [ i ] . m_coachOffset + m_coaches [ i + 1 ] . m_coachOffset ; <nl> - / / } <nl> - / / Vec3 forwardDir = ( pos1 - pos2 ) . GetNormalizedSafe ( ) ; <nl> - <nl> - / / lineStart = ( pos1 + pos2 ) * 0 . 5f + forwardDir * halfLineLength ; <nl> - / / lineEnd = ( pos1 + pos2 ) * 0 . 5f - forwardDir * halfLineLength ; <nl> - / / } <nl> - <nl> - / / i_sound - > SetLineSpec ( lineStart , lineEnd ) ; <nl> - / / / / gEnv - > pRenderer - > GetIRenderAuxGeom ( ) - > DrawLine ( lineStart + Vec3 ( 0 , 0 , 2 . f ) , ColorB ( 0 , 255 , 0 , 255 ) , lineEnd + Vec3 ( 0 , 0 , 2 . f ) , ColorB ( 0 , 255 , 0 , 255 ) , 2 . 0f ) ; <nl> - / / } <nl> - / / / / else <nl> - / / / / CryLogAlways ( " No ISound : % d " , i ) ; <nl> - / / } <nl> - / / } <nl> - } <nl> - <nl> - void CFlowConvoyNode : : StartSounds ( ) <nl> - { <nl> - <nl> - / / for ( int i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_pEntitySoundsProxy ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_runSoundID ! = INVALID_SOUNDID ) <nl> - / / m_coaches [ i ] . m_pEntitySoundsProxy - > StopAllSounds ( ) ; <nl> - / / <nl> - / / if ( ! i ) <nl> - / / { <nl> - / / m_engineStartSoundID = m_coaches [ 0 ] . m_pEntitySoundsProxy - > PlaySound ( " sounds / vehicles_exp1 : train : engine_start " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_OneY , FLAG_SOUND_DEFAULT_3D , eSoundSemantic_Vehicle ) ; <nl> - / / m_coaches [ 0 ] . m_runSoundID = m_engineStartSoundID = PlayLineSound ( 0 , " sounds / vehicles_exp1 : train : engine " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_Zero ) ; <nl> - / / } / / the LineSound line start and end parameter will be filled later in UpdateLineSound ( ) <nl> - / / else if ( i & 1 & & i ! = m_coaches . size ( ) - 1 ) / / set sound for every second coach to prevent too much sound <nl> - / / m_coaches [ i ] . m_runSoundID = m_engineStartSoundID = PlayLineSound ( i , " sounds / vehicles_exp1 : train : run " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_Zero ) ; <nl> - <nl> - / / if ( m_coaches [ i ] . m_runSoundID ! = INVALID_SOUNDID ) <nl> - / / { <nl> - / / ISound * i_sound = m_coaches [ i ] . m_pEntitySoundsProxy - > GetSound ( m_coaches [ i ] . m_runSoundID ) ; <nl> - / / if ( i_sound ) <nl> - / / i_sound - > SetParam ( " speed " , GetSpeedSoundParam ( i ) , false ) ; <nl> - / / } <nl> - / / } <nl> - / / } <nl> - <nl> - } <nl> - <nl> - void CFlowConvoyNode : : SplitLineSound ( ) <nl> - { <nl> - / / if ( m_coaches [ m_splitCoachIndex ] . m_pEntitySoundsProxy & & m_coaches [ m_splitCoachIndex ] . m_runSoundID = = INVALID_SOUNDID ) <nl> - / / { <nl> - / / m_coaches [ m_splitCoachIndex ] . m_runSoundID = m_engineStartSoundID = PlayLineSound ( m_splitCoachIndex , " sounds / vehicles_exp1 : train : run " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_Zero ) ; <nl> - / / } <nl> - } <nl> - <nl> - void CFlowConvoyNode : : ConvoyStopSounds ( ) <nl> - { <nl> - / / for ( int i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_pEntitySoundsProxy & & m_coaches [ i ] . m_runSoundID ! = INVALID_SOUNDID ) <nl> - / / m_coaches [ i ] . m_pEntitySoundsProxy - > StopSound ( m_coaches [ i ] . m_runSoundID , ESoundStopMode_AtOnce ) ; <nl> - / / if ( m_coaches [ i ] . m_pEntitySoundsProxy & & m_coaches [ i ] . m_breakSoundID ! = INVALID_SOUNDID ) <nl> - / / m_coaches [ i ] . m_pEntitySoundsProxy - > StopSound ( m_coaches [ i ] . m_breakSoundID , ESoundStopMode_AtOnce ) ; <nl> - / / m_coaches [ i ] . m_runSoundID = INVALID_SOUNDID ; <nl> - / / m_coaches [ i ] . m_breakSoundID = INVALID_SOUNDID ; <nl> - / / } <nl> - / / <nl> - / / / / train engine stop sound <nl> - / / m_coaches [ 0 ] . m_pEntitySoundsProxy - > PlaySound ( " sounds / vehicles_exp1 : train : engine_stop " , Vec3Constants < float > : : fVec3_Zero , Vec3Constants < float > : : fVec3_OneY , FLAG_SOUND_DEFAULT_3D , eSoundSemantic_Vehicle ) ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : StopAllSounds ( ) <nl> - { <nl> - / / for ( int i = 0 ; i < m_coaches . size ( ) ; + + i ) <nl> - / / { <nl> - / / if ( m_coaches [ i ] . m_pEntitySoundsProxy ) <nl> - / / m_coaches [ i ] . m_pEntitySoundsProxy - > StopAllSounds ( ) ; <nl> - / / m_coaches [ i ] . m_runSoundID = INVALID_SOUNDID ; <nl> - / / m_coaches [ i ] . m_breakSoundID = INVALID_SOUNDID ; <nl> - / / } <nl> - / / m_hornSoundID = INVALID_SOUNDID ; <nl> - / / m_engineStartSoundID = INVALID_SOUNDID ; <nl> - } <nl> - <nl> - void CFlowConvoyNode : : GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - std : : vector < CFlowConvoyNode * > CFlowConvoyNode : : gFlowConvoyNodes ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Crysis2 : Convoy " , CFlowConvoyNode ) ; <nl> deleted file mode 100644 <nl> index 8badafe218 . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowConvoyNode . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - $ Id $ <nl> - $ DateTime $ <nl> - Description : Inplements a convoy in a FlowNode <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - # ifndef __FLOWCONVOYNODE_H__ <nl> - # define __FLOWCONVOYNODE_H__ <nl> - <nl> - # include < CryFlowGraph / IFlowSystem . h > <nl> - # include " Nodes / G2FlowBaseNode . h " <nl> - <nl> - class CConvoyPathIterator <nl> - { <nl> - friend class CConvoyPath ; <nl> - public : <nl> - CConvoyPathIterator ( ) ; <nl> - void Invalidate ( ) ; <nl> - <nl> - private : <nl> - int Segment ; <nl> - float LastDistance ; <nl> - } ; <nl> - <nl> - class CConvoyPath <nl> - { <nl> - public : <nl> - CConvoyPath ( ) ; <nl> - void SetPath ( const std : : vector < Vec3 > & path ) ; <nl> - Vec3 GetPointAlongPath ( float dist , CConvoyPathIterator & iterator ) ; <nl> - float GetTotalLength ( ) const { return m_totalLength ; } <nl> - <nl> - private : <nl> - struct SConvoyPathNode <nl> - { <nl> - Vec3 Position ; <nl> - float Length , TotalLength ; <nl> - } ; <nl> - <nl> - std : : vector < SConvoyPathNode > m_path ; <nl> - float m_totalLength ; <nl> - } ; <nl> - <nl> - class CFlowConvoyNode : public CFlowBaseNode < eNCT_Instanced > <nl> - { <nl> - public : <nl> - static std : : vector < CFlowConvoyNode * > gFlowConvoyNodes ; <nl> - static int OnPhysicsPostStep_static ( const EventPhys * pEvent ) ; <nl> - CFlowConvoyNode ( SActivationInfo * pActInfo ) ; <nl> - ~ CFlowConvoyNode ( ) ; <nl> - virtual IFlowNodePtr Clone ( SActivationInfo * pActInfo ) ; <nl> - virtual void Serialize ( SActivationInfo * , TSerialize ser ) ; <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) ; <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) ; <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const ; <nl> - int OnPhysicsPostStep ( const EventPhys * pEvent ) ; <nl> - static bool PlayerIsOnaConvoy ( ) ; <nl> - private : <nl> - void DiscoverConvoyCoaches ( IEntity * pEntity ) ; <nl> - void InitConvoyCoaches ( ) ; <nl> - void AwakeCoaches ( ) ; <nl> - int GetCoachIndexPlayerIsOn ( ) ; <nl> - int GetCoachIndexPlayerIsOn2 ( ) ; <nl> - float GetPlayerMaxVelGround ( ) ; <nl> - void SetPlayerMaxVelGround ( float vel ) ; <nl> - <nl> - void Update ( SActivationInfo * pActInfo ) ; <nl> - <nl> - / / tSoundID PlayLineSound ( int coachIndex , const char * sGroupAndSoundName , const Vec3 & vStart , const Vec3 & vEnd ) ; <nl> - void UpdateLineSounds ( ) ; <nl> - void StartSounds ( ) ; <nl> - void SplitLineSound ( ) ; <nl> - void ConvoyStopSounds ( ) ; <nl> - void StopAllSounds ( ) ; <nl> - float GetSpeedSoundParam ( int coachIndex ) ; <nl> - void SetSoundParams ( ) ; <nl> - void StartBreakSoundShifted ( ) ; <nl> - <nl> - enum EInputs <nl> - { <nl> - IN_PATH , <nl> - IN_LOOPCOUNT , <nl> - IN_SPEED , <nl> - IN_DESIREDSPEED , <nl> - IN_SHIFT , <nl> - IN_SHIFTTIME , <nl> - IN_START_DISTANCE , <nl> - IN_SPLIT_COACH , <nl> - IN_XAXIS_FWD , <nl> - IN_HORN_SOUND , <nl> - IN_BREAK_SOUND , <nl> - IN_START , <nl> - IN_STOP , <nl> - } ; <nl> - enum EOutputs <nl> - { <nl> - OUT_ONPATHEND , <nl> - OUT_COACHINDEX , <nl> - } ; <nl> - <nl> - CConvoyPath m_path ; <nl> - float m_speed ; <nl> - float m_desiredSpeed ; <nl> - float m_ShiftTime ; <nl> - float m_MaxShiftTime ; <nl> - float m_distanceOnPath ; / / train last coach end distance on path <nl> - int m_splitCoachIndex ; / / coach index where to split train ( 0 is the train engine ) <nl> - int m_loopCount ; <nl> - int m_loopTotal ; <nl> - <nl> - bool m_bFirstUpdate ; <nl> - bool m_bXAxisFwd ; <nl> - CTimeValue m_offConvoyStartTime ; <nl> - int m_coachIndex ; <nl> - <nl> - float m_splitDistanceOnPath ; / / the splitted coaches end coach distance on path <nl> - float m_splitSpeed ; / / splitted coaches speed <nl> - bool m_processNode ; <nl> - bool m_atEndOfPath ; <nl> - <nl> - struct SConvoyCoach <nl> - { <nl> - SConvoyCoach ( ) ; <nl> - IEntity * m_pEntity ; <nl> - int m_frontWheelBase , m_backWheelBase ; <nl> - float m_wheelDistance ; / / wheel half distance from center <nl> - float m_coachOffset ; / / coach half length <nl> - float m_distanceOnPath ; / / coach center distance on path <nl> - IEntityAudioProxy * m_pEntitySoundsProxy ; <nl> - / / tSoundID m_runSoundID ; <nl> - / / tSoundID m_breakSoundID ; <nl> - CConvoyPathIterator m_frontWheelIterator [ 2 ] , m_backWheelIterator [ 2 ] ; <nl> - } ; <nl> - <nl> - / / tSoundID m_hornSoundID ; <nl> - / / tSoundID m_engineStartSoundID ; <nl> - <nl> - std : : vector < SConvoyCoach > m_coaches ; <nl> - static float m_playerMaxVelGround ; <nl> - int m_startBreakSoundShifted ; <nl> - } ; <nl> - <nl> - # endif <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowHitInfoNode . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowHitInfoNode . cpp <nl> class CFlowExplosionInfoNode : public CFlowBaseNode < eNCT_Instanced > , public IHit <nl> SActivationInfo m_actInfo ; <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Crysis : HitInfo " , CFlowHitInfoNode ) ; <nl> - REGISTER_FLOW_NODE ( " Crysis : ExplosionInfo " , CFlowExplosionInfoNode ) ; <nl> + REGISTER_FLOW_NODE ( " Weapon : HitInfo " , CFlowHitInfoNode ) ; <nl> + REGISTER_FLOW_NODE ( " Weapon : ExplosionInfo " , CFlowExplosionInfoNode ) ; <nl> deleted file mode 100644 <nl> index 3b966d79d0 . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowLockPlayerRotationNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # include " StdAfx . h " <nl> - # include " Actor . h " <nl> - # include " Nodes / G2FlowBaseNode . h " <nl> - <nl> - class CFlowLockPlayerRotationNode : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowLockPlayerRotationNode ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowLockPlayerRotationNode ( ) <nl> - { <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Enable = 0 , <nl> - EIP_Disable , <nl> - EIP_LimitDir , <nl> - EIP_LimitYaw , <nl> - EIP_LimitPitch , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Done = 0 , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Enable " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Disable " ) ) , <nl> - InputPortConfig < Vec3 > ( " ViewLimitDir " , _HELP ( " Center direction from where the player is limited by yaw / pitch . If ( 0 , 0 , 0 ) there will be no yaw / pitch limit . " ) ) , <nl> - InputPortConfig < float > ( " ViewLimitYaw " , _HELP ( " ViewLimitYaw , in degrees . 0 = no limit , - 1 = total lock " ) ) , <nl> - InputPortConfig < float > ( " ViewLimitPitch " , _HELP ( " ViewLimitPitch , in degrees . 0 = no limit , - 1 = total lock " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig < bool > ( " Done " , _HELP ( " Trigger for Chaining " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Lock the player ' s view direction " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , EIP_Enable ) ) <nl> - { <nl> - const Vec3 & dir = GetPortVec3 ( pActInfo , EIP_LimitDir ) ; <nl> - const float rangeH = max ( GetPortFloat ( pActInfo , EIP_LimitYaw ) , 0 . 001f ) ; <nl> - const float rangeV = max ( GetPortFloat ( pActInfo , EIP_LimitPitch ) , 0 . 001f ) ; <nl> - CActor * pPlayerActor = static_cast < CActor * > ( gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ) ; <nl> - if ( pPlayerActor ) <nl> - { <nl> - pPlayerActor - > SetViewLimits ( dir , DEG2RAD ( rangeH ) , DEG2RAD ( rangeV ) ) ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Done , true ) ; <nl> - } <nl> - if ( IsPortActive ( pActInfo , EIP_Disable ) ) <nl> - { <nl> - CActor * pPlayerActor = static_cast < CActor * > ( gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ) ; <nl> - if ( pPlayerActor ) <nl> - { <nl> - pPlayerActor - > SetViewLimits ( Vec3 ( ZERO ) , 0 . 0f , 0 . 0f ) ; <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Done , false ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Game : LockPlayerRotation " , CFlowLockPlayerRotationNode ) ; <nl> - <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowNodesInput . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowNodesInput . cpp <nl> class CFlowNode_MoveOverlay : public CFlowBaseNode < eNCT_Singleton > <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Register nodes <nl> <nl> - REGISTER_FLOW_NODE ( " Input : XBoxKey " , CG4FlowNode_XBoxKey ) ; <nl> - REGISTER_FLOW_NODE ( " Input : XBoxAnalog " , CG4FlowNode_XBoxAnalog ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : InputXboxKey " , CG4FlowNode_XBoxKey ) ; <nl> + REGISTER_FLOW_NODE ( " Debug : InputXboxAnalog " , CG4FlowNode_XBoxAnalog ) ; <nl> REGISTER_FLOW_NODE ( " Input : MoveOverlay " , CFlowNode_MoveOverlay ) ; <nl> REGISTER_FLOW_NODE ( " Input : ControlScheme " , CG4FlowNode_InputControlScheme ) ; <nl> REGISTER_FLOW_NODE ( " Input : ControlSchemeListener " , CG4FlowNode_InputControlSchemeListener ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowPlayerStagingNode . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowPlayerStagingNode . cpp <nl> <nl> # include " PlayerMovementController . h " <nl> # include " Nodes / G2FlowBaseNode . h " <nl> <nl> - class CFlowPlayerStagingNode : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowPlayerStagingNode ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowPlayerStagingNode ( ) <nl> - { <nl> - } <nl> - <nl> - / * <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowPlayerStagingNode ( pActInfo ) ; <nl> - } <nl> - * / <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Trigger = 0 , <nl> - EIP_LimitDir , <nl> - EIP_LocalSpace , <nl> - EIP_LimitYaw , <nl> - EIP_LimitPitch , <nl> - EIP_Lock , <nl> - EIP_Stance , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Done = 0 , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " Trigger " , _HELP ( " Trigger " ) ) , <nl> - InputPortConfig < Vec3 > ( " ViewLimitDir " , _HELP ( " Center direction from where the player is limited by yaw / pitch . If ( 0 , 0 , 0 ) there will be no yaw / pitch limit . " ) ) , <nl> - InputPortConfig < bool > ( " InLocalSpace " , true , _HELP ( " ViewLimitDir Vector is in Local Space or World Space . \ nFor example , in Local Space the value ( 0 , 1 , 0 ) would be same direction than current player direction , while in World Space the value ( 0 , 1 , 0 ) would be along world Y axis . " ) ) , <nl> - InputPortConfig < float > ( " ViewLimitYaw " , _HELP ( " ViewLimitYaw , in degrees . 0 = no limit , - 1 = total lock " ) ) , <nl> - InputPortConfig < float > ( " ViewLimitPitch " , _HELP ( " ViewLimitPitch , in degrees . 0 = no limit , - 1 = total lock " ) ) , <nl> - InputPortConfig < bool > ( " LockPlayer " , false , _HELP ( " Lock the player ' s position " ) ) , <nl> - InputPortConfig < int > ( " TryStance " , - 1 , _HELP ( " Try to set Stance on Locking [ works only if Player was linked beforehand ] " ) , 0 , _UICONFIG ( " enum_int : < ignore > = - 1 , Stand = 0 , Crouch = 1 , Prone = 2 , Relaxed = 3 , Stealth = 4 , Swim = 5 , ZeroG = 6 " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig_Void ( " Done " , _HELP ( " Trigger for Chaining " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Staging of the Player - ViewLimits and Position Lock " ) ; <nl> - config . SetCategory ( EFLN_OBSOLETE ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - break ; <nl> - case eFE_Activate : <nl> - if ( IsPortActive ( pActInfo , EIP_Trigger ) ) <nl> - { <nl> - const Vec3 & dir = GetPortVec3 ( pActInfo , EIP_LimitDir ) ; <nl> - const bool localSpace = GetPortBool ( pActInfo , EIP_LocalSpace ) ; <nl> - float rangeH = GetPortFloat ( pActInfo , EIP_LimitYaw ) ; <nl> - float rangeV = GetPortFloat ( pActInfo , EIP_LimitPitch ) ; <nl> - if ( rangeH < 0 ) <nl> - rangeH = 0 . 001f ; <nl> - if ( rangeV < 0 ) <nl> - rangeV = 0 . 001f ; <nl> - CActor * pPlayerActor = static_cast < CActor * > ( gEnv - > pGame - > GetIGameFramework ( ) - > GetClientActor ( ) ) ; <nl> - if ( pPlayerActor ) <nl> - { <nl> - CPlayer : : SStagingParams stagingParams ; <nl> - CPlayer * pPlayer = static_cast < CPlayer * > ( pPlayerActor ) ; <nl> - if ( dir . len2 ( ) > 0 . 01f ) <nl> - { <nl> - if ( localSpace ) <nl> - { <nl> - const Quat & viewQuat = pPlayer - > GetViewQuatFinal ( ) ; / / WC <nl> - Vec3 dirWC = viewQuat * dir ; <nl> - stagingParams . vLimitDir = dirWC . GetNormalizedSafe ( ZERO ) ; <nl> - } <nl> - else <nl> - stagingParams . vLimitDir = dir . GetNormalizedSafe ( ZERO ) ; <nl> - } <nl> - <nl> - stagingParams . vLimitRangeH = DEG2RAD ( rangeH ) ; <nl> - stagingParams . vLimitRangeV = DEG2RAD ( rangeV ) ; <nl> - stagingParams . bLocked = GetPortBool ( pActInfo , EIP_Lock ) ; <nl> - int stance = GetPortInt ( pActInfo , EIP_Stance ) ; <nl> - if ( stance < STANCE_NULL | | stance > = STANCE_LAST ) <nl> - { <nl> - stance = STANCE_NULL ; <nl> - GameWarning ( " [ flow ] PlayerStaging : stance = % d invalid " , stance ) ; <nl> - } <nl> - stagingParams . stance = ( EStance ) stance ; <nl> - <nl> - bool bActive = ( stagingParams . bLocked | | <nl> - ( ! stagingParams . vLimitDir . IsZero ( ) & & ( ! iszero ( stagingParams . vLimitRangeH ) | | ! iszero ( stagingParams . vLimitRangeV ) ) ) ) ; <nl> - pPlayer - > StagePlayer ( bActive , & stagingParams ) ; <nl> - <nl> - / * <nl> - SActorParams * pActorParams = pPlayerActor - > GetActorParams ( ) ; <nl> - if ( pActorParams ) <nl> - { <nl> - CPlayer * pPlayer = static_cast < CPlayer * > ( pPlayerActor ) ; <nl> - if ( dir . len2 ( ) > 0 . 01f ) <nl> - { <nl> - if ( localSpace ) <nl> - { <nl> - const Quat & viewQuat = pPlayer - > GetViewQuatFinal ( ) ; / / WC <nl> - Vec3 dirWC = viewQuat * dir ; <nl> - pActorParams - > vLimitDir = dirWC . GetNormalizedSafe ( ZERO ) ; <nl> - } <nl> - else <nl> - pActorParams - > vLimitDir = dir . GetNormalizedSafe ( ZERO ) ; <nl> - } <nl> - else <nl> - pActorParams - > vLimitDir . zero ( ) ; <nl> - <nl> - pActorParams - > vLimitRangeH = DEG2RAD ( rangeH ) ; <nl> - pActorParams - > vLimitRangeV = DEG2RAD ( rangeV ) ; <nl> - const bool bLock = GetPortBool ( pActInfo , EIP_Lock ) ; <nl> - <nl> - / / AlexL 23 / 01 / 2007 : disable this until we have a working solution to lock player movement ( action filter ) <nl> - / / SPlayerStats * pActorStats = static_cast < SPlayerStats * > ( pPlayer - > GetActorStats ( ) ) ; <nl> - / / if ( pActorStats ) <nl> - / / pActorStats - > spectatorMode = bLock ? CActor : : eASM_Cutscene : 0 ; <nl> - IActionMapManager * pAmMgr = g_pGame - > GetIGameFramework ( ) - > GetIActionMapManager ( ) ; <nl> - if ( pAmMgr ) <nl> - pAmMgr - > EnableFilter ( " no_move " , bLock ) ; <nl> - <nl> - if ( bLock ) <nl> - { <nl> - / / CPlayerMovementController * pMC = static_cast < CPlayerMovementController * > ( pPlayer - > GetMovementController ( ) ) ; <nl> - / / pMC - > Reset ( ) ; <nl> - if ( pPlayer - > GetPlayerInput ( ) ) <nl> - pPlayer - > GetPlayerInput ( ) - > Reset ( ) ; <nl> - } <nl> - } <nl> - * / <nl> - } <nl> - ActivateOutput ( pActInfo , EOP_Done , false ) ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> class CFlowPlayerLinkNode : public CFlowBaseNode < eNCT_Singleton > <nl> { <nl> public : <nl> class CFlowPlayerLinkNode : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - REGISTER_FLOW_NODE ( " Game : PlayerStaging " , CFlowPlayerStagingNode ) ; <nl> - REGISTER_FLOW_NODE ( " Game : PlayerLink " , CFlowPlayerLinkNode ) ; <nl> + REGISTER_FLOW_NODE ( " Actor : PlayerLink " , CFlowPlayerLinkNode ) ; <nl> <nl> mmm a / Code / GameSDK / GameDll / Nodes / FlowPostFXNodes . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / FlowPostFXNodes . cpp <nl> <nl> / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " StdAfx . h " <nl> - # include " Game . h " <nl> # include " Nodes / G2FlowBaseNode . h " <nl> # include " Player . h " <nl> <nl> - struct FXParamsGlobal <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < float > ( " Global_Brightness " , 1 . 0f ) , <nl> - InputPortConfig < float > ( " Global_Contrast " , 1 . 0f ) , <nl> - InputPortConfig < float > ( " Global_Saturation " , 1 . 0f ) , <nl> - InputPortConfig < float > ( " Global_Sharpening " , 1 . 0f ) , <nl> - InputPortConfig < float > ( " Global_ColorC " , 0 . 0f ) , <nl> - InputPortConfig < float > ( " Global_ColorM " , 0 . 0f ) , <nl> - InputPortConfig < float > ( " Global_ColorY " , 0 . 0f ) , <nl> - InputPortConfig < float > ( " Global_ColorK " , 0 . 0f ) , <nl> - InputPortConfig < float > ( " Global_ColorHue " , 0 . 0f ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Sets the global PostFX params " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsScreenFrost <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " ScreenFrost_Active " , false ) , <nl> - InputPortConfig < float > ( " ScreenFrost_Amount " , 0 . 0f ) , <nl> - InputPortConfig < float > ( " ScreenFrost_CenterAmount " , 1 . 0f ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " ScreenFrost " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsWaterDroplets <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " WaterDroplets_Active " , false ) , <nl> - InputPortConfig < float > ( " WaterDroplets_Amount " , 0 . 0f ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " WaterDroplets " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsGlow <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " Glow_Active " , false ) , <nl> - InputPortConfig < float > ( " Glow_Scale " , 0 . 5f ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Glow " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsBloodSplats <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " BloodSplats_Active " , false ) , <nl> - InputPortConfig < int > ( " BloodSplats_Type " , false ) , <nl> - InputPortConfig < float > ( " BloodSplats_Amount " , 1 . 0f ) , <nl> - InputPortConfig < bool > ( " BloodSplats_Spawn " , false ) , <nl> - InputPortConfig < float > ( " BloodSplats_Scale " , 1 . 0f ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Bloodsplats " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsGlittering <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " Glittering_Active " , false ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Glittering " ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct FXParamsSunShafts <nl> - { <nl> - static void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig < bool > ( " SunShafts_Active " , false ) , <nl> - InputPortConfig < int > ( " SunShafts_Type " , 0 ) , <nl> - InputPortConfig < float > ( " SunShafts_Amount " , 0 . 25 ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - { 0 } <nl> - } ; <nl> - config . nFlags | = EFLN_TARGET_ENTITY ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " SunShafts " ) ; <nl> - } <nl> - } ; <nl> - <nl> - template < class T > <nl> - class CFlowFXNode : public CFlowBaseNode < eNCT_Singleton > <nl> - { <nl> - public : <nl> - CFlowFXNode ( SActivationInfo * pActInfo ) <nl> - { <nl> - } <nl> - <nl> - ~ CFlowFXNode ( ) <nl> - { <nl> - } <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - T : : GetConfiguration ( config ) ; <nl> - config . SetCategory ( EFLN_ADVANCED ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - if ( event ! = eFE_Activate ) <nl> - return ; <nl> - <nl> - if ( InputEntityIsLocalPlayer ( pActInfo ) ) <nl> - { <nl> - SFlowNodeConfig config ; <nl> - T : : GetConfiguration ( config ) ; <nl> - I3DEngine * pEngine = gEnv - > p3DEngine ; <nl> - for ( int i = 0 ; config . pInputPorts [ i ] . name ; + + i ) <nl> - { <nl> - if ( IsPortActive ( pActInfo , i ) ) <nl> - { <nl> - const TFlowInputData & anyVal = GetPortAny ( pActInfo , i ) ; <nl> - float fVal ; <nl> - bool ok = anyVal . GetValueWithConversion ( fVal ) ; <nl> - if ( ok ) <nl> - { <nl> - / / set postfx param <nl> - pEngine - > SetPostEffectParam ( config . pInputPorts [ i ] . name , fVal ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> class CFlowControlPlayerHealthEffect : public CFlowBaseNode < eNCT_Singleton > <nl> class CFlowControlPlayerHealthEffect : public CFlowBaseNode < eNCT_Singleton > <nl> INP_INTENSITY <nl> } ; <nl> <nl> - <nl> public : <nl> CFlowControlPlayerHealthEffect ( SActivationInfo * pActInfo ) <nl> { <nl> class CFlowControlPlayerHealthEffect : public CFlowBaseNode < eNCT_Singleton > <nl> } <nl> } ; <nl> <nl> - <nl> - <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXGlobal " , CFlowFXNode < FXParamsGlobal > , FXParamsGlobal ) ; <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXScreenFrost " , CFlowFXNode < FXParamsScreenFrost > , FXParamsScreenFrost ) ; <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXWaterDroplets " , CFlowFXNode < FXParamsWaterDroplets > , FXParamsWaterDroplets ) ; <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXBloodSplats " , CFlowFXNode < FXParamsBloodSplats > , FXParamsBloodSplats ) ; <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXGlow " , CFlowFXNode < FXParamsGlow > , FXParamsGlow ) ; <nl> - REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXGlittering " , CFlowFXNode < FXParamsGlittering > , FXParamsGlittering ) ; <nl> - / / REGISTER_FLOW_NODE_EX ( " CrysisFX : PostFXSunShafts " , CFlowFXNode < FXParamsSunShafts > , FXParamsSunShafts ) ; <nl> REGISTER_FLOW_NODE ( " Image : ControlPlayerHealthEffect " , CFlowControlPlayerHealthEffect ) ; <nl> deleted file mode 100644 <nl> index d2cd84b309 . . 0000000000 <nl> mmm a / Code / GameSDK / GameDll / Nodes / G2FlowYesNoGestureNode . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2016 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - $ Id $ <nl> - $ DateTime $ <nl> - Description : Flow nodes for working with XBox 360 controller <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - History : <nl> - - 31 : 3 : 2008 : Created by Kevin <nl> - <nl> - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - # include " StdAfx . h " <nl> - # include " Nodes / G2FlowBaseNode . h " <nl> - <nl> - class CFlowYesNoGesture : public CFlowBaseNode < eNCT_Instanced > , public IInputEventListener <nl> - { <nl> - public : <nl> - CFlowYesNoGesture ( SActivationInfo * pActInfo ) <nl> - { <nl> - m_bActive = false ; <nl> - m_bFinished = false ; <nl> - m_activationTime . SetValue ( 0 ) ; <nl> - Reset ( ) ; <nl> - } <nl> - <nl> - ~ CFlowYesNoGesture ( ) <nl> - { <nl> - Register ( false ) ; <nl> - } <nl> - <nl> - IFlowNodePtr Clone ( SActivationInfo * pActInfo ) <nl> - { <nl> - return new CFlowYesNoGesture ( pActInfo ) ; <nl> - } <nl> - <nl> - virtual void GetMemoryUsage ( ICrySizer * s ) const <nl> - { <nl> - s - > Add ( * this ) ; <nl> - } <nl> - <nl> - virtual void Serialize ( SActivationInfo * pActInfo , TSerialize ser ) <nl> - { <nl> - ser . Value ( " m_bActive " , m_bActive ) ; <nl> - if ( ser . IsReading ( ) ) <nl> - { <nl> - m_actInfo = * pActInfo ; <nl> - Register ( m_bActive ) ; <nl> - } <nl> - } <nl> - <nl> - enum EInputPorts <nl> - { <nl> - EIP_Enable = 0 , <nl> - EIP_Disable , <nl> - EIP_Timeout , <nl> - EIP_StickDeadThreshold , <nl> - EIP_StickExtremeThreshold , <nl> - EIP_MinExtremeDuration , <nl> - EIP_MaxExtremeDuration , <nl> - EIP_MinTotalDuration , <nl> - EIP_MaxTotalDuration , <nl> - } ; <nl> - <nl> - enum EOutputPorts <nl> - { <nl> - EOP_Yes = 0 , <nl> - EOP_No , <nl> - EOP_TimedOut , <nl> - } ; <nl> - <nl> - virtual void GetConfiguration ( SFlowNodeConfig & config ) <nl> - { <nl> - static const SInputPortConfig inputs [ ] = { <nl> - InputPortConfig_Void ( " Enable " , _HELP ( " Enable reporting " ) ) , <nl> - InputPortConfig_Void ( " Disable " , _HELP ( " Disable reporting " ) ) , <nl> - InputPortConfig < float > ( " Timeout " , 5 . 0f , _HELP ( " Maximum time gesture is waited for after node is activated . " ) ) , <nl> - InputPortConfig < float > ( " StickDeadThreshold " , 0 . 2f , _HELP ( " Stick deadzone tilt threshold . " ) ) , <nl> - InputPortConfig < float > ( " StickExtremeThreshold " , 0 . 7f , _HELP ( " Stick extreme tilt threshold . " ) ) , <nl> - InputPortConfig < float > ( " MinExtremeDuration " , 0 . 2f , _HELP ( " Minimum duration of stick being at extreme tilt " ) ) , <nl> - InputPortConfig < float > ( " MaxExtremeDuration " , 1 . 0f , _HELP ( " Maximum duration of stick being at extreme tilt " ) ) , <nl> - InputPortConfig < float > ( " MinTotalDuration " , 0 . 5f , _HELP ( " Minimum duration of whole gesture sequence . " ) ) , <nl> - InputPortConfig < float > ( " MaxTotalDuration " , 2 . 0f , _HELP ( " Maximum duration of whole gesture sequence . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - static const SOutputPortConfig outputs [ ] = { <nl> - OutputPortConfig < bool > ( " Yes " , _HELP ( " A yes gesture was identified . " ) ) , <nl> - OutputPortConfig < bool > ( " No " , _HELP ( " A no gesture was identified . " ) ) , <nl> - OutputPortConfig < bool > ( " TimedOut " , _HELP ( " No gesture was identified between activation and timeout . " ) ) , <nl> - { 0 } <nl> - } ; <nl> - config . pInputPorts = inputs ; <nl> - config . pOutputPorts = outputs ; <nl> - config . sDescription = _HELP ( " Identifies Yes / No gestures from right analogue stick ( nod / shake ) . " ) ; <nl> - config . SetCategory ( EFLN_DEBUG ) ; <nl> - } <nl> - <nl> - virtual void ProcessEvent ( EFlowEvent event , SActivationInfo * pActInfo ) <nl> - { <nl> - switch ( event ) <nl> - { <nl> - case eFE_Initialize : <nl> - { <nl> - m_bActive = false ; <nl> - m_actInfo = * pActInfo ; <nl> - Register ( true ) ; <nl> - } <nl> - break ; <nl> - <nl> - case eFE_Activate : <nl> - { <nl> - if ( IsPortActive ( pActInfo , EIP_Enable ) ) <nl> - Register ( true ) ; <nl> - if ( IsPortActive ( pActInfo , EIP_Disable ) ) <nl> - Register ( false ) ; <nl> - } <nl> - break ; <nl> - <nl> - case eFE_Update : <nl> - { <nl> - if ( ! m_bFinished ) <nl> - { <nl> - float fTimeout = GetPortFloat ( & m_actInfo , EIP_Timeout ) ; <nl> - CTimeValue curTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - float elapsedTime = ( curTime - m_activationTime ) . GetSeconds ( ) ; <nl> - if ( elapsedTime > fTimeout ) <nl> - { <nl> - Finish ( ) ; <nl> - ActivateOutput ( & m_actInfo , EOP_TimedOut , true ) ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - } <nl> - <nl> - void Finish ( ) <nl> - { <nl> - m_bFinished = true ; <nl> - NeedUpdate ( false ) ; <nl> - } <nl> - <nl> - void NeedUpdate ( bool update ) <nl> - { <nl> - if ( m_actInfo . pGraph ! = NULL ) <nl> - m_actInfo . pGraph - > SetRegularlyUpdated ( m_actInfo . myID , update ) ; <nl> - } <nl> - <nl> - void Register ( bool bRegister ) <nl> - { <nl> - m_activationTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - m_bFinished = false ; <nl> - <nl> - if ( IInput * pInput = gEnv - > pSystem - > GetIInput ( ) ) <nl> - { <nl> - Reset ( ) ; <nl> - if ( bRegister ) <nl> - { <nl> - if ( ! m_bActive ) <nl> - { <nl> - pInput - > AddEventListener ( this ) ; <nl> - NeedUpdate ( true ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - pInput - > RemoveEventListener ( this ) ; <nl> - NeedUpdate ( false ) ; <nl> - } <nl> - m_bActive = bRegister ; <nl> - } <nl> - else <nl> - m_bActive = false ; <nl> - } <nl> - <nl> - / / ~ IInputEventListener <nl> - virtual bool OnInputEvent ( const SInputEvent & event ) <nl> - { <nl> - if ( ! m_bActive ) <nl> - return false ; <nl> - <nl> - if ( m_bFinished ) <nl> - return false ; <nl> - <nl> - if ( event . state ! = eIS_Changed ) <nl> - return false ; <nl> - <nl> - if ( event . keyId = = eKI_XI_ThumbRX ) <nl> - { <nl> - m_stick . x = event . value ; <nl> - Update ( ) ; <nl> - return true ; <nl> - } <nl> - else if ( event . keyId = = eKI_XI_ThumbRY ) <nl> - { <nl> - m_stick . y = event . value ; <nl> - Update ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - / / Let other listeners handle it <nl> - return false ; <nl> - } <nl> - <nl> - void ResetX ( ) <nl> - { <nl> - m_iLastStartDeadX = - 1 ; <nl> - m_iFirstEndDeadX = - 1 ; <nl> - m_iMinStartX = - 1 ; <nl> - m_iMinEndX = - 1 ; <nl> - m_iMaxStartX = - 1 ; <nl> - m_iMaxEndX = - 1 ; <nl> - } <nl> - <nl> - void ResetY ( ) <nl> - { <nl> - m_iLastStartDeadY = - 1 ; <nl> - m_iFirstEndDeadY = - 1 ; <nl> - m_iMinStartY = - 1 ; <nl> - m_iMinEndY = - 1 ; <nl> - m_iMaxStartY = - 1 ; <nl> - m_iMaxEndY = - 1 ; <nl> - } <nl> - <nl> - void Reset ( ) <nl> - { <nl> - m_stick . zero ( ) ; <nl> - m_stickHistory . clear ( ) ; <nl> - m_stickHistoryTime . clear ( ) ; <nl> - ResetX ( ) ; <nl> - ResetY ( ) ; <nl> - } <nl> - <nl> - float GetDuration ( int iA , int iB ) <nl> - { <nl> - CTimeValue dt = m_stickHistoryTime [ iB ] - m_stickHistoryTime [ iA ] ; <nl> - return fabs_tpl ( dt . GetSeconds ( ) ) ; <nl> - } <nl> - <nl> - void Update ( ) <nl> - { <nl> - if ( m_bFinished ) <nl> - return ; <nl> - <nl> - CTimeValue curTime = gEnv - > pTimer - > GetFrameStartTime ( ) ; <nl> - m_stickHistory . push_back ( m_stick ) ; <nl> - m_stickHistoryTime . push_back ( curTime ) ; <nl> - <nl> - float fStickDeadThreshold = GetPortFloat ( & m_actInfo , EIP_StickDeadThreshold ) ; <nl> - float fStickExtremeThreshold = GetPortFloat ( & m_actInfo , EIP_StickExtremeThreshold ) ; <nl> - float fMinExtremeDuration = GetPortFloat ( & m_actInfo , EIP_MinExtremeDuration ) ; <nl> - float fMaxExtremeDuration = GetPortFloat ( & m_actInfo , EIP_MaxExtremeDuration ) ; <nl> - float fMinTotalDuration = GetPortFloat ( & m_actInfo , EIP_MinTotalDuration ) ; <nl> - float fMaxTotalDuration = GetPortFloat ( & m_actInfo , EIP_MaxTotalDuration ) ; <nl> - <nl> - float apexDurationX = 0 . 0f ; <nl> - float apexDurationY = 0 . 0f ; <nl> - <nl> - ResetX ( ) ; <nl> - ResetY ( ) ; <nl> - <nl> - for ( int i = 0 ; i < ( int ) m_stickHistory . size ( ) ; + + i ) <nl> - { <nl> - if ( m_iMinStartX > = 0 ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . x > - fStickExtremeThreshold ) & & ( m_iMinEndX < 0 ) ) <nl> - m_iMinEndX = i ; <nl> - } <nl> - else <nl> - { <nl> - if ( m_stickHistory [ i ] . x < - fStickExtremeThreshold ) <nl> - m_iMinStartX = i ; <nl> - } <nl> - if ( m_iMaxStartX > = 0 ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . x < fStickExtremeThreshold ) & & ( m_iMaxEndX < 0 ) ) <nl> - m_iMaxEndX = i ; <nl> - } <nl> - else <nl> - { <nl> - if ( m_stickHistory [ i ] . x > fStickExtremeThreshold ) <nl> - m_iMaxStartX = i ; <nl> - } <nl> - <nl> - if ( m_iMinStartY > = 0 ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . y > - fStickExtremeThreshold ) & & ( m_iMinEndY < 0 ) ) <nl> - m_iMinEndY = i ; <nl> - } <nl> - else <nl> - { <nl> - if ( m_stickHistory [ i ] . y < - fStickExtremeThreshold ) <nl> - m_iMinStartY = i ; <nl> - } <nl> - if ( m_iMaxStartY > = 0 ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . y < fStickExtremeThreshold ) & & ( m_iMaxEndY < 0 ) ) <nl> - m_iMaxEndY = i ; <nl> - } <nl> - else <nl> - { <nl> - if ( m_stickHistory [ i ] . y > fStickExtremeThreshold ) <nl> - m_iMaxStartY = i ; <nl> - } <nl> - <nl> - if ( m_iMinEndX > = 0 ) <nl> - { <nl> - float duration = GetDuration ( m_iMinStartX , m_iMinEndX ) ; <nl> - if ( ( duration < fMinExtremeDuration ) | | ( duration > fMaxExtremeDuration ) ) <nl> - ResetX ( ) ; <nl> - } <nl> - <nl> - if ( m_iMaxEndX > = 0 ) <nl> - { <nl> - float duration = GetDuration ( m_iMaxStartX , m_iMaxEndX ) ; <nl> - if ( ( duration < fMinExtremeDuration ) | | ( duration > fMaxExtremeDuration ) ) <nl> - ResetX ( ) ; <nl> - } <nl> - if ( m_iMinEndY > = 0 ) <nl> - { <nl> - float duration = GetDuration ( m_iMinStartY , m_iMinEndY ) ; <nl> - if ( ( duration < fMinExtremeDuration ) | | ( duration > fMaxExtremeDuration ) ) <nl> - ResetY ( ) ; <nl> - } <nl> - <nl> - if ( m_iMaxEndY > = 0 ) <nl> - { <nl> - float duration = GetDuration ( m_iMaxStartY , m_iMaxEndY ) ; <nl> - if ( ( duration < fMinExtremeDuration ) | | ( duration > fMaxExtremeDuration ) ) <nl> - ResetY ( ) ; <nl> - } <nl> - <nl> - if ( ( m_iMinStartX < 0 ) & & ( m_iMaxStartX < 0 ) ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . x > - fStickDeadThreshold ) & & ( m_stickHistory [ i ] . x < fStickDeadThreshold ) ) <nl> - m_iLastStartDeadX = i ; <nl> - } <nl> - if ( ( m_iMinStartY < 0 ) & & ( m_iMaxStartY < 0 ) ) <nl> - { <nl> - if ( ( m_stickHistory [ i ] . y > - fStickDeadThreshold ) & & ( m_stickHistory [ i ] . y < fStickDeadThreshold ) ) <nl> - m_iLastStartDeadY = i ; <nl> - } <nl> - <nl> - if ( m_iFirstEndDeadX < 0 ) <nl> - if ( ( m_iMinEndX > = 0 ) & & ( m_iMaxEndX > = 0 ) ) <nl> - if ( ( m_stickHistory [ i ] . x > - fStickDeadThreshold ) & & ( m_stickHistory [ i ] . x < fStickDeadThreshold ) ) <nl> - m_iFirstEndDeadX = i ; <nl> - <nl> - if ( m_iFirstEndDeadY < 0 ) <nl> - if ( ( m_iMinEndY > = 0 ) & & ( m_iMaxEndY > = 0 ) ) <nl> - if ( ( m_stickHistory [ i ] . y > - fStickDeadThreshold ) & & ( m_stickHistory [ i ] . y < fStickDeadThreshold ) ) <nl> - m_iFirstEndDeadY = i ; <nl> - <nl> - if ( ( m_iLastStartDeadX > = 0 ) & & ( m_iFirstEndDeadX > = 0 ) ) <nl> - { <nl> - float duration = GetDuration ( m_iLastStartDeadX , m_iFirstEndDeadX ) ; <nl> - if ( ( duration < fMinTotalDuration ) | | ( duration > fMaxTotalDuration ) ) <nl> - ResetX ( ) ; <nl> - } <nl> - <nl> - if ( ( m_iLastStartDeadY > = 0 ) & & ( m_iFirstEndDeadY > = 0 ) ) <nl> - { <nl> - float duration = GetDuration ( m_iLastStartDeadY , m_iFirstEndDeadY ) ; <nl> - if ( ( duration < fMinTotalDuration ) | | ( duration > fMaxTotalDuration ) ) <nl> - ResetY ( ) ; <nl> - } <nl> - } <nl> - <nl> - int iYes = m_iFirstEndDeadY ; <nl> - int iNo = m_iFirstEndDeadX ; <nl> - bool bYes = ( iYes > = 0 ) ; <nl> - bool bNo = ( iNo > = 0 ) ; <nl> - <nl> - if ( bYes & & ! bNo ) <nl> - { <nl> - Reset ( ) ; <nl> - Finish ( ) ; <nl> - ActivateOutput ( & m_actInfo , EOP_Yes , true ) ; <nl> - } <nl> - if ( bNo & & ! bYes ) <nl> - { <nl> - Reset ( ) ; <nl> - Finish ( ) ; <nl> - ActivateOutput ( & m_actInfo , EOP_No , true ) ; <nl> - } <nl> - if ( bYes & & bNo ) <nl> - { <nl> - Reset ( ) ; <nl> - } <nl> - } <nl> - <nl> - private : <nl> - CTimeValue m_activationTime ; <nl> - int m_iLastStartDeadX ; <nl> - int m_iLastStartDeadY ; <nl> - int m_iFirstEndDeadX ; <nl> - int m_iFirstEndDeadY ; <nl> - int m_iMinStartX ; <nl> - int m_iMinEndX ; <nl> - int m_iMaxStartX ; <nl> - int m_iMaxEndX ; <nl> - int m_iMinStartY ; <nl> - int m_iMinEndY ; <nl> - int m_iMaxStartY ; <nl> - int m_iMaxEndY ; <nl> - std : : vector < Vec2 > m_stickHistory ; <nl> - std : : vector < CTimeValue > m_stickHistoryTime ; <nl> - Vec2 m_stick ; <nl> - bool m_bActive ; / / TRUE when node is enabled <nl> - bool m_bFinished ; <nl> - SActivationInfo m_actInfo ; / / Activation info instance <nl> - } ; <nl> - <nl> - REGISTER_FLOW_NODE ( " Input : YesNoGesture " , CFlowYesNoGesture ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / GameNodes . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / GameNodes . cpp <nl> REGISTER_FLOW_NODE ( " Game : FireSystemEvent " , CFlowNode_FireSystemEvent ) ; <nl> REGISTER_FLOW_NODE ( " Game : SetPostEffectParam " , CFlowNode_SetPostEffectParam ) ; <nl> REGISTER_FLOW_NODE ( " Game : IsDemo " , CFlowIsDemo ) ; <nl> REGISTER_FLOW_NODE ( " Game : IsZoomToggling " , CFlowIsZoomToggling ) ; <nl> - REGISTER_FLOW_NODE ( " System : SaveGame " , CFlowSaveGameNode ) ; <nl> + REGISTER_FLOW_NODE ( " Game : SaveGame " , CFlowSaveGameNode ) ; <nl> mmm a / Code / GameSDK / GameDll / Nodes / WeaponNodes . cpp <nl> ppp b / Code / GameSDK / GameDll / Nodes / WeaponNodes . cpp <nl> class CFlowNode_Explosion : public CFlowBaseNode < eNCT_Singleton > <nl> } ; <nl> <nl> <nl> - REGISTER_FLOW_NODE ( " Weapon : CheckAccessory " , CFlowNode_WeaponCheckAccessory ) ; <nl> - REGISTER_FLOW_NODE ( " Weapon : CheckZoom " , CFlowNode_WeaponCheckZoom ) ; <nl> + REGISTER_FLOW_NODE ( " Weapon : AccessoryCheck " , CFlowNode_WeaponCheckAccessory ) ; <nl> + REGISTER_FLOW_NODE ( " Weapon : ZoomCheck " , CFlowNode_WeaponCheckZoom ) ; <nl> REGISTER_FLOW_NODE ( " Weapon : Accessory " , CFlowNode_WeaponAccessory ) ; <nl> REGISTER_FLOW_NODE ( " Weapon : Explosion " , CFlowNode_Explosion ) ; <nl> mmm a / Code / GameSDK / GameDll / gamedllsdk . waf_files <nl> ppp b / Code / GameSDK / GameDll / gamedllsdk . waf_files <nl> <nl> " Environment / DangerousRigidBody . h " <nl> ] , <nl> " Game Files / Environment / Tornado " : [ <nl> - " Environment / FlowTornado . cpp " , <nl> " Environment / Tornado . cpp " , <nl> - " Environment / FlowTornado . h " , <nl> " Environment / Tornado . h " <nl> ] <nl> } , <nl> <nl> " Nodes / FlowActorNodes . cpp " , <nl> " Nodes / FlowActorSensor . cpp " , <nl> " Nodes / FlowCheckAreaNode . cpp " , <nl> - " Nodes / FlowConvoyNode . cpp " , <nl> " Nodes / FlowHitInfoNode . cpp " , <nl> " Nodes / FlowLockPlayerNode . cpp " , <nl> - " Nodes / FlowLockPlayerRotationNode . cpp " , <nl> " Nodes / FlowNodesInput . cpp " , <nl> " Nodes / FlowPlayerStagingNode . cpp " , <nl> " Nodes / FlowPlayerStumble . cpp " , <nl> <nl> " FlowVehicleNodes . cpp " , <nl> " Nodes / G2FlowEntityElectricConnector . cpp " , <nl> " Nodes / G2FlowEntityVelocity . cpp " , <nl> - " Nodes / G2FlowYesNoGestureNode . cpp " , <nl> " Nodes / GameNodes . cpp " , <nl> " Nodes / MPNodes . cpp " , <nl> " Nodes / PressureWaveNode . cpp " , <nl> <nl> " Nodes / AINodes . h " , <nl> " Nodes / ColorGradientNode . h " , <nl> " Nodes / FeatureTestNode . h " , <nl> - " Nodes / FlowConvoyNode . h " , <nl> " Nodes / G2FlowBaseNode . h " , <nl> " Nodes / AIAssignmentNodes . h " , <nl> " FlowWeaponCustomizationNodes . h " , <nl>
! XI / / ce / task_flownode_substitution to main @ 1417843 ( Approved by achim )
CRYTEK/CRYENGINE
8c8e3987c2023f42ac6ca87c7e0fe47ef2f18ab5
2016-07-20T08:28:21Z
mmm a / tensorflow / contrib / distributions / python / ops / distribution . py <nl> ppp b / tensorflow / contrib / distributions / python / ops / distribution . py <nl> def sample ( self , sample_shape = ( ) , seed = None , name = " sample " ) : <nl> sample . <nl> <nl> Args : <nl> - sample_shape : int32 ` Tensor ` or tuple or list . Shape of the generated <nl> - samples . <nl> + sample_shape : Rank 1 ` int32 ` ` Tensor ` . Shape of the generated samples . <nl> seed : Python integer seed for RNG <nl> name : name to give to the op . <nl> <nl> def sample ( self , sample_shape = ( ) , seed = None , name = " sample " ) : <nl> sample per batched distribution . <nl> <nl> Args : <nl> - sample_shape : ` int32 ` ` Tensor ` or tuple or list . Shape of the generated <nl> - samples . <nl> + sample_shape : Rank 1 ` int32 ` ` Tensor ` . Shape of the generated samples . <nl> seed : Python integer seed for RNG <nl> name : name to give to the op . <nl> <nl>
DOCFIX : Distribution . sample expects a rank 1 tensor giving the sample shape ,
tensorflow/tensorflow
3464bb4194fcca0c55b7fa6b0fdb7fed659bf0f7
2016-08-06T01:32:46Z
mmm a / test / core / bad_ssl / bad_ssl_test . c <nl> ppp b / test / core / bad_ssl / bad_ssl_test . c <nl> <nl> / * <nl> * <nl> - * Copyright 2015 , Google Inc . <nl> + * Copyright 2015 - 2016 , Google Inc . <nl> * All rights reserved . <nl> * <nl> * Redistribution and use in source and binary forms , with or without <nl>
Fix copyrights
grpc/grpc
19e966f1eb8be0305a1c4363b9d18e4fcb714d34
2016-03-12T04:40:49Z
mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> typedef bool ( * EntropySource ) ( unsigned char * buffer , size_t length ) ; <nl> * resolving the location of a return address on the stack . Profilers that <nl> * change the return address on the stack can use this to resolve the stack <nl> * location to whereever the profiler stashed the original return address . <nl> - * When invoked , return_addr_location will point to a location on stack where <nl> - * a machine return address resides , this function should return either the <nl> - * same pointer , or a pointer to the profiler ' s copy of the original return <nl> - * address . <nl> + * <nl> + * \ param return_addr_location points to a location on stack where a machine <nl> + * return address resides . <nl> + * \ returns either return_addr_location , or else a pointer to the profiler ' s <nl> + * copy of the original return address . <nl> + * <nl> + * \ note the resolver function must not cause garbage collection . <nl> * / <nl> typedef uintptr_t ( * ReturnAddressLocationResolver ) ( <nl> uintptr_t return_addr_location ) ; <nl> <nl> <nl> + / * * <nl> + * FunctionEntryHook is the type of the profile entry hook called at entry to <nl> + * any generated function when function - level profiling is enabled . <nl> + * <nl> + * \ param function the address of the function that ' s being entered . <nl> + * \ param return_addr_location points to a location on stack where the machine <nl> + * return address resides . This can be used to identify the caller of <nl> + * \ p function , and / or modified to divert execution when \ p function exits . <nl> + * <nl> + * \ note the entry hook must not cause garbage collection . <nl> + * / <nl> + typedef void ( * FunctionEntryHook ) ( uintptr_t function , <nl> + uintptr_t return_addr_location ) ; <nl> + <nl> + <nl> / * * <nl> * Interface for iterating though all external resources in the heap . <nl> * / <nl> class V8EXPORT V8 { <nl> static void SetReturnAddressLocationResolver ( <nl> ReturnAddressLocationResolver return_address_resolver ) ; <nl> <nl> + / * * <nl> + * Allows the host application to provide the address of a function that ' s <nl> + * invoked on entry to every V8 - generated function . <nl> + * Note that \ p entry_hook is invoked at the very start of each <nl> + * generated function . <nl> + * <nl> + * \ param entry_hook a function that will be invoked on entry to every <nl> + * V8 - generated function . <nl> + * \ returns true on success on supported platforms , false on failure . <nl> + * \ note Setting a new entry hook function when one is already active will <nl> + * fail . <nl> + * / <nl> + static bool SetFunctionEntryHook ( FunctionEntryHook entry_hook ) ; <nl> + <nl> / * * <nl> * Adjusts the amount of registered external memory . Used to give <nl> * V8 an indication of the amount of externally allocated memory <nl> mmm a / src / api . cc <nl> ppp b / src / api . cc <nl> <nl> # include " . . / include / v8 - profiler . h " <nl> # include " . . / include / v8 - testing . h " <nl> # include " bootstrapper . h " <nl> + # include " code - stubs . h " <nl> # include " compiler . h " <nl> # include " conversions - inl . h " <nl> # include " counters . h " <nl> void v8 : : V8 : : SetReturnAddressLocationResolver ( <nl> } <nl> <nl> <nl> + bool v8 : : V8 : : SetFunctionEntryHook ( FunctionEntryHook entry_hook ) { <nl> + return i : : ProfileEntryHookStub : : SetFunctionEntryHook ( entry_hook ) ; <nl> + } <nl> + <nl> + <nl> bool v8 : : V8 : : Dispose ( ) { <nl> i : : Isolate * isolate = i : : Isolate : : Current ( ) ; <nl> if ( ! ApiCheck ( isolate ! = NULL & & isolate - > IsDefaultIsolate ( ) , <nl> mmm a / src / arm / code - stubs - arm . cc <nl> ppp b / src / arm / code - stubs - arm . cc <nl> void StoreArrayLiteralElementStub : : Generate ( MacroAssembler * masm ) { <nl> __ Ret ( ) ; <nl> } <nl> <nl> + <nl> + void ProfileEntryHookStub : : MaybeCallEntryHook ( MacroAssembler * masm ) { <nl> + if ( entry_hook_ ! = NULL ) { <nl> + ProfileEntryHookStub stub ; <nl> + __ push ( lr ) ; <nl> + __ CallStub ( & stub ) ; <nl> + __ pop ( lr ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + void ProfileEntryHookStub : : Generate ( MacroAssembler * masm ) { <nl> + / / The entry hook is a " push lr " instruction , followed by a call . <nl> + const int32_t kReturnAddressDistanceFromFunctionStart = <nl> + Assembler : : kCallTargetAddressOffset + Assembler : : kInstrSize ; <nl> + <nl> + / / Save live volatile registers . <nl> + __ Push ( lr , r5 , r1 ) ; <nl> + const int32_t kNumSavedRegs = 3 ; <nl> + <nl> + / / Compute the function ' s address for the first argument . <nl> + __ sub ( r0 , lr , Operand ( kReturnAddressDistanceFromFunctionStart ) ) ; <nl> + <nl> + / / The caller ' s return address is above the saved temporaries . <nl> + / / Grab that for the second argument to the hook . <nl> + __ add ( r1 , sp , Operand ( kNumSavedRegs * kPointerSize ) ) ; <nl> + <nl> + / / Align the stack if necessary . <nl> + int frame_alignment = masm - > ActivationFrameAlignment ( ) ; <nl> + if ( frame_alignment > kPointerSize ) { <nl> + __ mov ( r5 , sp ) ; <nl> + ASSERT ( IsPowerOf2 ( frame_alignment ) ) ; <nl> + __ and_ ( sp , sp , Operand ( - frame_alignment ) ) ; <nl> + } <nl> + <nl> + # if defined ( V8_HOST_ARCH_ARM ) <nl> + __ mov ( ip , Operand ( reinterpret_cast < int32_t > ( & entry_hook_ ) ) ) ; <nl> + __ ldr ( ip , MemOperand ( ip ) ) ; <nl> + # else <nl> + / / Under the simulator we need to indirect the entry hook through a <nl> + / / trampoline function at a known address . <nl> + Address trampoline_address = reinterpret_cast < Address > ( <nl> + reinterpret_cast < intptr_t > ( EntryHookTrampoline ) ) ; <nl> + ApiFunction dispatcher ( trampoline_address ) ; <nl> + __ mov ( ip , Operand ( ExternalReference ( & dispatcher , <nl> + ExternalReference : : BUILTIN_CALL , <nl> + masm - > isolate ( ) ) ) ) ; <nl> + # endif <nl> + __ Call ( ip ) ; <nl> + <nl> + / / Restore the stack pointer if needed . <nl> + if ( frame_alignment > kPointerSize ) { <nl> + __ mov ( sp , r5 ) ; <nl> + } <nl> + <nl> + __ Pop ( lr , r5 , r1 ) ; <nl> + __ Ret ( ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } } / / namespace v8 : : internal <nl> mmm a / src / arm / full - codegen - arm . cc <nl> ppp b / src / arm / full - codegen - arm . cc <nl> void FullCodeGenerator : : Generate ( ) { <nl> SetFunctionPosition ( function ( ) ) ; <nl> Comment cmnt ( masm_ , " [ function compiled by full code generator " ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> mmm a / src / arm / lithium - codegen - arm . cc <nl> ppp b / src / arm / lithium - codegen - arm . cc <nl> void LCodeGen : : Comment ( const char * format , . . . ) { <nl> bool LCodeGen : : GeneratePrologue ( ) { <nl> ASSERT ( is_generating ( ) ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info_ - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> mmm a / src / code - stubs . cc <nl> ppp b / src / code - stubs . cc <nl> void ElementsTransitionAndStoreStub : : Generate ( MacroAssembler * masm ) { <nl> KeyedStoreIC : : GenerateRuntimeSetProperty ( masm , strict_mode_ ) ; <nl> } <nl> <nl> + <nl> + FunctionEntryHook ProfileEntryHookStub : : entry_hook_ = NULL ; <nl> + <nl> + <nl> + void ProfileEntryHookStub : : EntryHookTrampoline ( intptr_t function , <nl> + intptr_t stack_pointer ) { <nl> + if ( entry_hook_ ! = NULL ) <nl> + entry_hook_ ( function , stack_pointer ) ; <nl> + } <nl> + <nl> + <nl> + bool ProfileEntryHookStub : : SetFunctionEntryHook ( FunctionEntryHook entry_hook ) { <nl> + / / We don ' t allow setting a new entry hook over one that ' s <nl> + / / already active , as the hooks won ' t stack . <nl> + if ( entry_hook ! = 0 & & entry_hook_ ! = 0 ) <nl> + return false ; <nl> + <nl> + entry_hook_ = entry_hook ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> } } / / namespace v8 : : internal <nl> mmm a / src / code - stubs . h <nl> ppp b / src / code - stubs . h <nl> namespace internal { <nl> V ( DebuggerStatement ) \ <nl> V ( StringDictionaryLookup ) \ <nl> V ( ElementsTransitionAndStore ) \ <nl> - V ( StoreArrayLiteralElement ) <nl> + V ( StoreArrayLiteralElement ) \ <nl> + V ( ProfileEntryHook ) <nl> <nl> / / List of code stubs only used on ARM platforms . <nl> # ifdef V8_TARGET_ARCH_ARM <nl> class StoreArrayLiteralElementStub : public CodeStub { <nl> DISALLOW_COPY_AND_ASSIGN ( StoreArrayLiteralElementStub ) ; <nl> } ; <nl> <nl> + <nl> + class ProfileEntryHookStub : public CodeStub { <nl> + public : <nl> + explicit ProfileEntryHookStub ( ) { } <nl> + <nl> + / / The profile entry hook function is not allowed to cause a GC . <nl> + virtual bool SometimesSetsUpAFrame ( ) { return false ; } <nl> + <nl> + / / Generates a call to the entry hook if it ' s enabled . <nl> + static void MaybeCallEntryHook ( MacroAssembler * masm ) ; <nl> + <nl> + / / Sets or unsets the entry hook function . Returns true on success , <nl> + / / false on an attempt to replace a non - NULL entry hook with another <nl> + / / non - NULL hook . <nl> + static bool SetFunctionEntryHook ( FunctionEntryHook entry_hook ) ; <nl> + <nl> + private : <nl> + static void EntryHookTrampoline ( intptr_t function , <nl> + intptr_t stack_pointer ) ; <nl> + <nl> + Major MajorKey ( ) { return ProfileEntryHook ; } <nl> + int MinorKey ( ) { return 0 ; } <nl> + <nl> + void Generate ( MacroAssembler * masm ) ; <nl> + <nl> + / / The current function entry hook . <nl> + static FunctionEntryHook entry_hook_ ; <nl> + <nl> + DISALLOW_COPY_AND_ASSIGN ( ProfileEntryHookStub ) ; <nl> + } ; <nl> + <nl> } } / / namespace v8 : : internal <nl> <nl> # endif / / V8_CODE_STUBS_H_ <nl> mmm a / src / ia32 / code - stubs - ia32 . cc <nl> ppp b / src / ia32 / code - stubs - ia32 . cc <nl> void StoreArrayLiteralElementStub : : Generate ( MacroAssembler * masm ) { <nl> __ ret ( 0 ) ; <nl> } <nl> <nl> + <nl> + void ProfileEntryHookStub : : MaybeCallEntryHook ( MacroAssembler * masm ) { <nl> + if ( entry_hook_ ! = NULL ) { <nl> + ProfileEntryHookStub stub ; <nl> + masm - > CallStub ( & stub ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + void ProfileEntryHookStub : : Generate ( MacroAssembler * masm ) { <nl> + / / Ecx is the only volatile register we must save . <nl> + __ push ( ecx ) ; <nl> + <nl> + / / Calculate and push the original stack pointer . <nl> + __ lea ( eax , Operand ( esp , kPointerSize ) ) ; <nl> + __ push ( eax ) ; <nl> + <nl> + / / Calculate and push the function address . <nl> + __ mov ( eax , Operand ( eax , 0 ) ) ; <nl> + __ sub ( eax , Immediate ( Assembler : : kCallInstructionLength ) ) ; <nl> + __ push ( eax ) ; <nl> + <nl> + / / Call the entry hook . <nl> + int32_t hook_location = reinterpret_cast < int32_t > ( & entry_hook_ ) ; <nl> + __ call ( Operand ( hook_location , RelocInfo : : NONE ) ) ; <nl> + __ add ( esp , Immediate ( 2 * kPointerSize ) ) ; <nl> + <nl> + / / Restore ecx . <nl> + __ pop ( ecx ) ; <nl> + __ ret ( 0 ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } } / / namespace v8 : : internal <nl> mmm a / src / ia32 / full - codegen - ia32 . cc <nl> ppp b / src / ia32 / full - codegen - ia32 . cc <nl> void FullCodeGenerator : : Generate ( ) { <nl> SetFunctionPosition ( function ( ) ) ; <nl> Comment cmnt ( masm_ , " [ function compiled by full code generator " ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> FullCodeGenerator : : NestedStatement * FullCodeGenerator : : TryFinally : : Exit ( <nl> return previous_ ; <nl> } <nl> <nl> - <nl> # undef __ <nl> <nl> } } / / namespace v8 : : internal <nl> mmm a / src / ia32 / lithium - codegen - ia32 . cc <nl> ppp b / src / ia32 / lithium - codegen - ia32 . cc <nl> void LCodeGen : : Comment ( const char * format , . . . ) { <nl> bool LCodeGen : : GeneratePrologue ( ) { <nl> ASSERT ( is_generating ( ) ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info_ - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> mmm a / src / x64 / code - stubs - x64 . cc <nl> ppp b / src / x64 / code - stubs - x64 . cc <nl> void StoreArrayLiteralElementStub : : Generate ( MacroAssembler * masm ) { <nl> __ ret ( 0 ) ; <nl> } <nl> <nl> + <nl> + void ProfileEntryHookStub : : MaybeCallEntryHook ( MacroAssembler * masm ) { <nl> + if ( entry_hook_ ! = NULL ) { <nl> + ProfileEntryHookStub stub ; <nl> + masm - > CallStub ( & stub ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + void ProfileEntryHookStub : : Generate ( MacroAssembler * masm ) { <nl> + / / Save volatile registers . <nl> + # ifdef _WIN64 <nl> + const int kNumSavedRegisters = 1 ; <nl> + <nl> + __ push ( rcx ) ; <nl> + # else <nl> + const int kNumSavedRegisters = 3 ; <nl> + <nl> + __ push ( rcx ) ; <nl> + __ push ( rdi ) ; <nl> + __ push ( rsi ) ; <nl> + # endif <nl> + <nl> + / / Calculate the original stack pointer and store it in the second arg . <nl> + # ifdef _WIN64 <nl> + __ lea ( rdx , Operand ( rsp , kNumSavedRegisters * kPointerSize ) ) ; <nl> + # else <nl> + __ lea ( rsi , Operand ( rsp , kNumSavedRegisters * kPointerSize ) ) ; <nl> + # endif <nl> + <nl> + / / Calculate the function address to the first arg . <nl> + # ifdef _WIN64 <nl> + __ movq ( rcx , Operand ( rdx , 0 ) ) ; <nl> + __ subq ( rcx , Immediate ( Assembler : : kShortCallInstructionLength ) ) ; <nl> + # else <nl> + __ movq ( rdi , Operand ( rsi , 0 ) ) ; <nl> + __ subq ( rdi , Immediate ( Assembler : : kShortCallInstructionLength ) ) ; <nl> + # endif <nl> + <nl> + / / Reserve stack for the first 4 args and align the stack . <nl> + __ movq ( kScratchRegister , rsp ) ; <nl> + __ subq ( rsp , Immediate ( 4 * kPointerSize ) ) ; <nl> + int frame_alignment = OS : : ActivationFrameAlignment ( ) ; <nl> + ASSERT ( IsPowerOf2 ( frame_alignment ) ) ; <nl> + __ and_ ( rsp , Immediate ( - frame_alignment ) ) ; <nl> + <nl> + / / Call the entry hook . <nl> + int64_t hook_location = reinterpret_cast < int64_t > ( & entry_hook_ ) ; <nl> + __ movq ( rax , hook_location , RelocInfo : : NONE ) ; <nl> + __ call ( Operand ( rax , 0 ) ) ; <nl> + __ movq ( rsp , kScratchRegister ) ; <nl> + <nl> + / / Restore volatile regs . <nl> + # ifdef _WIN64 <nl> + __ pop ( rcx ) ; <nl> + # else <nl> + __ pop ( rsi ) ; <nl> + __ pop ( rdi ) ; <nl> + __ pop ( rcx ) ; <nl> + # endif <nl> + } <nl> + <nl> # undef __ <nl> <nl> } } / / namespace v8 : : internal <nl> mmm a / src / x64 / full - codegen - x64 . cc <nl> ppp b / src / x64 / full - codegen - x64 . cc <nl> void FullCodeGenerator : : Generate ( ) { <nl> SetFunctionPosition ( function ( ) ) ; <nl> Comment cmnt ( masm_ , " [ function compiled by full code generator " ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> mmm a / src / x64 / lithium - codegen - x64 . cc <nl> ppp b / src / x64 / lithium - codegen - x64 . cc <nl> void LCodeGen : : Comment ( const char * format , . . . ) { <nl> bool LCodeGen : : GeneratePrologue ( ) { <nl> ASSERT ( is_generating ( ) ) ; <nl> <nl> + ProfileEntryHookStub : : MaybeCallEntryHook ( masm_ ) ; <nl> + <nl> # ifdef DEBUG <nl> if ( strlen ( FLAG_stop_at ) > 0 & & <nl> info_ - > function ( ) - > name ( ) - > IsEqualTo ( CStrVector ( FLAG_stop_at ) ) ) { <nl> mmm a / test / cctest / test - api . cc <nl> ppp b / test / cctest / test - api . cc <nl> <nl> # include " isolate . h " <nl> # include " compilation - cache . h " <nl> # include " execution . h " <nl> + # include " objects . h " <nl> # include " snapshot . h " <nl> # include " platform . h " <nl> # include " utils . h " <nl> THREADED_TEST ( NestedHandleScopeAndContexts ) { <nl> } <nl> <nl> <nl> + static i : : Handle < i : : JSFunction > * foo_ptr = NULL ; <nl> + static int foo_count = 0 ; <nl> + static i : : Handle < i : : JSFunction > * bar_ptr = NULL ; <nl> + static int bar_count = 0 ; <nl> + <nl> + <nl> + static void entry_hook ( uintptr_t function , <nl> + uintptr_t return_addr_location ) { <nl> + i : : Code * code = i : : Code : : GetCodeFromTargetAddress ( <nl> + reinterpret_cast < i : : Address > ( function ) ) ; <nl> + CHECK ( code ! = NULL ) ; <nl> + <nl> + if ( bar_ptr ! = NULL & & code = = ( * bar_ptr ) - > code ( ) ) <nl> + + + bar_count ; <nl> + <nl> + if ( foo_ptr ! = NULL & & code = = ( * foo_ptr ) - > code ( ) ) <nl> + + + foo_count ; <nl> + <nl> + / / TODO ( siggi ) : Verify return_addr_location . <nl> + } <nl> + <nl> + <nl> + static void RunLoopInNewEnv ( ) { <nl> + bar_ptr = NULL ; <nl> + foo_ptr = NULL ; <nl> + <nl> + v8 : : HandleScope outer ; <nl> + v8 : : Persistent < Context > env = Context : : New ( ) ; <nl> + env - > Enter ( ) ; <nl> + <nl> + const char * script = <nl> + " function bar ( ) { " <nl> + " var sum = 0 ; " <nl> + " for ( i = 0 ; i < 100 ; + + i ) " <nl> + " sum = foo ( i ) ; " <nl> + " return sum ; " <nl> + " } " <nl> + " function foo ( i ) { return i * i ; } " ; <nl> + CompileRun ( script ) ; <nl> + i : : Handle < i : : JSFunction > bar = <nl> + i : : Handle < i : : JSFunction > : : cast ( <nl> + v8 : : Utils : : OpenHandle ( * env - > Global ( ) - > Get ( v8_str ( " bar " ) ) ) ) ; <nl> + ASSERT ( * bar ) ; <nl> + <nl> + i : : Handle < i : : JSFunction > foo = <nl> + i : : Handle < i : : JSFunction > : : cast ( <nl> + v8 : : Utils : : OpenHandle ( * env - > Global ( ) - > Get ( v8_str ( " foo " ) ) ) ) ; <nl> + ASSERT ( * foo ) ; <nl> + <nl> + bar_ptr = & bar ; <nl> + foo_ptr = & foo ; <nl> + <nl> + v8 : : Handle < v8 : : Value > value = CompileRun ( " bar ( ) ; " ) ; <nl> + CHECK ( value - > IsNumber ( ) ) ; <nl> + CHECK_EQ ( 9801 . 0 , v8 : : Number : : Cast ( * value ) - > Value ( ) ) ; <nl> + <nl> + / / Test the optimized codegen path . <nl> + value = CompileRun ( " % OptimizeFunctionOnNextCall ( foo ) ; " <nl> + " bar ( ) ; " ) ; <nl> + CHECK ( value - > IsNumber ( ) ) ; <nl> + CHECK_EQ ( 9801 . 0 , v8 : : Number : : Cast ( * value ) - > Value ( ) ) ; <nl> + <nl> + env - > Exit ( ) ; <nl> + } <nl> + <nl> + <nl> + THREADED_TEST ( SetFunctionEntryHook ) { <nl> + i : : FLAG_allow_natives_syntax = true ; <nl> + <nl> + / / Test setting and resetting the entry hook . <nl> + / / Nulling it should always succeed . <nl> + CHECK ( v8 : : V8 : : SetFunctionEntryHook ( NULL ) ) ; <nl> + <nl> + CHECK ( v8 : : V8 : : SetFunctionEntryHook ( entry_hook ) ) ; <nl> + / / Setting a hook while one ' s active should fail . <nl> + CHECK_EQ ( false , v8 : : V8 : : SetFunctionEntryHook ( entry_hook ) ) ; <nl> + <nl> + CHECK ( v8 : : V8 : : SetFunctionEntryHook ( NULL ) ) ; <nl> + <nl> + / / Reset the entry count to zero and set the entry hook . <nl> + bar_count = 0 ; <nl> + foo_count = 0 ; <nl> + CHECK ( v8 : : V8 : : SetFunctionEntryHook ( entry_hook ) ) ; <nl> + RunLoopInNewEnv ( ) ; <nl> + <nl> + CHECK_EQ ( 2 , bar_count ) ; <nl> + CHECK_EQ ( 200 , foo_count ) ; <nl> + <nl> + / / Clear the entry hook and count . <nl> + bar_count = 0 ; <nl> + foo_count = 0 ; <nl> + v8 : : V8 : : SetFunctionEntryHook ( NULL ) ; <nl> + <nl> + / / Clear the compilation cache to make sure we don ' t reuse the <nl> + / / functions from the previous invocation . <nl> + v8 : : internal : : Isolate : : Current ( ) - > compilation_cache ( ) - > Clear ( ) ; <nl> + <nl> + / / Verify that entry hooking is now disabled . <nl> + RunLoopInNewEnv ( ) ; <nl> + CHECK ( 0u = = bar_count ) ; <nl> + CHECK ( 0u = = foo_count ) ; <nl> + } <nl> + <nl> + <nl> static int64_t cast ( intptr_t x ) { return static_cast < int64_t > ( x ) ; } <nl> <nl> <nl>
Implements a new API to set a function entry hook for profiling .
v8/v8
5c8c4bec4606109aef9badfc47e75096c7655d69
2012-07-13T16:18:37Z
mmm a / docs / en / sql - reference / statements / select / order - by . md <nl> ppp b / docs / en / sql - reference / statements / select / order - by . md <nl> When floating point numbers are sorted , NaNs are separate from the other values . <nl> <nl> # # Collation Support { # collation - support } <nl> <nl> - For sorting by [ String ] ( . . / . . / . . / sql - reference / data - types / string . md # string ) values , you can specify collation ( comparison ) . Example : ` ORDER BY SearchPhrase COLLATE ' tr ' ` - for sorting by keyword in ascending order , using the Turkish alphabet , case insensitive , assuming that strings are UTF - 8 encoded . ` COLLATE ` can be specified or not for each expression in ORDER BY independently . If ` ASC ` or ` DESC ` is specified , ` COLLATE ` is specified after it . When using ` COLLATE ` , sorting is always case - insensitive . <nl> + For sorting by [ String ] ( . . / . . / . . / sql - reference / data - types / string . md ) values , you can specify collation ( comparison ) . Example : ` ORDER BY SearchPhrase COLLATE ' tr ' ` - for sorting by keyword in ascending order , using the Turkish alphabet , case insensitive , assuming that strings are UTF - 8 encoded . ` COLLATE ` can be specified or not for each expression in ORDER BY independently . If ` ASC ` or ` DESC ` is specified , ` COLLATE ` is specified after it . When using ` COLLATE ` , sorting is always case - insensitive . <nl> <nl> - Collate is supported in [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md # lowcardinality - data - type ) , [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md # data_type - nullable ) , [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md # data - type - array ) and [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md # tuplet1 - t2 ) . <nl> + Collate is supported in [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md ) , [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md ) , [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md ) and [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md ) . <nl> <nl> We only recommend using ` COLLATE ` for final sorting of a small number of rows , since sorting with ` COLLATE ` is less efficient than normal sorting by bytes . <nl> <nl> # # # Collation Examples { # collation - examples } <nl> <nl> - Example only with [ String ] ( . . / . . / . . / sql - reference / data - types / string . md # string ) values : <nl> + Example only with [ String ] ( . . / . . / . . / sql - reference / data - types / string . md ) values : <nl> <nl> Input table : <nl> <nl> Result : <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Example with [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md # data_type - nullable ) : <nl> + Example with [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md ) : <nl> <nl> Input table : <nl> <nl> Result : <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Example with [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md # data - type - array ) : <nl> + Example with [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md ) : <nl> <nl> Input table : <nl> <nl> Result : <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Example with [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md # lowcardinality - data - type ) string : <nl> + Example with [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md ) string : <nl> <nl> Input table : <nl> <nl> Result : <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Example with [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md # tuplet1 - t2 ) : <nl> + Example with [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md ) : <nl> <nl> ` ` ` text <nl> ┌ ─ x ─ ┬ ─ s ─ ─ ─ ─ ─ ─ ─ ┐ <nl> mmm a / docs / ru / sql - reference / statements / select / order - by . md <nl> ppp b / docs / ru / sql - reference / statements / select / order - by . md <nl> toc_title : ORDER BY <nl> <nl> # # Поддержка collation { # collation - support } <nl> <nl> - Для сортировки по значениям типа [ String ] ( . . / . . / . . / sql - reference / data - types / string . md # string ) есть возможность указать collation ( сравнение ) . Пример : ` ORDER BY SearchPhrase COLLATE ' tr ' ` - для сортировки по поисковой фразе , по возрастанию , с учётом турецкого алфавита , регистронезависимо , при допущении , что строки в кодировке UTF - 8 . ` COLLATE ` может быть указан или не указан для каждого выражения в ORDER BY независимо . Если есть ` ASC ` или ` DESC ` , то ` COLLATE ` указывается после них . При использовании ` COLLATE ` сортировка всегда регистронезависима . <nl> + Для сортировки по значениям типа [ String ] ( . . / . . / . . / sql - reference / data - types / string . md ) есть возможность указать collation ( сравнение ) . Пример : ` ORDER BY SearchPhrase COLLATE ' tr ' ` - для сортировки по поисковой фразе , по возрастанию , с учётом турецкого алфавита , регистронезависимо , при допущении , что строки в кодировке UTF - 8 . ` COLLATE ` может быть указан или не указан для каждого выражения в ORDER BY независимо . Если есть ` ASC ` или ` DESC ` , то ` COLLATE ` указывается после них . При использовании ` COLLATE ` сортировка всегда регистронезависима . <nl> <nl> - Сравнение поддерживается при использовании типов [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md # lowcardinality - data - type ) , [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md # data_type - nullable ) , [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md # data - type - array ) и [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md # tuplet1 - t2 ) . <nl> + Сравнение поддерживается при использовании типов [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md ) , [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md ) , [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md ) и [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md ) . <nl> <nl> Рекомендуется использовать ` COLLATE ` только для окончательной сортировки небольшого количества строк , так как производительность сортировки с указанием ` COLLATE ` меньше , чем обычной сортировки по байтам . <nl> <nl> # # # Примеры с использованием сравнения { # collation - examples } <nl> <nl> - Пример с значениями типа [ String ] ( . . / . . / . . / sql - reference / data - types / string . md # string ) : <nl> + Пример с значениями типа [ String ] ( . . / . . / . . / sql - reference / data - types / string . md ) : <nl> <nl> Входная таблица : <nl> <nl> SELECT * FROM collate_test ORDER BY s ASC COLLATE ' en ' ; <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Пример со строками типа [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md # data_type - nullable ) : <nl> + Пример со строками типа [ Nullable ] ( . . / . . / . . / sql - reference / data - types / nullable . md ) : <nl> <nl> Входная таблица : <nl> <nl> SELECT * FROM collate_test ORDER BY s ASC COLLATE ' en ' ; <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Пример со строками в [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md # data - type - array ) : <nl> + Пример со строками в [ Array ] ( . . / . . / . . / sql - reference / data - types / array . md ) : <nl> <nl> Входная таблица : <nl> <nl> SELECT * FROM collate_test ORDER BY s ASC COLLATE ' en ' ; <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Пример со строками типа [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md # lowcardinality - data - type ) : <nl> + Пример со строками типа [ LowCardinality ] ( . . / . . / . . / sql - reference / data - types / lowcardinality . md ) : <nl> <nl> Входная таблица : <nl> <nl> SELECT * FROM collate_test ORDER BY s ASC COLLATE ' en ' ; <nl> └ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Пример со строками в [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md # tuplet1 - t2 ) : <nl> + Пример со строками в [ Tuple ] ( . . / . . / . . / sql - reference / data - types / tuple . md ) : <nl> <nl> ` ` ` text <nl> ┌ ─ x ─ ┬ ─ s ─ ─ ─ ─ ─ ─ ─ ┐ <nl>
troubleshooting the error
ClickHouse/ClickHouse
3794cb2d3f299c9a0953d4d4c8c6021be1f3501e
2020-12-12T02:48:23Z
mmm a / atom / common / api / lib / screen . coffee <nl> ppp b / atom / common / api / lib / screen . coffee <nl> checkAppIsReady = - > <nl> unless process . type is ' renderer ' or require ( ' app ' ) . isReady ( ) <nl> throw new Error ( ' Can not use screen module before the " ready " event of app module gets emitted ' ) <nl> <nl> - module . exports = <nl> - if process . platform in [ ' linux ' , ' win32 ' ] and process . type is ' renderer ' <nl> - # On Linux we could not access screen in renderer process . <nl> - require ( ' remote ' ) . require ' screen ' <nl> - else <nl> - getCursorScreenPoint : - > <nl> - checkAppIsReady ( ) <nl> - binding . getCursorScreenPoint ( ) <nl> - getPrimaryDisplay : - > <nl> - checkAppIsReady ( ) <nl> - binding . getPrimaryDisplay ( ) <nl> + if process . platform in [ ' linux ' , ' win32 ' ] and process . type is ' renderer ' <nl> + # On Linux and Windows we could not access screen in renderer process . <nl> + module . exports = require ( ' remote ' ) . require ' screen ' <nl> + else <nl> + for name , _ of binding <nl> + do ( name ) - > <nl> + module . exports [ name ] = ( args . . . ) - > <nl> + checkAppIsReady ( ) <nl> + binding [ name ] ( args . . . ) <nl>
Don ' t hard - code API names
electron/electron
509294b228daab1c4c33ec0e94ecbd52757493c1
2015-01-16T19:01:38Z
mmm a / imgui . h <nl> ppp b / imgui . h <nl> struct ImVec4 <nl> / / this implementation does NOT call c + + constructors ! we don ' t need them ! also only provide the minimum functionalities we need . <nl> # ifndef ImVector <nl> <nl> - / / Forward declarations for Malloc / Free proxies <nl> - void * ImGui_ProxyMalloc ( size_t size ) ; <nl> - void ImGui_ProxyFree ( void * ptr ) ; <nl> - <nl> template < typename T > <nl> class ImVector <nl> { <nl>
removed malloc / free proxy fwd declares
ocornut/imgui
aa7fc37b37dd0181b88971b661b89f9831a1d973
2014-08-18T11:49:11Z
similarity index 100 % <nl> rename from modules / imgproc / src / color_hsv . cpp <nl> rename to modules / imgproc / src / color_hsv . dispatch . cpp <nl> similarity index 100 % <nl> rename from modules / imgproc / src / color_rgb . cpp <nl> rename to modules / imgproc / src / color_rgb . dispatch . cpp <nl> similarity index 100 % <nl> rename from modules / imgproc / src / color_yuv . cpp <nl> rename to modules / imgproc / src / color_yuv . dispatch . cpp <nl>
imgproc : clone color * . dispatch . cpp
opencv/opencv
f26912960f1a5293f267d75080706d8b520f51f4
2019-03-07T12:35:49Z
mmm a / src / library . js <nl> ppp b / src / library . js <nl> var Library = { <nl> var offset = { { { makeGetValue ( ' _timezone ' , 0 , ' i32 ' ) } } } ; <nl> var daylight = { { { makeGetValue ( ' _daylight ' , 0 , ' i32 ' ) } } } ; <nl> daylight = ( daylight = = 1 ) ? 60 * 60 : 0 ; <nl> - var ret = _mktime ( tmPtr ) - ( offset + daylight ) ; <nl> + var ret = _mktime ( tmPtr ) + offset - daylight ; <nl> return ret ; <nl> } , <nl> <nl> var Library = { <nl> var start = new Date ( date . getFullYear ( ) , 0 , 1 ) ; <nl> var yday = Math . floor ( ( date . getTime ( ) - start . getTime ( ) ) / ( 1000 * 60 * 60 * 24 ) ) ; <nl> { { { makeSetValue ( ' tmPtr ' , ' ___tm_struct_layout . tm_yday ' , ' yday ' , ' i32 ' ) } } } <nl> - { { { makeSetValue ( ' tmPtr ' , ' ___tm_struct_layout . tm_gmtoff ' , ' - start . getTimezoneOffset ( ) * 60 ' , ' i32 ' ) } } } <nl> + { { { makeSetValue ( ' tmPtr ' , ' ___tm_struct_layout . tm_gmtoff ' , ' start . getTimezoneOffset ( ) * 60 ' , ' i32 ' ) } } } <nl> <nl> var dst = Number ( start . getTimezoneOffset ( ) ! = date . getTimezoneOffset ( ) ) ; <nl> { { { makeSetValue ( ' tmPtr ' , ' ___tm_struct_layout . tm_isdst ' , ' dst ' , ' i32 ' ) } } } <nl> var Library = { <nl> if ( _tzname ! = = null ) return ; <nl> <nl> _timezone = _malloc ( QUANTUM_SIZE ) ; <nl> - { { { makeSetValue ( ' _timezone ' , ' 0 ' , ' ( new Date ( ) ) . getTimezoneOffset ( ) * 60 ' , ' i32 ' ) } } } <nl> + { { { makeSetValue ( ' _timezone ' , ' 0 ' , ' - ( new Date ( ) ) . getTimezoneOffset ( ) * 60 ' , ' i32 ' ) } } } <nl> <nl> _daylight = _malloc ( QUANTUM_SIZE ) ; <nl> var winter = new Date ( 2000 , 0 , 1 ) ; <nl> mmm a / tests / time / output . txt <nl> ppp b / tests / time / output . txt <nl> localtime timezone : 1 <nl> localtime daylight : 1 <nl> localtime tzname : 1 <nl> localtime < - > mktime : 1 <nl> - old year : 102 <nl> - new year : 70 <nl> - old year again : 102 <nl> + localtime_r ( 1 ) : 1 <nl> + localtime_r ( 2 ) : 1 <nl> time : 1 <nl> difftime + : 268848637 . 000000 <nl> difftime - : - 268848637 . 000000 <nl> difftime - : - 268848637 . 000000 <nl> 2000 days : 366 <nl> 2001 days : 365 <nl> 2004 days : 366 <nl> - asctime : Wed Dec 25 05 : 22 : 43 2002 <nl> - old asctime : Wed Dec 25 05 : 22 : 43 2002 <nl> - new asctime_r : Sat Jul 2 22 : 33 : 20 2011 <nl> - old asctime again : Wed Dec 25 05 : 22 : 43 2002 <nl> + asctime : Wed Dec 25 03 : 22 : 43 2002 <nl> + old asctime : Wed Dec 25 03 : 22 : 43 2002 <nl> + new asctime_r : Sat Jul 2 19 : 33 : 20 2011 <nl> + old asctime again : Wed Dec 25 03 : 22 : 43 2002 <nl> clock : 0 <nl> ctime : 0 <nl> mmm a / tests / time / src . c <nl> ppp b / tests / time / src . c <nl> int main ( ) { <nl> / / Verify localtime ( ) picks up timezone data . <nl> time_t t2 = xmas2002 - 60 * 60 * 24 * 30 * 6 ; <nl> tm_ptr = localtime ( & t2 ) ; <nl> - printf ( " localtime timezone : % d \ n " , ( timezone + tm_ptr - > tm_isdst * 60 * 60 = = <nl> - - tm_ptr - > tm_gmtoff ) ) ; <nl> + time_t dst_diff = ( tm_ptr - > tm_isdst = = 1 ) ? tm_ptr - > tm_isdst * 60 * 60 : 0 ; <nl> + printf ( " localtime timezone : % d \ n " , ( timezone + tm_ptr - > tm_gmtoff = = dst_diff ) ) ; <nl> printf ( " localtime daylight : % d \ n " , daylight = = tm_ptr - > tm_isdst ) ; <nl> printf ( " localtime tzname : % d \ n " , ( ! strcmp ( tzname [ 0 ] , tm_ptr - > tm_zone ) | | <nl> ! strcmp ( tzname [ 1 ] , tm_ptr - > tm_zone ) ) ) ; <nl> int main ( ) { <nl> time_t t3 = 0 ; <nl> struct tm tm2 ; <nl> localtime_r ( & t3 , & tm2 ) ; <nl> - printf ( " old year : % d \ n " , tm_ptr - > tm_year ) ; <nl> - printf ( " new year : % d \ n " , tm2 . tm_year ) ; <nl> + printf ( " localtime_r ( 1 ) : % d \ n " , tm2 . tm_year ! = tm_ptr - > tm_year ) ; <nl> localtime ( & xmas2002 ) ; <nl> - printf ( " old year again : % d \ n " , tm_ptr - > tm_year ) ; <nl> + printf ( " localtime_r ( 2 ) : % d \ n " , tm2 . tm_year ! = tm_ptr - > tm_year ) ; <nl> <nl> / / Verify time ( ) returns reasonable value ( between 2011 and 2030 ) . <nl> time_t t4 = 0 ; <nl> int main ( ) { <nl> printf ( " 2004 days : % d \ n " , dysize ( 2004 ) ) ; <nl> <nl> / / Verify asctime ( ) formatting ( ) . <nl> - printf ( " asctime : % s " , asctime ( localtime ( & xmas2002 ) ) ) ; <nl> + printf ( " asctime : % s " , asctime ( gmtime ( & xmas2002 ) ) ) ; <nl> <nl> / / Verify asctime_r ( ) doesn ' t clobber static data . <nl> time_t t6 = 1309635200ll ; <nl> - tm_ptr = localtime ( & xmas2002 ) ; <nl> + tm_ptr = gmtime ( & xmas2002 ) ; <nl> char * formatted = asctime ( tm_ptr ) ; <nl> char buffer [ 32 ] ; <nl> - asctime_r ( localtime ( & t6 ) , buffer ) ; <nl> + asctime_r ( gmtime ( & t6 ) , buffer ) ; <nl> printf ( " old asctime : % s " , formatted ) ; <nl> printf ( " new asctime_r : % s " , buffer ) ; <nl> asctime_r ( tm_ptr , buffer ) ; <nl>
Fixed time . h timezone bug .
emscripten-core/emscripten
13ac46b2c9be4aa17319c450a15ed96b71e091d7
2011-07-06T13:36:35Z
mmm a / build / common_functions <nl> ppp b / build / common_functions <nl> function build_breakpad { <nl> } <nl> <nl> function build_libssh2 { <nl> - pushd $ DEPS_DIR / qredisclient / 3rdparty / qsshclient & & . / configure & & popd <nl> + if [ ! - d " $ DEPS_DIR / qredisclient / 3rdparty / qsshclient " ] ; then <nl> + pushd $ DEPS_DIR / qredisclient / 3rdparty / qsshclient & & . / configure & & popd <nl> + fi <nl> } <nl> <nl> function print_line { <nl>
Update common_functions
uglide/RedisDesktopManager
0b09daff73a902fab6f74460b3e62c1013985c92
2018-11-12T10:11:50Z
mmm a / src / clustering / administration / metadata . hpp <nl> ppp b / src / clustering / administration / metadata . hpp <nl> <nl> # include " clustering / administration / namespace_metadata . hpp " <nl> # include " clustering / administration / stat_manager . hpp " <nl> # include " clustering / administration / metadata_change_handler . hpp " <nl> - # include " containers / archive / boost_types . hpp " <nl> # include " http / json / json_adapter . hpp " <nl> # include " memcached / protocol . hpp " <nl> # include " memcached / protocol_json_adapter . hpp " <nl> mmm a / src / clustering / reactor / metadata . hpp <nl> ppp b / src / clustering / reactor / metadata . hpp <nl> <nl> <nl> # include " clustering / immediate_consistency / branch / metadata . hpp " <nl> # include " clustering / immediate_consistency / query / metadata . hpp " <nl> + # include " containers / archive / boost_types . hpp " <nl> # include " rpc / serialize_macros . hpp " <nl> <nl> / * ` reactor_business_card_t ` is the way that each peer tells peers what ' s <nl>
Removed boost_types . hpp include from clustering / administration / metadata . hpp
rethinkdb/rethinkdb
154e49ef723285fd3df6ff079f64ae56360ca1ac
2012-07-20T01:34:09Z
mmm a / include / swift / AST / DiagnosticsSema . def <nl> ppp b / include / swift / AST / DiagnosticsSema . def <nl> ERROR ( protocol_composition_one_class , none , <nl> " contains class % 1 " , ( Type , Type ) ) <nl> <nl> ERROR ( requires_conformance_nonprotocol , none , <nl> - " type % 0 constrained to non - protocol type % 1 " , ( TypeLoc , TypeLoc ) ) <nl> + " type % 0 constrained to non - protocol , non - class type % 1 " , <nl> + ( TypeLoc , TypeLoc ) ) <nl> ERROR ( requires_not_suitable_archetype , none , <nl> - " % select { | first | second } 0type % 1 in % select { conformance | same - type } 2 " <nl> - " requirement does not refer to a generic parameter or associated type " , <nl> - ( int , TypeLoc , int ) ) <nl> + " type % 0 in conformance requirement does not refer to a " <nl> + " generic parameter or associated type " , <nl> + ( TypeLoc ) ) <nl> ERROR ( requires_no_same_type_archetype , none , <nl> " neither type in same - type refers to a generic parameter or " <nl> " associated type " , <nl> mmm a / lib / AST / GenericSignatureBuilder . cpp <nl> ppp b / lib / AST / GenericSignatureBuilder . cpp <nl> ConstraintResult GenericSignatureBuilder : : addLayoutRequirement ( <nl> / / complain . <nl> if ( source . isExplicit ( ) & & source . getLoc ( ) . isValid ( ) ) { <nl> Diags . diagnose ( source . getLoc ( ) , diag : : requires_not_suitable_archetype , <nl> - 0 , TypeLoc : : withoutLoc ( resolvedSubject - > getType ( ) ) , 0 ) ; <nl> + TypeLoc : : withoutLoc ( resolvedSubject - > getType ( ) ) ) ; <nl> return ConstraintResult : : Concrete ; <nl> } <nl> <nl> ConstraintResult GenericSignatureBuilder : : addTypeRequirement ( <nl> } <nl> <nl> / / The right - hand side needs to be concrete . <nl> + Type constraintType ; <nl> if ( auto constraintPA = resolvedConstraint - > getPotentialArchetype ( ) ) { <nl> - / / The constraint type isn ' t a statically - known constraint . <nl> - if ( source . getLoc ( ) . isValid ( ) ) { <nl> - auto constraintType = constraintPA - > getDependentType ( Impl - > GenericParams ) ; <nl> - Diags . diagnose ( source . getLoc ( ) , diag : : requires_not_suitable_archetype , <nl> - 1 , TypeLoc : : withoutLoc ( constraintType ) , 0 ) ; <nl> - } <nl> - <nl> - return ConstraintResult : : Concrete ; <nl> + constraintType = constraintPA - > getDependentType ( Impl - > GenericParams ) ; <nl> + } else { <nl> + constraintType = resolvedConstraint - > getType ( ) ; <nl> } <nl> <nl> / / Check whether we have a reasonable constraint type at all . <nl> - auto constraintType = resolvedConstraint - > getType ( ) ; <nl> - assert ( constraintType & & " Missing constraint type ? " ) ; <nl> if ( ! constraintType - > isExistentialType ( ) & & <nl> ! constraintType - > getClassOrBoundGenericClass ( ) ) { <nl> if ( source . getLoc ( ) . isValid ( ) & & ! constraintType - > hasError ( ) ) { <nl> ConstraintResult GenericSignatureBuilder : : addTypeRequirement ( <nl> if ( source . isExplicit ( ) ) { <nl> if ( source . getLoc ( ) . isValid ( ) ) { <nl> Diags . diagnose ( source . getLoc ( ) , diag : : requires_not_suitable_archetype , <nl> - 0 , TypeLoc : : withoutLoc ( resolvedSubject - > getType ( ) ) , 0 ) ; <nl> + TypeLoc : : withoutLoc ( resolvedSubject - > getType ( ) ) ) ; <nl> } <nl> <nl> return ConstraintResult : : Concrete ; <nl> mmm a / test / Generics / function_defs . swift <nl> ppp b / test / Generics / function_defs . swift <nl> func beginsWith3 < S0 : P2 , S1 : P2 > ( _ seq1 : S0 , _ seq2 : S1 ) - > Bool <nl> / / Bogus requirements <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> func nonTypeReq < T > ( _ : T ) where T : Wibble { } / / expected - error { { use of undeclared type ' Wibble ' } } <nl> - func badProtocolReq < T > ( _ : T ) where T : Int { } / / expected - error { { type ' T ' constrained to non - protocol type ' Int ' } } <nl> + func badProtocolReq < T > ( _ : T ) where T : Int { } / / expected - error { { type ' T ' constrained to non - protocol , non - class type ' Int ' } } <nl> <nl> func nonTypeSameType < T > ( _ : T ) where T = = Wibble { } / / expected - error { { use of undeclared type ' Wibble ' } } <nl> func nonTypeSameType2 < T > ( _ : T ) where Wibble = = T { } / / expected - error { { use of undeclared type ' Wibble ' } } <nl> mmm a / test / Generics / invalid . swift <nl> ppp b / test / Generics / invalid . swift <nl> protocol P1 { <nl> associatedtype C where ThisTypeDoesNotExist = = ThisTypeDoesNotExist <nl> / / expected - error @ - 1 2 { { use of undeclared type ' ThisTypeDoesNotExist ' } } <nl> } <nl> + <nl> + / / Diagnostic referred to the wrong type - < rdar : / / problem / 33604221 > <nl> + <nl> + protocol E { associatedtype XYZ } <nl> + <nl> + class P < N > { <nl> + func q < A > ( b : A ) where A : E , N : A . XYZ { return } <nl> + / / expected - error @ - 1 { { type ' N ' constrained to non - protocol , non - class type ' A . XYZ ' } } <nl> + } <nl> mmm a / test / Sema / circular_decl_checking . swift <nl> ppp b / test / Sema / circular_decl_checking . swift <nl> var TopLevelVar : TopLevelVar ? { return nil } / / expected - error 2 { { use of undecl <nl> <nl> / / FIXME : The first error is redundant , isn ' t correct in what it states , and <nl> / / also should be emitted on the inheritance clause . <nl> - protocol AProtocol { / / expected - error { { first type ' Self . e ' in conformance requirement does not refer to a generic parameter or associated type } } <nl> + protocol AProtocol { / / expected - error { { type ' Self . e ' constrained to non - protocol , non - class type ' Self . e ' } } <nl> associatedtype e : e / / expected - error { { inheritance from non - protocol , non - class type ' Self . e ' } } <nl> } <nl> <nl> mmm a / test / attr / attr_specialize . swift <nl> ppp b / test / attr / attr_specialize . swift <nl> public func anotherFuncWithTwoGenericParameters < X : P , Y > ( x : X , y : Y ) { <nl> <nl> @ _specialize ( where T : P ) / / expected - error { { Only same - type and layout requirements are supported by ' _specialize ' attribute } } <nl> @ _specialize ( where T : Int ) / / expected - error { { Only conformances to protocol types are supported by ' _specialize ' attribute } } expected - error { { Only same - type and layout requirements are supported by ' _specialize ' attribute } } <nl> - / / expected - error @ - 1 { { type ' T ' constrained to non - protocol type ' Int ' } } <nl> + / / expected - error @ - 1 { { type ' T ' constrained to non - protocol , non - class type ' Int ' } } <nl> <nl> @ _specialize ( where T : S1 ) / / expected - error { { Only conformances to protocol types are supported by ' _specialize ' attribute } } expected - error { { Only same - type and layout requirements are supported by ' _specialize ' attribute } } <nl> - / / expected - error @ - 1 { { type ' T ' constrained to non - protocol type ' S1 ' } } <nl> + / / expected - error @ - 1 { { type ' T ' constrained to non - protocol , non - class type ' S1 ' } } <nl> @ _specialize ( where T : C1 ) / / expected - error { { Only conformances to protocol types are supported by ' _specialize ' attribute } } expected - error { { Only same - type and layout requirements are supported by ' _specialize ' attribute } } <nl> @ _specialize ( where Int : P ) / / expected - error { { type ' Int ' in conformance requirement does not refer to a generic parameter or associated type } } expected - error { { Only same - type and layout requirements are supported by ' _specialize ' attribute } } expected - error { { too few type parameters are specified in ' _specialize ' attribute ( got 0 , but expected 1 ) } } expected - error { { Missing constraint for ' T ' in ' _specialize ' attribute } } <nl> func funcWithForbiddenSpecializeRequirement < T > ( _ t : T ) { <nl> mmm a / test / decl / protocol / protocols . swift <nl> ppp b / test / decl / protocol / protocols . swift <nl> func test1 ( ) { <nl> <nl> protocol Bogus : Int { } <nl> / / expected - error @ - 1 { { inheritance from non - protocol type ' Int ' } } <nl> - / / expected - error @ - 2 { { type ' Self ' constrained to non - protocol type ' Int ' } } <nl> + / / expected - error @ - 2 { { type ' Self ' constrained to non - protocol , non - class type ' Int ' } } <nl> <nl> / / Explicit conformance checks ( successful ) . <nl> <nl> mmm a / test / decl / protocol / req / unsatisfiable . swift <nl> ppp b / test / decl / protocol / req / unsatisfiable . swift <nl> protocol Base { <nl> / / FIXME : This used to / not / error in Swift 3 . It didn ' t impose any statically - <nl> / / enforced requirements , but the compiler crashed if you used anything but the <nl> / / same type . <nl> - protocol Sub1 : Base { / / expected - error { { first type ' Self . Assoc ' in conformance requirement does not refer to a generic parameter or associated type } } <nl> + protocol Sub1 : Base { / / expected - error { { type ' Self . SubAssoc ' constrained to non - protocol , non - class type ' Self . Assoc ' } } <nl> associatedtype SubAssoc : Assoc / / expected - error { { inheritance from non - protocol , non - class type ' Self . Assoc ' } } <nl> } <nl> / / FIXME : This error is incorrect in what it states and should be emitted on <nl> / / the where - clause . <nl> - protocol Sub2 : Base { / / expected - error { { first type ' Self . Assoc ' in conformance requirement does not refer to a generic parameter or associated type } } <nl> + protocol Sub2 : Base { / / expected - error { { type ' Self . SubAssoc ' constrained to non - protocol , non - class type ' Self . Assoc ' } } <nl> associatedtype SubAssoc where SubAssoc : Assoc <nl> } <nl>
Merge pull request from slavapestov / bogus - generic - signature - diagnostic
apple/swift
6133ffe70ab47535f6d8534e674e50ee9de4f28c
2017-08-01T00:34:02Z
mmm a / stdlib / core / Character . swift <nl> ppp b / stdlib / core / Character . swift <nl> public enum Character : <nl> } <nl> } <nl> <nl> + internal struct _SmallUTF8 : CollectionType { <nl> + init ( var _ u8 : UInt64 ) { <nl> + let count = Character . _smallSize ( u8 ) <nl> + _sanityCheck ( count < = 8 , " Character with more than 8 UTF - 8 code units " ) <nl> + self . count = UInt16 ( count ) <nl> + self . data = u8 <nl> + } <nl> + <nl> + / / / The position of the first element in a non - empty collection . <nl> + / / / <nl> + / / / Identical to ` endIndex ` in an empty collection . <nl> + var startIndex : Int { <nl> + return 0 <nl> + } <nl> + <nl> + / / / The collection ' s " past the end " position . <nl> + / / / <nl> + / / / ` endIndex ` is not a valid argument to ` subscript ` , and is always <nl> + / / / reachable from ` startIndex ` by zero or more applications of <nl> + / / / ` successor ( ) ` . <nl> + var endIndex : Int { <nl> + return Int ( count ) <nl> + } <nl> + <nl> + / / / Access the code unit at ` position ` . <nl> + / / / <nl> + / / / Requires : ` position ` is a valid position in ` self ` and <nl> + / / / ` position ! = endIndex ` . <nl> + subscript ( position : Int ) - > UTF8 . CodeUnit { <nl> + _sanityCheck ( position > = 0 ) <nl> + _sanityCheck ( position < Int ( count ) ) <nl> + / / Note : using unchecked arthmetic because overflow can not happen if the <nl> + / / above sanity checks hold . <nl> + return UTF8 . CodeUnit ( <nl> + truncatingBitPattern : data > > ( UInt64 ( position ) & * 8 ) ) <nl> + } <nl> + <nl> + / / / Return a * generator * over the elements of this * sequence * . <nl> + / / / <nl> + / / / Complexity : O ( 1 ) <nl> + func generate ( ) - > IndexingGenerator < _SmallUTF8 > { <nl> + return IndexingGenerator ( self ) <nl> + } <nl> + <nl> + var count : UInt16 <nl> + var data : UInt64 <nl> + } <nl> + <nl> internal struct _SmallUTF16Sink : SinkType { <nl> mutating func put ( x : UTF16 . CodeUnit ) { <nl> u16 = u16 < < 16 <nl> public enum Character : <nl> let count = UTF16 . measure ( <nl> UTF8 . self , input : Character . _makeSmallUTF8Generator ( u8 ) , <nl> repairIllFormedSequences : true ) ! . 0 <nl> - _sanityCheck ( count < = 4 , " Character with more than 4 UTF16 code units " ) <nl> + _sanityCheck ( count < = 4 , " Character with more than 4 UTF - 16 code units " ) <nl> self . count = UInt16 ( count ) <nl> var output = _SmallUTF16Sink ( ) <nl> transcode ( <nl> public enum Character : <nl> var startIndex : Int { <nl> return 0 <nl> } <nl> - <nl> + <nl> / / / The collection ' s " past the end " position . <nl> / / / <nl> / / / ` endIndex ` is not a valid argument to ` subscript ` , and is always <nl> public enum Character : <nl> var endIndex : Int { <nl> return Int ( count ) <nl> } <nl> - <nl> + <nl> / / / Access the code unit at ` position ` . <nl> / / / <nl> / / / Requires : ` position ` is a valid position in ` self ` and <nl> public enum Character : <nl> func generate ( ) - > IndexingGenerator < _SmallUTF16 > { <nl> return IndexingGenerator ( self ) <nl> } <nl> - <nl> + <nl> var count : UInt16 <nl> var data : UInt64 <nl> } <nl> - <nl> + <nl> / / / The hash value . <nl> / / / <nl> / / / * * Axiom : * * ` x = = y ` implies ` x . hashValue = = y . hashValue ` <nl> extension String { <nl> public init ( _ c : Character ) { <nl> switch c { <nl> case . SmallRepresentation ( var _63bits ) : <nl> - var value = Character . _smallValue ( _63bits ) <nl> - var size = Character . _smallSize ( value ) <nl> + let value = Character . _smallValue ( _63bits ) <nl> + let smallUTF8 = Character . _SmallUTF8 ( value ) <nl> self = String . _fromWellFormedCodeUnitSequence ( <nl> - UTF8 . self , <nl> - input : UnsafeBufferPointer ( <nl> - start : UnsafeMutablePointer < UTF8 . CodeUnit > ( <nl> - Builtin . addressof ( & value ) ) , <nl> - count : size ) ) <nl> + UTF8 . self , input : smallUTF8 ) <nl> case . LargeRepresentation ( var value ) : <nl> self = value . _value <nl> } <nl>
stdlib : remove an invalid cast in Character implementation
apple/swift
b8186229d092167525047e01e50f10d825b2b2ca
2014-10-03T15:14:42Z
mmm a / modules / gapi / include / opencv2 / gapi / util / variant . hpp <nl> ppp b / modules / gapi / include / opencv2 / gapi / util / variant . hpp <nl> namespace util <nl> static const constexpr std : : size_t value = I ; <nl> } ; <nl> <nl> - <nl> - template < class T , class U , class V > using are_different = <nl> - std : : enable_if < ! std : : is_same < typename std : : decay < T > : : type , <nl> - typename std : : decay < U > : : type > : : value , <nl> - V > ; <nl> + template < bool B , class T = void > <nl> + using enable_if_t = typename std : : enable_if < B , T > : : type ; <nl> + <nl> + template < class T , class U , class V = void > <nl> + using are_different_t = enable_if_t < <nl> + ! std : : is_same < typename std : : decay < T > : : type , <nl> + typename std : : decay < U > : : type > : : value , <nl> + V > ; <nl> } <nl> <nl> template < typename Target , typename . . . Types > <nl> namespace util <nl> variant ( const variant & other ) ; <nl> variant ( variant & & other ) noexcept ; <nl> template < typename T > explicit variant ( const T & t ) ; <nl> - / / are_different is a SFINAE trick to avoid variant ( T & & t ) with T = variant <nl> + / / are_different_t is a SFINAE trick to avoid variant ( T & & t ) with T = variant <nl> / / for some reason , this version is called instead of variant ( variant & & o ) when <nl> - / / variant is used in STL containers ( examples : vector assignment ) <nl> - template < typename T > explicit variant ( T & & t , typename detail : : are_different < variant , T , int > : : type = 0 ) ; <nl> + / / variant is used in STL containers ( examples : vector assignment ) . <nl> + / / detail : : enable_if_t < ! std : : is_lvalue_reference < T > : : value > is a SFINAE <nl> + / / trick to limit this constructor only to rvalue reference argument <nl> + template < <nl> + typename T , <nl> + typename = detail : : are_different_t < variant , T > , <nl> + typename = detail : : enable_if_t < ! std : : is_lvalue_reference < T > : : value > <nl> + > <nl> + explicit variant ( T & & t ) ; <nl> / / template < class T , class . . . Args > explicit variant ( Args & & . . . args ) ; <nl> / / FIXME : other constructors <nl> <nl> namespace util <nl> variant & operator = ( variant & & rhs ) noexcept ; <nl> <nl> / / SFINAE trick to avoid operator = ( T & & ) with T = variant < > , see comment above <nl> - template < class T > <nl> - typename detail : : are_different < variant , T , variant & > <nl> - : : type operator = ( T & & t ) noexcept ; <nl> + template < <nl> + typename T , <nl> + typename = detail : : are_different_t < variant , T > <nl> + > <nl> + variant & operator = ( T & & t ) noexcept ; <nl> <nl> / / Observers <nl> std : : size_t index ( ) const noexcept ; <nl> namespace util <nl> } <nl> <nl> template < typename . . . Ts > <nl> - template < class T > <nl> - variant < Ts . . . > : : variant ( T & & t , typename detail : : are_different < variant , T , int > : : type ) <nl> + template < class T , typename , typename > <nl> + variant < Ts . . . > : : variant ( T & & t ) <nl> : m_index ( util : : type_list_index < typename std : : remove_reference < T > : : type , Ts . . . > : : value ) <nl> { <nl> ( mctrs ( ) [ m_index ] ) ( memory , & t ) ; <nl> namespace util <nl> } <nl> <nl> template < typename . . . Ts > <nl> - template < class T > typename detail : : are_different < variant < Ts . . . > , T , variant < Ts . . . > & > <nl> - : : type variant < Ts . . . > : : operator = ( T & & t ) noexcept <nl> + template < typename T , typename > <nl> + variant < Ts . . . > & variant < Ts . . . > : : operator = ( T & & t ) noexcept <nl> { <nl> using decayed_t = typename std : : decay < T > : : type ; <nl> / / FIXME : No version with implicit type conversion available ! <nl> namespace util <nl> <nl> if ( t_index = = m_index ) <nl> { <nl> - util : : get < decayed_t > ( * this ) = std : : move ( t ) ; <nl> + util : : get < decayed_t > ( * this ) = std : : forward < T > ( t ) ; <nl> return * this ; <nl> } <nl> - else return ( * this = variant ( std : : move ( t ) ) ) ; <nl> + else return ( * this = variant ( std : : forward < T > ( t ) ) ) ; <nl> } <nl> <nl> template < typename . . . Ts > <nl> mmm a / modules / gapi / test / util / variant_tests . cpp <nl> ppp b / modules / gapi / test / util / variant_tests . cpp <nl> TEST ( Variant , EmptyCTor ) <nl> EXPECT_EQ ( " " , util : : get < std : : string > ( vsi ) ) ; <nl> } <nl> <nl> - TEST ( Variant , ValueMoveCTor ) <nl> + TEST ( Variant , ConvertingCTorMove ) <nl> { <nl> util : : variant < int > vi ( 42 ) ; <nl> EXPECT_EQ ( 0u , vi . index ( ) ) ; <nl> TEST ( Variant , ValueMoveCTor ) <nl> EXPECT_EQ ( 0u , vsi . index ( ) ) ; <nl> EXPECT_EQ ( " 2017 " , util : : get < std : : string > ( vsi ) ) ; <nl> <nl> + std : : string rvs ( " 2017 " ) ; <nl> + util : : variant < std : : string , int > vsi3 ( std : : move ( rvs ) ) ; <nl> + EXPECT_EQ ( 0u , vsi3 . index ( ) ) ; <nl> + EXPECT_EQ ( " 2017 " , util : : get < std : : string > ( vsi3 ) ) ; <nl> + EXPECT_EQ ( " " , rvs ) < < " Rvalue source argument was not moved from while should ? " ; <nl> + <nl> util : : variant < std : : string , int > vsi2 ( 42 ) ; <nl> EXPECT_EQ ( 1u , vsi2 . index ( ) ) ; <nl> EXPECT_EQ ( 42 , util : : get < int > ( vsi2 ) ) ; <nl> } <nl> <nl> - TEST ( Variant , ValueCopyCTor ) <nl> + TEST ( Variant , ConvertingCTorCopy ) <nl> { <nl> const int i42 = 42 ; <nl> const int i17 = 2017 ; <nl> const std : : string s17 = " 2017 " ; <nl> + std : : string s17_lvref = s17 ; <nl> <nl> util : : variant < int > vi ( i42 ) ; <nl> EXPECT_EQ ( 0u , vi . index ( ) ) ; <nl> TEST ( Variant , ValueCopyCTor ) <nl> EXPECT_EQ ( 0u , vs . index ( ) ) ; <nl> EXPECT_EQ ( s17 , util : : get < std : : string > ( vs ) ) ; <nl> <nl> + util : : variant < std : : string > vs_lv ( s17_lvref ) ; <nl> + EXPECT_EQ ( 0u , vs_lv . index ( ) ) ; <nl> + EXPECT_EQ ( s17 , s17_lvref ) ; <nl> + EXPECT_EQ ( s17_lvref , util : : get < std : : string > ( vs_lv ) ) ; <nl> + <nl> util : : variant < std : : string , int > vsi ( s17 ) ; <nl> EXPECT_EQ ( 0u , vsi . index ( ) ) ; <nl> EXPECT_EQ ( s17 , util : : get < std : : string > ( vsi ) ) ; <nl> TEST ( Variant , Assign_ValueUpdate_DiffType ) <nl> EXPECT_EQ ( " 42 " , util : : get < std : : string > ( vis ) ) ; <nl> } <nl> <nl> + TEST ( Variant , Assign_RValueRef_DiffType ) <nl> + { <nl> + TestVar vis ( 42 ) ; <nl> + <nl> + EXPECT_EQ ( 0u , vis . index ( ) ) ; <nl> + EXPECT_EQ ( 42 , util : : get < int > ( vis ) ) ; <nl> + <nl> + std : : string s ( " 42 " ) ; <nl> + vis = std : : move ( s ) ; <nl> + EXPECT_EQ ( 1u , vis . index ( ) ) ; <nl> + EXPECT_EQ ( " 42 " , util : : get < std : : string > ( vis ) ) ; <nl> + EXPECT_EQ ( " " , s ) < < " right hand side argument of assignment operation was not moved from while should ? " ; ; <nl> + } <nl> + <nl> TEST ( Variant , Assign_LValueRef_DiffType ) <nl> { <nl> TestVar vis ( 42 ) ; <nl> TEST ( Variant , Assign_LValueRef_DiffType ) <nl> vis = s ; <nl> EXPECT_EQ ( 1u , vis . index ( ) ) ; <nl> EXPECT_EQ ( " 42 " , util : : get < std : : string > ( vis ) ) ; <nl> + EXPECT_EQ ( " 42 " , s ) < < " right hand side argument of assignment operation was moved from while should not ? " ; <nl> } <nl> <nl> TEST ( Variant , Assign_ValueUpdate_Const ) <nl> TEST ( Variant , Assign_ValueUpdate_Const_DiffType ) <nl> EXPECT_EQ ( " 42 " , util : : get < std : : string > ( va ) ) ; <nl> } <nl> <nl> - TEST ( Variant , Assign_Move ) <nl> + TEST ( Variant , Assign_Move_Variant ) <nl> { <nl> TestVar va ( 42 ) ; <nl> TestVar vb ( std : : string ( " 42 " ) ) ; <nl>
G - API utils - make variant converting constructor and assignment
opencv/opencv
faceb057755166fac98987b64b732ee781d36722
2020-03-27T11:30:16Z
mmm a / docs / . current_minor_release_number <nl> ppp b / docs / . current_minor_release_number <nl> @ @ - 1 + 1 @ @ <nl> - 6 <nl> + 7 <nl> mmm a / docs / . logger_revnum <nl> ppp b / docs / . logger_revnum <nl> @ @ - 1 + 1 @ @ <nl> - 2356 <nl> + 2441 <nl>
made a release
davisking/dlib
0d5b3ed1e189f58bea05736124f081e56724028c
2008-07-25T15:22:07Z
mmm a / modules / perception / model / tracker . config <nl> ppp b / modules / perception / model / tracker . config <nl> model_configs { <nl> } <nl> integer_params { <nl> name : " track_cached_history_size_maximum " <nl> - value : 20 <nl> + value : 5 <nl> } <nl> integer_params { <nl> name : " track_consecutive_invisible_maximum " <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / base_matcher . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / base_matcher . h <nl> class BaseMatcher { <nl> / / @ params [ IN ] objects : detected objects <nl> / / @ params [ IN ] tracks : maintained tracks <nl> / / @ params [ IN ] tracks_predict : predicted states of maintained tracks <nl> - / / @ params [ IN ] time_diff : time interval from last match <nl> / / @ params [ OUT ] assignments : matched pair of < track , object > <nl> / / @ params [ OUT ] unassigned_tracks : unmatched tracks <nl> / / @ params [ OUT ] unassigned_objects : unmatched objects <nl> class BaseMatcher { <nl> std : : vector < TrackedObjectPtr > * objects , <nl> const std : : vector < ObjectTrackPtr > & tracks , <nl> const std : : vector < Eigen : : VectorXf > & tracks_predict , <nl> - const double & time_diff , <nl> std : : vector < TrackObjectPair > * assignments , <nl> std : : vector < int > * unassigned_tracks , <nl> std : : vector < int > * unassigned_objects ) = 0 ; <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / hm_tracker . cc <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / hm_tracker . cc <nl> bool HmObjectTracker : : Init ( ) { <nl> / / A . Basic tracker setup <nl> std : : string matcher_method_name = " hungarian_matcher " ; <nl> std : : string filter_method_name = " kalman_filter " ; <nl> - int track_cached_history_size_maximum = 20 ; <nl> + int track_cached_history_size_maximum = 5 ; <nl> int track_consecutive_invisible_maximum = 1 ; <nl> float track_visible_ratio_minimum = 0 . 6 ; <nl> int collect_age_minimum = 0 ; <nl> bool HmObjectTracker : : Init ( ) { <nl> } <nl> if ( matcher_method_ = = HUNGARIAN_MATCHER ) { <nl> matcher_ = new HungarianMatcher ( ) ; <nl> + } else { <nl> + matcher_method_ = HUNGARIAN_MATCHER ; <nl> + matcher_ = new HungarianMatcher ( ) ; <nl> + AWARN < < " invalid matcher method ! default HungarianMatcher in use ! " ; <nl> } <nl> / / load filter method <nl> if ( ! model_config - > GetValue ( " filter_method_name " , & filter_method_name ) ) { <nl> bool HmObjectTracker : : Track ( const std : : vector < ObjectPtr > & objects , <nl> std : : vector < int > unassigned_objects ; <nl> std : : vector < int > unassigned_tracks ; <nl> std : : vector < ObjectTrackPtr > & tracks = object_tracks_ . GetTracks ( ) ; <nl> - matcher_ - > Match ( & transformed_objects , tracks , tracks_predict , time_diff , <nl> + matcher_ - > Match ( & transformed_objects , tracks , tracks_predict , <nl> & assignments , & unassigned_tracks , & unassigned_objects ) ; <nl> ADEBUG < < " multi - object - tracking : " < < tracks . size ( ) < < " " <nl> < < assignments . size ( ) < < " " < < transformed_objects . size ( ) < < " " <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / hm_tracker . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / hm_tracker . h <nl> class HmObjectTracker : public BaseTracker { <nl> / / @ brief collect tracked results <nl> / / @ params [ OUT ] tracked_objects : tracked objects with tracking information <nl> / / @ return nothing <nl> - void CollectTrackedResults ( std : : vector < ObjectPtr > * tracked_objects ) ; <nl> + void CollectTrackedResults ( <nl> + std : : vector < ObjectPtr > * tracked_objects ) ; <nl> <nl> private : <nl> / / algorithm setup <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / hungarian_matcher . cc <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / hungarian_matcher . cc <nl> bool HungarianMatcher : : SetMatchDistanceMaximum ( <nl> void HungarianMatcher : : Match ( std : : vector < TrackedObjectPtr > * objects , <nl> const std : : vector < ObjectTrackPtr > & tracks , <nl> const std : : vector < Eigen : : VectorXf > & tracks_predict , <nl> - const double & time_diff , <nl> std : : vector < TrackObjectPair > * assignments , <nl> std : : vector < int > * unassigned_tracks , <nl> std : : vector < int > * unassigned_objects ) { <nl> void HungarianMatcher : : Match ( std : : vector < TrackedObjectPtr > * objects , <nl> std : : vector < TrackObjectPair > sub_assignments ; <nl> std : : vector < int > sub_unassigned_tracks ; <nl> std : : vector < int > sub_unassigned_objects ; <nl> - MatchComponents ( association_mat , track_components [ i ] , object_components [ i ] , <nl> - & sub_assignments , & sub_unassigned_tracks , <nl> - & sub_unassigned_objects ) ; <nl> + MatchInComponents ( association_mat , track_components [ i ] , object_components [ i ] , <nl> + & sub_assignments , & sub_unassigned_tracks , <nl> + & sub_unassigned_objects ) ; <nl> for ( size_t j = 0 ; j < sub_assignments . size ( ) ; + + j ) { <nl> int track_id = sub_assignments [ j ] . first ; <nl> int object_id = sub_assignments [ j ] . second ; <nl> void HungarianMatcher : : Match ( std : : vector < TrackedObjectPtr > * objects , <nl> } <nl> } <nl> <nl> - void HungarianMatcher : : MatchComponents ( const Eigen : : MatrixXf & association_mat , <nl> + void HungarianMatcher : : MatchInComponents ( const Eigen : : MatrixXf & association_mat , <nl> const std : : vector < int > & track_component , <nl> const std : : vector < int > & object_component , <nl> std : : vector < TrackObjectPair > * sub_assignments , <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / hungarian_matcher . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / hungarian_matcher . h <nl> class HungarianMatcher : public BaseMatcher { <nl> / / @ brief match detected objects to tracks <nl> / / @ params [ IN ] objects : new detected objects for matching <nl> / / @ params [ IN ] tracks : maintaining tracks for matching <nl> - / / @ params [ IN ] time_diff : time interval from last matching <nl> + / / @ params [ IN ] tracks_predict : predicted state of maintained tracks <nl> / / @ params [ OUT ] assignments : assignment pair of object & track <nl> / / @ params [ OUT ] unassigned_tracks : tracks without matched object <nl> / / @ params [ OUT ] unassigned_objects : objects without matched track <nl> class HungarianMatcher : public BaseMatcher { <nl> std : : vector < TrackedObjectPtr > * objects , <nl> const std : : vector < ObjectTrackPtr > & tracks , <nl> const std : : vector < Eigen : : VectorXf > & tracks_predict , <nl> - const double & time_diff , <nl> std : : vector < TrackObjectPair > * assignments , <nl> std : : vector < int > * unassigned_tracks , <nl> std : : vector < int > * unassigned_objects ) ; <nl> class HungarianMatcher : public BaseMatcher { <nl> / / @ params [ OUT ] sub_assignments : component assignment pair of object & track <nl> / / @ params [ OUT ] sub_unassigned_tracks : component tracks not matched <nl> / / @ params [ OUT ] sub_unasgined_objects : component objects not matched <nl> - void MatchComponents ( <nl> + / / @ return nothing <nl> + void MatchInComponents ( <nl> const Eigen : : MatrixXf & association_mat , <nl> const std : : vector < int > & track_component , <nl> const std : : vector < int > & obj_component , <nl> class HungarianMatcher : public BaseMatcher { <nl> / / @ params [ IN ] tracks : maintained tracks for matching <nl> / / @ params [ IN ] tracks_predict : predicted states of maintained tracks <nl> / / @ params [ IN ] new_objects : recently detected objects <nl> - / / @ params [ IN ] time_diff : time interval from last matching <nl> / / @ params [ OUT ] association_mat : matrix of association distance <nl> / / @ return nothing <nl> void ComputeAssociateMatrix ( <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / kalman_filter . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / kalman_filter . h <nl> class KalmanFilter : public BaseFilter { <nl> <nl> / / @ brief select measured velocity among candidates <nl> / / @ params [ IN ] candidates : candidates of measured velocity <nl> - / / @ return measured velocity <nl> + / / @ return selected measurement of velocity <nl> Eigen : : Vector3f SelectMeasuredVelocity ( <nl> const std : : vector < Eigen : : Vector3f > & candidates ) ; <nl> <nl> / / @ brief select measured velocity among candidates according motion <nl> / / consistency <nl> / / @ params [ IN ] candidates : candidates of measured velocity <nl> - / / @ return measured velocity <nl> + / / @ return selected measurement of velocity <nl> Eigen : : Vector3f SelectMeasuredVelocityAccordingMotionConsistency ( <nl> const std : : vector < Eigen : : Vector3f > & candidates ) ; <nl> <nl> class KalmanFilter : public BaseFilter { <nl> const TrackedObjectPtr & new_object ) ; <nl> <nl> / / @ brief compute update quality by using association score <nl> + / / @ params [ IN ] old_object : old object for last updaitng <nl> / / @ params [ IN ] new_object : new object for current updating <nl> / / @ return update quality according point number change <nl> float ComputeUpdateQualityAccordingPointNumChange ( <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / object_track . cc <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / object_track . cc <nl> int ObjectTrack : : s_track_idx_ = 0 ; <nl> FilterType ObjectTrack : : s_filter_method_ = KALMAN_FILTER ; <nl> int ObjectTrackSet : : s_track_consecutive_invisible_maximum_ = 1 ; <nl> float ObjectTrackSet : : s_track_visible_ratio_minimum_ = 0 . 6 ; <nl> - int ObjectTrack : : s_track_cached_history_size_maximum_ = 20 ; <nl> + int ObjectTrack : : s_track_cached_history_size_maximum_ = 5 ; <nl> double ObjectTrack : : s_acceleration_noise_maximum_ = 5 ; <nl> double ObjectTrack : : s_speed_noise_maximum_ = 0 . 4 ; <nl> <nl> ObjectTrack : : ObjectTrack ( TrackedObjectPtr obj ) { <nl> Eigen : : Vector3f initial_velocity = Eigen : : Vector3f : : Zero ( ) ; <nl> if ( s_filter_method_ = = KALMAN_FILTER ) { <nl> filter_ = new KalmanFilter ( ) ; <nl> + } else { <nl> + filter_ = new KalmanFilter ( ) ; <nl> + AWARN < < " invalid filter method ! default filter ( KalmanFilter ) in use ! " ; <nl> } <nl> filter_ - > Initialize ( initial_anchor_point , initial_velocity ) ; <nl> <nl> void ObjectTrack : : UpdateWithoutObject ( const double & time_diff ) { <nl> / / D . update states of track <nl> belief_anchor_point_ = new_obj - > anchor_point ; <nl> / / NEED TO NOTICE : All the states would be collected mainly based on states <nl> - / / of tracked object included temporaryly occluded ones . Thus , update <nl> - / / tracked object when you update the state of track ! ! ! ! <nl> + / / of tracked object . Thus , update tracked object when you update the state <nl> + / / of track ! ! ! ! <nl> new_obj - > velocity = belief_velocity_ ; <nl> <nl> / / E . update track info <nl> void ObjectTrack : : UpdateWithoutObject ( const Eigen : : VectorXf & predict_state , <nl> / / D . update states of track <nl> belief_anchor_point_ = new_obj - > anchor_point ; <nl> / / NEED TO NOTICE : All the states would be collected mainly based on states <nl> - / / of tracked object included temporaryly occluded ones . Thus , update <nl> - / / tracked object when you update the state of track ! ! ! ! <nl> + / / of tracked object . Thus , update tracked object when you update the state <nl> + / / of track ! ! ! ! <nl> new_obj - > velocity = belief_velocity_ ; <nl> <nl> / / E . update track info <nl> void ObjectTrack : : SmoothTrackVelocity ( const TrackedObjectPtr & new_object , <nl> } <nl> belief_velocity_ = last_velocity ; <nl> belief_velocity_accelaration_ = Eigen : : Vector3f : : Zero ( ) ; <nl> - / / NEED TO NOTICE : All the states would be collected mainly based on <nl> - / / states of tracked object included temporaryly occluded ones . Thus , <nl> - / / update tracked object when you update the state of track ! ! ! ! <nl> + / / NEED TO NOTICE : All the states would be collected mainly based on states <nl> + / / of tracked object . Thus , update tracked object when you update the state <nl> + / / of track ! ! ! ! <nl> current_object_ - > velocity = belief_velocity_ ; <nl> / / keep static hypothesis <nl> return ; <nl> void ObjectTrack : : SmoothTrackVelocity ( const TrackedObjectPtr & new_object , <nl> if ( is_static_hypothesis_ ) { <nl> belief_velocity_ = Eigen : : Vector3f : : Zero ( ) ; <nl> belief_velocity_accelaration_ = Eigen : : Vector3f : : Zero ( ) ; <nl> - / / NEED TO NOTICE : All the states would be collected mainly based on <nl> - / / states of tracked object included temporaryly occluded ones . Thus , <nl> - / / update tracked object when you update the state of track ! ! ! ! <nl> + / / NEED TO NOTICE : All the states would be collected mainly based on states <nl> + / / of tracked object . Thus , update tracked object when you update the state <nl> + / / of track ! ! ! ! <nl> current_object_ - > velocity = belief_velocity_ ; <nl> } <nl> } <nl> bool ObjectTrack : : CheckTrackStaticHypothesis ( const ObjectPtr & new_object , <nl> if ( velocity_is_noise ) { <nl> return true ; <nl> } <nl> - / / Need to notice : claping small velocity may not reasonable when the true <nl> + / / NEED TO NOTICE : claping small velocity may not reasonable when the true <nl> / / velocity of target object is really small . e . g . a moving out vehicle in <nl> / / a parking lot . Thus , instead of clapping all the small velocity , we clap <nl> / / those whose history trajectory or performance is close to a static one . <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / object_track . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / object_track . h <nl> class ObjectTrackSet { <nl> } <nl> <nl> / / @ brief add track to current set of maintained tracks <nl> + / / @ params [ IN ] track : adding track <nl> / / @ return nothing <nl> - void AddTrack ( const ObjectTrackPtr & track ) { <nl> + void AddTrack ( <nl> + const ObjectTrackPtr & track ) { <nl> tracks_ . push_back ( track ) ; <nl> } <nl> <nl> mmm a / modules / perception / obstacle / lidar / tracker / hm_tracker / track_object_distance . h <nl> ppp b / modules / perception / obstacle / lidar / tracker / hm_tracker / track_object_distance . h <nl> class TrackObjectDistance { <nl> / / @ params [ IN ] track : track for < track , object > distance computing <nl> / / @ params [ IN ] track_predict : predicted state of given track <nl> / / @ params [ IN ] new_object : recently detected object <nl> - / / @ return nothing <nl> + / / @ return computed < track , object > distance <nl> static float ComputeDistance ( <nl> const ObjectTrackPtr & track , <nl> const Eigen : : VectorXf & track_predict , <nl>
Hm tracker bug fix dev ( )
ApolloAuto/apollo
eb79e3ac5f71ee1ddb9886dee21b549d6e99b02f
2017-09-07T18:01:40Z
mmm a / tensorflow / lite / delegates / gpu / cl / tensor_type . cc <nl> ppp b / tensorflow / lite / delegates / gpu / cl / tensor_type . cc <nl> absl : : Status TensorDescriptor : : PerformSelector ( <nl> * result = " channels " ; <nl> return absl : : OkStatus ( ) ; <nl> } else if ( selector = = " Batch " ) { <nl> - * result = " batch " ; <nl> + if ( HasAxis ( Axis : : BATCH ) ) { <nl> + * result = " batch " ; <nl> + } else { <nl> + * result = " 1 " ; <nl> + } <nl> return absl : : OkStatus ( ) ; <nl> } else if ( selector = = " Depth " ) { <nl> * result = " depth " ; <nl>
Added possibility to use BHWC tensor method Batch with HWC tensor .
tensorflow/tensorflow
d5f7397a1accf4f090181f7284a641e6c56ccb31
2020-08-01T01:59:54Z
mmm a / libs / imageio / src / BlockCompression . cpp <nl> ppp b / libs / imageio / src / BlockCompression . cpp <nl> <nl> # define STB_DXT_IMPLEMENTATION <nl> # include < stb_dxt . h > <nl> <nl> - using namespace image ; <nl> - <nl> - using std : : string ; <nl> - <nl> namespace image { <nl> <nl> static LinearImage extendToFourChannels ( LinearImage source ) ; <nl> CompressedTexture astcCompress ( const LinearImage & original , AstcConfig config ) { <nl> } ; <nl> } <nl> <nl> - AstcConfig astcParseOptionString ( const string & configString ) { <nl> + AstcConfig astcParseOptionString ( const std : : string & configString ) { <nl> const size_t _1 = configString . find ( ' _ ' ) ; <nl> const size_t _2 = configString . find ( ' _ ' , _1 + 1 ) ; <nl> - if ( _1 = = string : : npos | | _2 = = string : : npos ) { <nl> + if ( _1 = = std : : string : : npos | | _2 = = std : : string : : npos ) { <nl> return { } ; <nl> } <nl> - string quality = configString . substr ( 0 , _1 ) ; <nl> - string semantic = configString . substr ( _1 + 1 , _2 - _1 - 1 ) ; <nl> - string blocksize = configString . substr ( _2 + 1 ) ; <nl> + std : : string quality = configString . substr ( 0 , _1 ) ; <nl> + std : : string semantic = configString . substr ( _1 + 1 , _2 - _1 - 1 ) ; <nl> + std : : string blocksize = configString . substr ( _2 + 1 ) ; <nl> AstcConfig config ; <nl> if ( quality = = " veryfast " ) { <nl> config . quality = AstcPreset : : VERYFAST ; <nl> AstcConfig astcParseOptionString ( const string & configString ) { <nl> } <nl> <nl> const size_t _x = blocksize . find ( ' x ' ) ; <nl> - if ( _x = = string : : npos ) { <nl> + if ( _x = = std : : string : : npos ) { <nl> return { } ; <nl> } <nl> config . blocksize [ 0 ] = std : : stoi ( blocksize . substr ( 0 , _x ) ) ; <nl> EtcConfig etcParseOptionString ( const std : : string & options ) { <nl> return result ; <nl> } <nl> <nl> - bool parseOptionString ( const string & options , CompressionConfig * config ) { <nl> + bool parseOptionString ( const std : : string & options , CompressionConfig * config ) { <nl> config - > type = CompressionConfig : : INVALID ; <nl> if ( options . substr ( 0 , 5 ) = = " astc_ " ) { <nl> config - > astc = astcParseOptionString ( options . substr ( 5 ) ) ; <nl>
Remove using std : : string ( )
google/filament
aa980682e61e6239b1c79a2b937b04a7fc0629ea
2018-10-09T17:34:12Z
mmm a / hphp / util / sparse - id - containers . h <nl> ppp b / hphp / util / sparse - id - containers . h <nl> struct sparse_id_map { <nl> ~ sparse_id_map ( ) { <nl> if ( ! m_universe_size ) return ; <nl> if ( ! std : : is_trivially_destructible < V > : : value ) { <nl> - for ( auto kv : * this ) { <nl> + for ( auto & kv : * this ) { <nl> kv . ~ value_type ( ) ; <nl> } <nl> } <nl> struct sparse_id_map { <nl> * / <nl> void clear ( ) { <nl> if ( ! std : : is_trivially_destructible < V > : : value ) { <nl> - for ( auto kv : * this ) { <nl> + for ( auto & kv : * this ) { <nl> kv . ~ value_type ( ) ; <nl> } <nl> } <nl> struct sparse_id_map { <nl> bool operator = = ( const sparse_id_map & o ) const { <nl> if ( universe_size ( ) ! = o . universe_size ( ) ) return false ; <nl> if ( size ( ) ! = o . size ( ) ) return false ; <nl> - for ( auto kv : * this ) { <nl> + for ( auto & kv : * this ) { <nl> if ( ! o . containsImpl ( kv . first ) ) return false ; <nl> if ( ! ( o . dense ( ) [ o . sparse ( ) [ kv . first ] ] . second = = kv . second ) ) { <nl> return false ; <nl>
Fix bugs in sparse - id - containers
facebook/hhvm
7c3b85353c424d17385fe174f2c0d14ec046f9c8
2015-01-26T20:00:30Z
mmm a / src / core / lib / iomgr / tcp_server_posix . c <nl> ppp b / src / core / lib / iomgr / tcp_server_posix . c <nl> grpc_error * grpc_tcp_server_add_port ( grpc_tcp_server * s , const void * addr , <nl> if ( port = = 0 & & sp ! = NULL ) { <nl> grpc_sockaddr_set_port ( ( struct sockaddr * ) & wild4 , sp - > port ) ; <nl> } <nl> - addr = ( struct sockaddr * ) & wild4 ; <nl> - addr_len = sizeof ( wild4 ) ; <nl> } <nl> + addr = ( struct sockaddr * ) & wild4 ; <nl> + addr_len = sizeof ( wild4 ) ; <nl> } <nl> <nl> errs [ 1 ] = grpc_create_dualstack_socket ( addr , SOCK_STREAM , 0 , & dsmode , & fd ) ; <nl>
Fix ipv4 - only listening
grpc/grpc
161f76304ed6c5198019e8188fddef7db92f4efb
2016-06-09T22:46:53Z
mmm a / stdlib / private / StdlibUnittest / RaceTest . swift <nl> ppp b / stdlib / private / StdlibUnittest / RaceTest . swift <nl> public func consumeCPU ( units amountOfWork : Int ) { <nl> } <nl> <nl> internal struct ClosureBasedRaceTest : RaceTestWithPerTrialData { <nl> - static var thread : ( ) - > ( ) = { } <nl> + static var thread : ( ) - > Void = { } <nl> <nl> class RaceData { } <nl> typealias ThreadLocalData = Void <nl> public func runRaceTest ( <nl> trials : Int , <nl> timeoutInSeconds : Int ? = nil , <nl> threads : Int ? = nil , <nl> - invoking body : @ escaping ( ) - > ( ) <nl> + invoking body : @ escaping ( ) - > Void <nl> ) { <nl> ClosureBasedRaceTest . thread = body <nl> runRaceTest ( ClosureBasedRaceTest . self , trials : trials , <nl> public func runRaceTest ( <nl> operations : Int , <nl> timeoutInSeconds : Int ? = nil , <nl> threads : Int ? = nil , <nl> - invoking body : @ escaping ( ) - > ( ) <nl> + invoking body : @ escaping ( ) - > Void <nl> ) { <nl> ClosureBasedRaceTest . thread = body <nl> runRaceTest ( ClosureBasedRaceTest . self , operations : operations , <nl> mmm a / stdlib / private / SwiftReflectionTest / SwiftReflectionTest . swift <nl> ppp b / stdlib / private / SwiftReflectionTest / SwiftReflectionTest . swift <nl> public func reflect < T : Error > ( error : T ) { <nl> <nl> / / / Wraps a thick function with arity 0 . <nl> struct ThickFunction0 { <nl> - var function : ( ) - > ( ) <nl> + var function : ( ) - > Void <nl> } <nl> <nl> / / / Wraps a thick function with arity 1 . <nl> struct ThickFunction1 { <nl> - var function : ( Int ) - > ( ) <nl> + var function : ( Int ) - > Void <nl> } <nl> <nl> / / / Wraps a thick function with arity 2 . <nl> struct ThickFunction2 { <nl> - var function : ( Int , String ) - > ( ) <nl> + var function : ( Int , String ) - > Void <nl> } <nl> <nl> / / / Wraps a thick function with arity 3 . <nl> struct ThickFunction3 { <nl> - var function : ( Int , String , AnyObject ? ) - > ( ) <nl> + var function : ( Int , String , AnyObject ? ) - > Void <nl> } <nl> <nl> struct ThickFunctionParts { <nl> struct ThickFunctionParts { <nl> <nl> / / / Reflect a closure context . The given function must be a Swift - native <nl> / / / @ convention ( thick ) function value . <nl> - public func reflect ( function : @ escaping ( ) - > ( ) ) { <nl> + public func reflect ( function : @ escaping ( ) - > Void ) { <nl> let fn = UnsafeMutablePointer < ThickFunction0 > . allocate ( <nl> capacity : MemoryLayout < ThickFunction0 > . size ) <nl> fn . initialize ( to : ThickFunction0 ( function : function ) ) <nl> public func reflect ( function : @ escaping ( ) - > ( ) ) { <nl> <nl> / / / Reflect a closure context . The given function must be a Swift - native <nl> / / / @ convention ( thick ) function value . <nl> - public func reflect ( function : @ escaping ( Int ) - > ( ) ) { <nl> + public func reflect ( function : @ escaping ( Int ) - > Void ) { <nl> let fn = <nl> UnsafeMutablePointer < ThickFunction1 > . allocate ( <nl> capacity : MemoryLayout < ThickFunction1 > . size ) <nl> public func reflect ( function : @ escaping ( Int ) - > ( ) ) { <nl> <nl> / / / Reflect a closure context . The given function must be a Swift - native <nl> / / / @ convention ( thick ) function value . <nl> - public func reflect ( function : @ escaping ( Int , String ) - > ( ) ) { <nl> + public func reflect ( function : @ escaping ( Int , String ) - > Void ) { <nl> let fn = UnsafeMutablePointer < ThickFunction2 > . allocate ( <nl> capacity : MemoryLayout < ThickFunction2 > . size ) <nl> fn . initialize ( to : ThickFunction2 ( function : function ) ) <nl> public func reflect ( function : @ escaping ( Int , String ) - > ( ) ) { <nl> <nl> / / / Reflect a closure context . The given function must be a Swift - native <nl> / / / @ convention ( thick ) function value . <nl> - public func reflect ( function : @ escaping ( Int , String , AnyObject ? ) - > ( ) ) { <nl> + public func reflect ( function : @ escaping ( Int , String , AnyObject ? ) - > Void ) { <nl> let fn = UnsafeMutablePointer < ThickFunction3 > . allocate ( <nl> capacity : MemoryLayout < ThickFunction3 > . size ) <nl> fn . initialize ( to : ThickFunction3 ( function : function ) ) <nl> mmm a / stdlib / public / SDK / Dispatch / Block . swift <nl> ppp b / stdlib / public / SDK / Dispatch / Block . swift <nl> public struct DispatchWorkItemFlags : OptionSet , RawRepresentable { <nl> public class DispatchWorkItem { <nl> internal var _block : _DispatchBlock <nl> <nl> - public init ( qos : DispatchQoS = . unspecified , flags : DispatchWorkItemFlags = [ ] , block : @ escaping @ convention ( block ) ( ) - > ( ) ) { <nl> + public init ( qos : DispatchQoS = . unspecified , flags : DispatchWorkItemFlags = [ ] , block : @ escaping @ convention ( block ) ( ) - > Void ) { <nl> _block = _swift_dispatch_block_create_with_qos_class ( <nl> __dispatch_block_flags_t ( rawValue : flags . rawValue ) , <nl> qos . qosClass . rawValue , Int32 ( qos . relativePriority ) , block ) <nl> public class DispatchWorkItem { <nl> <nl> / / Used by DispatchQueue . synchronously < T > to provide a path through <nl> / / dispatch_block_t , as we know the lifetime of the block in question . <nl> - internal init ( flags : DispatchWorkItemFlags = [ ] , noescapeBlock : ( ) - > ( ) ) { <nl> + internal init ( flags : DispatchWorkItemFlags = [ ] , noescapeBlock : ( ) - > Void ) { <nl> _block = _swift_dispatch_block_create_noescape ( <nl> __dispatch_block_flags_t ( rawValue : flags . rawValue ) , noescapeBlock ) <nl> } <nl> mmm a / stdlib / public / SDK / Dispatch / Dispatch . swift <nl> ppp b / stdlib / public / SDK / Dispatch / Dispatch . swift <nl> public enum DispatchTimeoutResult { <nl> / / / dispatch_group <nl> <nl> public extension DispatchGroup { <nl> - public func notify ( qos : DispatchQoS = . unspecified , flags : DispatchWorkItemFlags = [ ] , queue : DispatchQueue , execute work : @ escaping @ convention ( block ) ( ) - > ( ) ) { <nl> + public func notify ( qos : DispatchQoS = . unspecified , flags : DispatchWorkItemFlags = [ ] , queue : DispatchQueue , execute work : @ escaping @ convention ( block ) ( ) - > Void ) { <nl> if # available ( OSX 10 . 10 , iOS 8 . 0 , * ) , qos ! = . unspecified | | ! flags . isEmpty { <nl> let item = DispatchWorkItem ( qos : qos , flags : flags , block : work ) <nl> _swift_dispatch_group_notify ( self , queue , item . _block ) <nl> mmm a / stdlib / public / SDK / Dispatch / Queue . swift <nl> ppp b / stdlib / public / SDK / Dispatch / Queue . swift <nl> public extension DispatchQueue { <nl> } <nl> } <nl> <nl> - private func _syncBarrier ( block : ( ) - > ( ) ) { <nl> + private func _syncBarrier ( block : ( ) - > Void ) { <nl> __dispatch_barrier_sync ( self , block ) <nl> } <nl> <nl> private func _syncHelper < T > ( <nl> - fn : ( ( ) - > ( ) ) - > ( ) , <nl> + fn : ( ( ) - > Void ) - > Void , <nl> execute work : ( ) throws - > T , <nl> rescue : ( ( Error ) throws - > ( T ) ) ) rethrows - > T <nl> { <nl> public extension DispatchQueue { <nl> <nl> @ available ( OSX 10 . 10 , iOS 8 . 0 , * ) <nl> private func _syncHelper < T > ( <nl> - fn : ( DispatchWorkItem ) - > ( ) , <nl> + fn : ( DispatchWorkItem ) - > Void , <nl> flags : DispatchWorkItemFlags , <nl> execute work : ( ) throws - > T , <nl> rescue : ( ( Error ) throws - > ( T ) ) ) rethrows - > T <nl> mmm a / stdlib / public / SDK / Foundation / Data . swift <nl> ppp b / stdlib / public / SDK / Foundation / Data . swift <nl> public struct Data : ReferenceConvertible , Equatable , Hashable , RandomAccessColl <nl> let shift = resultCount - currentCount <nl> let start = subrange . lowerBound <nl> <nl> - self . withUnsafeMutableBytes { ( bytes : UnsafeMutablePointer < UInt8 > ) - > ( ) in <nl> + self . withUnsafeMutableBytes { ( bytes : UnsafeMutablePointer < UInt8 > ) - > Void in <nl> if shift ! = 0 { <nl> let destination = bytes + start + replacementCount <nl> let source = bytes + start + subrangeCount <nl> mmm a / stdlib / public / SDK / Foundation / NSStringAPI . swift <nl> ppp b / stdlib / public / SDK / Foundation / NSStringAPI . swift <nl> extension String { <nl> <nl> / / / Enumerates all the lines in a string . <nl> public func enumerateLines ( <nl> - invoking body : @ escaping ( _ line : String , _ stop : inout Bool ) - > ( ) <nl> + invoking body : @ escaping ( _ line : String , _ stop : inout Bool ) - > Void <nl> ) { <nl> _ns . enumerateLines { <nl> ( line : String , stop : UnsafeMutablePointer < ObjCBool > ) <nl> extension String { <nl> options opts : NSLinguisticTagger . Options = [ ] , <nl> orthography : NSOrthography ? = nil , <nl> invoking body : <nl> - ( String , Range < Index > , Range < Index > , inout Bool ) - > ( ) <nl> + ( String , Range < Index > , Range < Index > , inout Bool ) - > Void <nl> ) { <nl> _ns . enumerateLinguisticTags ( <nl> in : _toNSRange ( range ) , <nl> extension String { <nl> _ body : @ escaping ( <nl> _ substring : String ? , _ substringRange : Range < Index > , <nl> _ enclosingRange : Range < Index > , inout Bool <nl> - ) - > ( ) <nl> + ) - > Void <nl> ) { <nl> _ns . enumerateSubstrings ( in : _toNSRange ( range ) , options : opts ) { <nl> var stop_ = false <nl> extension String { <nl> options opts : NSLinguisticTagger . Options , <nl> orthography : NSOrthography ? , <nl> _ body : <nl> - ( String , Range < Index > , Range < Index > , inout Bool ) - > ( ) <nl> + ( String , Range < Index > , Range < Index > , inout Bool ) - > Void <nl> ) { <nl> fatalError ( " unavailable function can ' t be called " ) <nl> } <nl> extension String { <nl> _ body : ( <nl> _ substring : String ? , _ substringRange : Range < Index > , <nl> _ enclosingRange : Range < Index > , inout Bool <nl> - ) - > ( ) <nl> + ) - > Void <nl> ) { <nl> fatalError ( " unavailable function can ' t be called " ) <nl> } <nl>
prefer ' - > Void ' over ' - > ( ) '
apple/swift
ea5b665afa4088be056aec495b62f65381755834
2017-01-01T01:55:19Z
mmm a / Code / CryEngine / CryAction / GameObjects / GameObject . cpp <nl> ppp b / Code / CryEngine / CryAction / GameObjects / GameObject . cpp <nl> void CGameObject : : FullSerialize ( TSerialize ser ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> bool CGameObject : : NetSerializeEntity ( TSerialize ser , EEntityAspects aspect , uint8 profile , int flags ) <nl> { <nl> - / / Don ' t call the parent CNetEntity : : NetSerializeEntity ( ) as entity components <nl> - / / vector is a duplicate of the CGameObject m_extensions . <nl> - for ( auto & it : m_extensions ) <nl> - if ( ! it . pExtension - > NetSerialize ( ser , aspect , profile , flags ) ) <nl> - return false ; <nl> - return true ; <nl> + return m_pNetEntity - > NetSerializeEntity ( ser , aspect , profile , flags ) ; <nl> } <nl> <nl> NetworkAspectType CGameObject : : GetNetSerializeAspectMask ( ) const <nl> mmm a / Code / CryEngine / CryAction / Network / GameContext . cpp <nl> ppp b / Code / CryEngine / CryAction / Network / GameContext . cpp <nl> ESynchObjectResult CGameContext : : SynchObject ( EntityId entityId , NetworkAspectTyp <nl> NET_PROFILE_SCOPE ( pEntity - > GetClass ( ) - > GetName ( ) , serialize . IsReading ( ) ) ; <nl> NET_PROFILE_SCOPE ( pEntity - > GetName ( ) , serialize . IsReading ( ) ) ; <nl> <nl> - switch ( nAspect ) <nl> - { <nl> - case eEA_GameClientStatic : <nl> - case eEA_GameServerStatic : <nl> - case eEA_GameClientDynamic : <nl> - case eEA_GameServerDynamic : <nl> - case eEA_GameClientA : <nl> - case eEA_GameServerA : <nl> - case eEA_GameClientB : <nl> - case eEA_GameServerB : <nl> - case eEA_GameClientC : <nl> - case eEA_GameServerC : <nl> - case eEA_GameClientD : <nl> - case eEA_GameClientE : <nl> - case eEA_GameClientF : <nl> - case eEA_GameClientG : <nl> - case eEA_GameClientH : <nl> - case eEA_GameClientI : <nl> - case eEA_GameClientJ : <nl> - case eEA_GameServerD : <nl> - case eEA_GameClientK : <nl> - case eEA_GameClientL : <nl> - case eEA_GameClientM : <nl> - case eEA_GameClientN : <nl> - case eEA_GameClientO : <nl> - case eEA_GameClientP : <nl> - case eEA_GameServerE : <nl> - case eEA_Aspect31 : <nl> + if ( nAspect = = eEA_Script ) <nl> + { <nl> + IEntityScriptComponent * pScriptProxy = static_cast < IEntityScriptComponent * > ( pEntity - > GetProxy ( ENTITY_PROXY_SCRIPT ) ) ; <nl> + if ( pScriptProxy ) <nl> { <nl> - NET_PROFILE_SCOPE ( " NetSerialize " , serialize . IsReading ( ) ) ; <nl> + NET_PROFILE_SCOPE ( " ScriptProxy " , serialize . IsReading ( ) ) ; <nl> + pScriptProxy - > GameSerialize ( serialize ) ; <nl> + } <nl> <nl> - if ( ! pEntity - > GetNetEntity ( ) - > NetSerializeEntity ( serialize , ( EEntityAspects ) nAspect , profile , 0 ) ) <nl> - { <nl> - if ( verboseLogging ) <nl> - GameWarning ( " CGameContext : : SynchObject : game fails to serialize aspect % d on profile % d " , BitIndex ( nAspect ) , int ( profile ) ) ; <nl> - NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> - return eSOR_Failed ; <nl> - } <nl> + NET_PROFILE_SCOPE ( " ScriptRMI " , serialize . IsReading ( ) ) ; <nl> + if ( ! m_pScriptRMI - > SerializeScript ( serialize , pEntity ) ) <nl> + { <nl> + if ( verboseLogging ) <nl> + GameWarning ( " CGameContext : : SynchObject : failed to serialize script aspect " ) ; <nl> + NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> + return eSOR_Failed ; <nl> } <nl> - break ; <nl> - case eEA_Physics : <nl> + return eSOR_Ok ; <nl> + } <nl> + <nl> + int pflags = 0 ; <nl> + if ( nAspect = = eEA_Physics & & m_pPhysicsSync & & serialize . IsReading ( ) ) <nl> + { <nl> + if ( m_pPhysicsSync - > IgnoreSnapshot ( ) ) <nl> { <nl> - int pflags = 0 ; <nl> - if ( m_pPhysicsSync & & serialize . IsReading ( ) ) <nl> - { <nl> - if ( m_pPhysicsSync - > IgnoreSnapshot ( ) ) <nl> - { <nl> - NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> - return eSOR_Skip ; <nl> - } <nl> - else if ( m_pPhysicsSync - > NeedToCatchup ( ) ) <nl> - { <nl> - pflags | = ssf_compensate_time_diff ; <nl> - } <nl> - } <nl> - IEntityComponent * pProxy = pEntity - > GetProxy ( ENTITY_PROXY_USER ) ; <nl> - if ( pProxy ) <nl> - { <nl> - NET_PROFILE_SCOPE ( " NetSerialize " , serialize . IsReading ( ) ) ; <nl> - if ( ! pEntity - > GetNetEntity ( ) - > NetSerializeEntity ( serialize , eEA_Physics , profile , pflags ) ) <nl> - { <nl> - if ( verboseLogging ) <nl> - GameWarning ( " CGameContext : : SynchObject : game fails to serialize physics aspect on profile % d " , int ( profile ) ) ; <nl> - NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> - return eSOR_Failed ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - pEntity - > PhysicsNetSerialize ( serialize ) ; <nl> - } <nl> - if ( m_pPhysicsSync & & serialize . IsReading ( ) & & serialize . ShouldCommitValues ( ) ) <nl> - m_pPhysicsSync - > UpdatedEntity ( entityId ) ; <nl> + NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> + return eSOR_Skip ; <nl> } <nl> - break ; <nl> - case eEA_Script : <nl> + else if ( m_pPhysicsSync - > NeedToCatchup ( ) ) <nl> { <nl> - IEntityScriptComponent * pScriptProxy = static_cast < IEntityScriptComponent * > ( pEntity - > GetProxy ( ENTITY_PROXY_SCRIPT ) ) ; <nl> - if ( pScriptProxy ) <nl> - { <nl> - NET_PROFILE_SCOPE ( " ScriptProxy " , serialize . IsReading ( ) ) ; <nl> - pScriptProxy - > GameSerialize ( serialize ) ; <nl> - } <nl> - <nl> - NET_PROFILE_SCOPE ( " ScriptRMI " , serialize . IsReading ( ) ) ; <nl> - if ( ! m_pScriptRMI - > SerializeScript ( serialize , pEntity ) ) <nl> - { <nl> - if ( verboseLogging ) <nl> - GameWarning ( " CGameContext : : SynchObject : failed to serialize script aspect " ) ; <nl> - NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> - return eSOR_Failed ; <nl> - } <nl> + pflags | = ssf_compensate_time_diff ; <nl> } <nl> - break ; <nl> - default : <nl> - ; <nl> - / / GameWarning ( " Unknown aspect % d " , nAspect ) ; <nl> - / / NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> - / / return false ; <nl> } <nl> + <nl> + bool ok = pEntity - > GetNetEntity ( ) - > NetSerializeEntity ( serialize , ( EEntityAspects ) nAspect , profile , 0 ) ; <nl> + if ( ! ok ) <nl> + { <nl> + if ( verboseLogging ) <nl> + GameWarning ( " CGameContext : : SynchObject : game fails to serialize aspect % d on profile % d " , BitIndex ( nAspect ) , int ( profile ) ) ; <nl> + NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> + return eSOR_Failed ; <nl> + } <nl> + <nl> + if ( nAspect = = eEA_Physics & & m_pPhysicsSync & & serialize . IsReading ( ) & & serialize . ShouldCommitValues ( ) ) <nl> + { <nl> + m_pPhysicsSync - > UpdatedEntity ( entityId ) ; <nl> + } <nl> + <nl> NET_PROFILE_COUNT_READ_BITS ( false ) ; <nl> return eSOR_Ok ; <nl> } <nl> bool CGameContext : : Update ( ) <nl> if ( 0 = = ( m_broadcastActionEventInGame - = ( m_broadcastActionEventInGame ! = - 1 ) ) ) <nl> CCryAction : : GetCryAction ( ) - > OnActionEvent ( eAE_inGame ) ; <nl> <nl> - # if ENABLE_NETEDEBUG <nl> + # if ENABLE_NETDEBUG <nl> if ( m_pNetDebug ) <nl> m_pNetDebug - > Update ( ) ; <nl> # endif <nl> mmm a / Code / CryEngine / CryAction / PersistantDebug . cpp <nl> ppp b / Code / CryEngine / CryAction / PersistantDebug . cpp <nl> void CPersistantDebug : : Update ( float frameTime ) <nl> break ; <nl> case eOT_Text3D : <nl> { <nl> + if ( ( uint8 ) ( clr . a * 255 ) = = 0 ) / / Font renderer ignores the color when alpha = = 0 <nl> + continue ; <nl> IRenderAuxText : : DrawText ( iterList - > pos , iterList - > radius , clr , eDrawText_FixedSize | eDrawText_800x600 , iterList - > text . c_str ( ) ) ; <nl> } <nl> break ; <nl> mmm a / Code / CryEngine / CryEntitySystem / BreakableManager . cpp <nl> ppp b / Code / CryEngine / CryEntitySystem / BreakableManager . cpp <nl> void CBreakableManager : : HandlePhysicsCreateEntityPartEvent ( const EventPhysCreate <nl> <nl> pSrcRenderNode = pSrcEntity - > GetRenderNode ( i ) ; <nl> / / createParams . nMatLayers = pSrcRenderProxy - > GetMaterialLayersMask ( ) ; <nl> - createParams . nRenderNodeFlags = pSrcRenderNode - > GetRndFlags ( ) ; <nl> + createParams . nRenderNodeFlags = pSrcRenderNode ? pSrcRenderNode - > GetRndFlags ( ) : ( ERF_CASTSHADOWMAPS | ERF_MOVES_EVERY_FRAME ) ; <nl> createParams . pCustomMtl = pSrcEntity - > GetMaterial ( ) ; <nl> createParams . fScale = pSrcEntity - > GetScale ( ) . x ; <nl> createParams . pName = pSrcEntity - > GetName ( ) ; <nl> void CBreakableManager : : HandlePhysicsCreateEntityPartEvent ( const EventPhysCreate <nl> bNewEntity = pNewEntity ! = pPrevNewEntity ; <nl> <nl> if ( pCreateEvent - > nTotParts = = 1 ) <nl> - SetEntityLifetime ( pNewEntity , pNewStatObj - > GetProperties ( ) , ! pSrcRenderNode - > m_pTempData | | pSrcRenderNode - > GetDrawFrame ( ) + 10 > gEnv - > pRenderer - > GetFrameID ( ) ) ; <nl> + SetEntityLifetime ( pNewEntity , pNewStatObj - > GetProperties ( ) , pSrcRenderNode & & ( ! pSrcRenderNode - > m_pTempData | | pSrcRenderNode - > GetDrawFrame ( ) + 10 > gEnv - > pRenderer - > GetFrameID ( ) ) ) ; <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / CryEntitySystem / PhysicsProxy . cpp <nl> ppp b / Code / CryEngine / CryEntitySystem / PhysicsProxy . cpp <nl> void CEntityPhysics : : PhysicalizeSoft ( SEntityPhysicalizeParams & params ) <nl> float scale = scaleVec . x ; <nl> <nl> pe_geomparams partpos ; <nl> - partpos . pMtx3x4 = const_cast < Matrix34 * > ( & pSlot - > GetLocalTM ( ) ) ; <nl> + partpos . pos = pSlot - > GetLocalTM ( ) . GetTranslation ( ) ; <nl> + Matrix33 rot = Matrix33 ( pSlot - > GetLocalTM ( ) ) ; <nl> + rot . OrthonormalizeFast ( ) ; <nl> + partpos . q = Quat ( rot ) ; <nl> partpos . density = params . density ; <nl> partpos . mass = params . mass ; <nl> partpos . flags = 0 ; <nl> void CEntityPhysics : : OnPhysicsPostStep ( EventPhysPostStep * pEvent ) <nl> if ( ! m_pEntity - > IsActive ( ) ) <nl> m_pEntity - > ActivateForNumUpdates ( 4 ) ; <nl> } <nl> - else <nl> + else if ( physType = = PE_ARTICULATED ) <nl> { <nl> / / Use all slots . <nl> ppos . flags = status_local ; <nl> void CEntityPhysics : : OnPhysicsPostStep ( EventPhysPostStep * pEvent ) <nl> { <nl> pe_status_softvtx ssv ; <nl> const Vec3 & entityScale = m_pEntity - > GetScale ( ) ; <nl> - const float rscale = 1 . f / m_pEntity - > GetWorldTM ( ) . GetColumn0 ( ) . len ( ) ; <nl> <nl> m_pPhysicalEntity - > GetStatus ( & ssv ) ; <nl> if ( m_pEntity - > GetParent ( ) ) <nl> void CEntityPhysics : : OnPhysicsPostStep ( EventPhysPostStep * pEvent ) <nl> m_pEntity - > SetPosRotScale ( ssv . pos , ssv . q , entityScale , ENTITY_XFORM_PHYSICS_STEP ) ; <nl> <nl> IStatObj * pStatObj = m_pEntity - > GetStatObj ( 0 ) ; <nl> - IStatObj * pStatObjNew = pStatObj - > UpdateVertices ( ssv . pVtx , ssv . pNormals , 0 , ssv . nVtx , ssv . pVtxMap , rscale ) ; <nl> + IStatObj * pStatObjNew = pStatObj - > UpdateVertices ( ssv . pVtx , ssv . pNormals , 0 , ssv . nVtx , ssv . pVtxMap ) ; <nl> if ( pStatObjNew ! = pStatObj ) <nl> { <nl> ssv . pMesh - > SetForeignData ( pStatObjNew , 0 ) ; <nl> mmm a / Code / CryEngine / CryPhysics / physicalworld . cpp <nl> ppp b / Code / CryEngine / CryPhysics / physicalworld . cpp <nl> void SEntityGrid : : DeactivateOnDemand ( ) <nl> void CPhysicalWorld : : RegisterBBoxInPODGrid ( const Vec3 * BBox ) <nl> { <nl> WriteLock lock ( m_lockPODGrid ) ; <nl> - MarkAsPODThread ( this ) ; <nl> m_entgrid . RegisterBBoxInPODGrid ( BBox , m_pPhysicsStreamer ) ; <nl> - UnmarkAsPODThread ( this ) ; <nl> } <nl> <nl> void SEntityGrid : : RegisterBBoxInPODGrid ( const Vec3 * BBox , IPhysicsStreamer * pStreamer ) <nl> void SEntityGrid : : RegisterBBoxInPODGrid ( const Vec3 * BBox , IPhysicsStreamer * pStr <nl> if ( ! pPODcells [ i ] ) { <nl> memset ( pPODcells [ i ] = new pe_PODcell [ 64 ] , 0 , sizeof ( pe_PODcell ) * 64 ) ; <nl> for ( int j = 0 ; j < 64 ; j + + ) pPODcells [ i ] [ j ] . zlim . set ( 1000 . 0f , - 1000 . 0f ) ; <nl> + if ( ! imask ) pPODcells [ i ] [ 0 ] . lifeTime = 1e10f ; <nl> } <nl> pe_PODcell * pPODcell = pPODcells [ i ] + ( ( ix & 7 ) + ( iy & 7 ) * 8 & imask ) ; <nl> pPODcell - > zlim [ 0 ] = min ( pPODcell - > zlim [ 0 ] , gBBox [ 0 ] . z ) ; <nl> pPODcell - > zlim [ 1 ] = max ( pPODcell - > zlim [ 1 ] , gBBox [ 1 ] . z ) ; <nl> pPODcell - > nObjects + + ; <nl> - if ( pPODcell - > lifeTime > 0 ) { <nl> + if ( pPODcell - > lifeTime > 0 & & pPODcell - > lifeTime < 1e10f ) { <nl> + MarkAsPODThread ( m_pWorld ) ; <nl> + + + m_pWorld - > m_iLastPODUpdate ; <nl> Vec3 center , sz ; GetPODGridCellBBox ( ix < < log2PODscale , iy < < log2PODscale , center , sz ) ; <nl> pStreamer - > DestroyPhysicalEntitiesInBox ( center - sz , center + sz ) ; <nl> + UnmarkAsPODThread ( m_pWorld ) ; <nl> pPODcell - > lifeTime = - 1 ; <nl> int * picellNext ; <nl> pe_PODcell * pPODcell1 ; <nl> int CPhysicalWorld : : GetEntitiesAround ( const Vec3 & ptmin , const Vec3 & ptmax , CPhys <nl> grid . GetPODGridCellBBox ( ix , iy , center , size ) ; <nl> m_nOnDemandListFailures = 0 ; + + m_iLastPODUpdate ; <nl> if ( m_pPhysicsStreamer - > CreatePhysicalEntitiesInBox ( center - size , center + size ) ) { <nl> - pPODcell - > lifeTime = m_nOnDemandListFailures ? 1E10f : 8 . 0f ; <nl> + pPODcell - > lifeTime = m_nOnDemandListFailures ? 0 . 001f : 8 . 0f ; <nl> pPODcell - > inextActive = grid . iActivePODCell0 ; <nl> grid . iActivePODCell0 = iy < < 16 | ix ; <nl> szList = max ( szList , GetTmpEntList ( pTmpEntList , iCaller ) ) ; <nl> mmm a / Code / CryEngine / CryPhysics / rwi . cpp <nl> ppp b / Code / CryEngine / CryPhysics / rwi . cpp <nl> struct entity_grid_checker { <nl> MarkAsPODThread ( pWorld ) ; <nl> pWorld - > m_nOnDemandListFailures = 0 ; + + pWorld - > m_iLastPODUpdate ; <nl> if ( pWorld - > m_pPhysicsStreamer & & pWorld - > m_pPhysicsStreamer - > CreatePhysicalEntitiesInBox ( bbox . center - bbox . size , bbox . center + bbox . size ) ) { <nl> - pPODcell - > lifeTime = pWorld - > m_nOnDemandListFailures ? 1E10f : 8 . 0f ; <nl> + pPODcell - > lifeTime = pWorld - > m_nOnDemandListFailures ? 0 . 001f : 8 . 0f ; <nl> pPODcell - > inextActive = pgrid - > iActivePODCell0 ; <nl> pgrid - > iActivePODCell0 = icell . y < < 16 | icell . x ; <nl> szList = max ( szList , pWorld - > GetTmpEntList ( pTmpEntList , iCaller ) ) ; <nl> mmm a / Code / CryEngine / CrySystem / System . cpp <nl> ppp b / Code / CryEngine / CrySystem / System . cpp <nl> void CSystem : : SleepIfNeeded ( ) <nl> currentTime = pTimer - > GetAsyncTime ( ) . GetMicroSecondsAsInt64 ( ) ; <nl> } <nl> <nl> - sTimeLast = pTimer - > GetAsyncTime ( ) . GetMicroSecondsAsInt64 ( ) + safeMarginMS ; <nl> + m_lastTickTime = pTimer - > GetAsyncTime ( ) ; <nl> + sTimeLast = m_lastTickTime . GetMicroSecondsAsInt64 ( ) + safeMarginMS ; <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / CrySystem / SystemScheduler . cpp <nl> ppp b / Code / CryEngine / CrySystem / SystemScheduler . cpp <nl> void CSystemScheduler : : SchedulingSleepIfNeeded ( ) <nl> return ; <nl> <nl> SchedulingModeUpdate ( ) ; <nl> - m_pSystem - > SleepIfNeeded ( ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / Code / GameTemplates / cpp / RollingBall / Code / Player / Input / PlayerInput . cpp <nl> ppp b / Code / GameTemplates / cpp / RollingBall / Code / Player / Input / PlayerInput . cpp <nl> void CPlayerInput : : ProcessEvent ( SEntityEvent & event ) <nl> <nl> void CPlayerInput : : Update ( SEntityUpdateContext & ctx ) <nl> { <nl> + if ( m_mouseDeltaRotation . IsZero ( ) ) <nl> + return ; <nl> + <nl> / / Start by updating look dir <nl> Ang3 ypr = CCamera : : CreateAnglesYPR ( Matrix33 ( m_lookOrientation ) ) ; <nl> - <nl> + <nl> ypr . x + = m_mouseDeltaRotation . x * m_pPlayer - > GetCVars ( ) . m_rotationSpeedYaw * ctx . fFrameTime ; <nl> <nl> / / TODO : Perform soft clamp here instead of hard wall , should reduce rot speed in this direction when close to limit . <nl> void CPlayerInput : : Update ( SEntityUpdateContext & ctx ) <nl> <nl> m_lookOrientation = Quat ( CCamera : : CreateOrientationYPR ( ypr ) ) ; <nl> <nl> - / / Reset every frame <nl> m_mouseDeltaRotation = ZERO ; <nl> + <nl> + / / Look direction needs to be synced to server to calculate the movement in <nl> + / / the right direction . <nl> + NetMarkAspectsDirty ( kInputAspect ) ; <nl> } <nl> <nl> void CPlayerInput : : OnPlayerRespawn ( ) <nl> void CPlayerInput : : HandleInputFlagChange ( TInputFlags flags , int activationMode , <nl> break ; <nl> } <nl> <nl> - / / Can be done additionally in Update ( ) to update the look direction . <nl> NetMarkAspectsDirty ( kInputAspect ) ; <nl> } <nl> <nl>
! I integrate from / / ce / main / . . .
CRYTEK/CRYENGINE
f25c30a07d55258104ee3efc3cee3ceac82b4279
2017-03-27T22:06:06Z
new file mode 100644 <nl> index 00000000000 . . 8611d743fb7 <nl> mmm / dev / null <nl> ppp b / src / core / src / file_sys / file_sys . h <nl> <nl> + / / Copyright ( c ) 2012 - PPSSPP Project . <nl> + <nl> + / / This program is free software : you can redistribute it and / or modify <nl> + / / it under the terms of the GNU General Public License as published by <nl> + / / the Free Software Foundation , version 2 . 0 or later versions . <nl> + <nl> + / / This program is distributed in the hope that it will be useful , <nl> + / / but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + / / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + / / GNU General Public License 2 . 0 for more details . <nl> + <nl> + / / A copy of the GPL 2 . 0 should have been included with the program . <nl> + / / If not , see http : / / www . gnu . org / licenses / <nl> + <nl> + / / Official git repository and contact information can be found at <nl> + / / https : / / github . com / hrydgard / ppsspp and http : / / www . ppsspp . org / . <nl> + <nl> + # pragma once <nl> + <nl> + # include " common . h " <nl> + # include " chunk_file . h " <nl> + <nl> + enum FileAccess { <nl> + FILEACCESS_NONE = 0 , <nl> + FILEACCESS_READ = 1 , <nl> + FILEACCESS_WRITE = 2 , <nl> + FILEACCESS_APPEND = 4 , <nl> + FILEACCESS_CREATE = 8 <nl> + } ; <nl> + <nl> + enum FileMove { <nl> + FILEMOVE_BEGIN = 0 , <nl> + FILEMOVE_CURRENT = 1 , <nl> + FILEMOVE_END = 2 <nl> + } ; <nl> + <nl> + enum FileType { <nl> + FILETYPE_NORMAL = 1 , <nl> + FILETYPE_DIRECTORY = 2 <nl> + } ; <nl> + <nl> + <nl> + class IHandleAllocator { <nl> + public : <nl> + virtual ~ IHandleAllocator ( ) { } <nl> + virtual u32 GetNewHandle ( ) = 0 ; <nl> + virtual void FreeHandle ( u32 handle ) = 0 ; <nl> + } ; <nl> + <nl> + class SequentialHandleAllocator : public IHandleAllocator { <nl> + public : <nl> + SequentialHandleAllocator ( ) : handle_ ( 1 ) { } <nl> + virtual u32 GetNewHandle ( ) { return handle_ + + ; } <nl> + virtual void FreeHandle ( u32 handle ) { } <nl> + private : <nl> + int handle_ ; <nl> + } ; <nl> + <nl> + struct PSPFileInfo { <nl> + PSPFileInfo ( ) <nl> + : size ( 0 ) , access ( 0 ) , exists ( false ) , type ( FILETYPE_NORMAL ) , isOnSectorSystem ( false ) , startSector ( 0 ) , numSectors ( 0 ) { } <nl> + <nl> + void DoState ( PointerWrap & p ) { <nl> + auto s = p . Section ( " PSPFileInfo " , 1 ) ; <nl> + if ( ! s ) <nl> + return ; <nl> + <nl> + p . Do ( name ) ; <nl> + p . Do ( size ) ; <nl> + p . Do ( access ) ; <nl> + p . Do ( exists ) ; <nl> + p . Do ( type ) ; <nl> + p . Do ( atime ) ; <nl> + p . Do ( ctime ) ; <nl> + p . Do ( mtime ) ; <nl> + p . Do ( isOnSectorSystem ) ; <nl> + p . Do ( startSector ) ; <nl> + p . Do ( numSectors ) ; <nl> + p . Do ( sectorSize ) ; <nl> + } <nl> + <nl> + std : : string name ; <nl> + s64 size ; <nl> + u32 access ; / / unix 777 <nl> + bool exists ; <nl> + FileType type ; <nl> + <nl> + tm atime ; <nl> + tm ctime ; <nl> + tm mtime ; <nl> + <nl> + bool isOnSectorSystem ; <nl> + u32 startSector ; <nl> + u32 numSectors ; <nl> + u32 sectorSize ; <nl> + } ; <nl> + <nl> + <nl> + class IFileSystem { <nl> + public : <nl> + virtual ~ IFileSystem ( ) { } <nl> + <nl> + virtual void DoState ( PointerWrap & p ) = 0 ; <nl> + virtual std : : vector < PSPFileInfo > GetDirListing ( std : : string path ) = 0 ; <nl> + virtual u32 OpenFile ( std : : string filename , FileAccess access , const char * devicename = NULL ) = 0 ; <nl> + virtual void CloseFile ( u32 handle ) = 0 ; <nl> + virtual size_t ReadFile ( u32 handle , u8 * pointer , s64 size ) = 0 ; <nl> + virtual size_t WriteFile ( u32 handle , const u8 * pointer , s64 size ) = 0 ; <nl> + virtual size_t SeekFile ( u32 handle , s32 position , FileMove type ) = 0 ; <nl> + virtual PSPFileInfo GetFileInfo ( std : : string filename ) = 0 ; <nl> + virtual bool OwnsHandle ( u32 handle ) = 0 ; <nl> + virtual bool MkDir ( const std : : string & dirname ) = 0 ; <nl> + virtual bool RmDir ( const std : : string & dirname ) = 0 ; <nl> + virtual int RenameFile ( const std : : string & from , const std : : string & to ) = 0 ; <nl> + virtual bool RemoveFile ( const std : : string & filename ) = 0 ; <nl> + virtual bool GetHostPath ( const std : : string & inpath , std : : string & outpath ) = 0 ; <nl> + } ; <nl> + <nl> + <nl> + class EmptyFileSystem : public IFileSystem { <nl> + public : <nl> + virtual void DoState ( PointerWrap & p ) { } <nl> + std : : vector < PSPFileInfo > GetDirListing ( std : : string path ) { std : : vector < PSPFileInfo > vec ; return vec ; } <nl> + u32 OpenFile ( std : : string filename , FileAccess access , const char * devicename = NULL ) { return 0 ; } <nl> + void CloseFile ( u32 handle ) { } <nl> + size_t ReadFile ( u32 handle , u8 * pointer , s64 size ) { return 0 ; } <nl> + size_t WriteFile ( u32 handle , const u8 * pointer , s64 size ) { return 0 ; } <nl> + size_t SeekFile ( u32 handle , s32 position , FileMove type ) { return 0 ; } <nl> + PSPFileInfo GetFileInfo ( std : : string filename ) { PSPFileInfo f ; return f ; } <nl> + bool OwnsHandle ( u32 handle ) { return false ; } <nl> + virtual bool MkDir ( const std : : string & dirname ) { return false ; } <nl> + virtual bool RmDir ( const std : : string & dirname ) { return false ; } <nl> + virtual int RenameFile ( const std : : string & from , const std : : string & to ) { return - 1 ; } <nl> + virtual bool RemoveFile ( const std : : string & filename ) { return false ; } <nl> + virtual bool GetHostPath ( const std : : string & inpath , std : : string & outpath ) { return false ; } <nl> + } ; <nl> + <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 255369cb6de <nl> mmm / dev / null <nl> ppp b / src / core / src / file_sys / file_sys_directory . cpp <nl> <nl> + / / Copyright ( c ) 2012 - PPSSPP Project . <nl> + <nl> + / / This program is free software : you can redistribute it and / or modify <nl> + / / it under the terms of the GNU General Public License as published by <nl> + / / the Free Software Foundation , version 2 . 0 or later versions . <nl> + <nl> + / / This program is distributed in the hope that it will be useful , <nl> + / / but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + / / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + / / GNU General Public License 2 . 0 for more details . <nl> + <nl> + / / A copy of the GPL 2 . 0 should have been included with the program . <nl> + / / If not , see http : / / www . gnu . org / licenses / <nl> + <nl> + / / Official git repository and contact information can be found at <nl> + / / https : / / github . com / hrydgard / ppsspp and http : / / www . ppsspp . org / . <nl> + <nl> + # include " chunk_file . h " <nl> + # include " file_util . h " <nl> + # include " file_sys_directory . h " <nl> + / / # include " ISOFileSystem . h " <nl> + / / # include " Core / HLE / sceKernel . h " <nl> + / / # include " file / zip_read . h " <nl> + / / # include " util / text / utf8 . h " <nl> + <nl> + # ifdef _WIN32 <nl> + / / # include " Common / CommonWindows . h " <nl> + # include < sys / stat . h > <nl> + # else <nl> + # include < dirent . h > <nl> + # include < unistd . h > <nl> + # include < sys / stat . h > <nl> + # include < ctype . h > <nl> + # endif <nl> + <nl> + std : : string DirectoryFileHandle : : GetLocalPath ( std : : string & basePath , std : : string localpath ) <nl> + { <nl> + if ( localpath . empty ( ) ) <nl> + return basePath ; <nl> + <nl> + if ( localpath [ 0 ] = = ' / ' ) <nl> + localpath . erase ( 0 , 1 ) ; <nl> + / / Convert slashes <nl> + # ifdef _WIN32 <nl> + for ( size_t i = 0 ; i < localpath . size ( ) ; i + + ) { <nl> + if ( localpath [ i ] = = ' / ' ) <nl> + localpath [ i ] = ' \ \ ' ; <nl> + } <nl> + # endif <nl> + return basePath + localpath ; <nl> + } <nl> + <nl> + bool DirectoryFileHandle : : Open ( std : : string & basePath , std : : string & fileName , FileAccess access ) { <nl> + std : : string fullName = GetLocalPath ( basePath , fileName ) ; <nl> + INFO_LOG ( FILESYS , " Actually opening % s " , fullName . c_str ( ) ) ; <nl> + <nl> + / / TODO : tests , should append seek to end of file ? seeking in a file opened for append ? <nl> + # ifdef _WIN32 <nl> + / / Convert parameters to Windows permissions and access <nl> + DWORD desired = 0 ; <nl> + DWORD sharemode = 0 ; <nl> + DWORD openmode = 0 ; <nl> + if ( access & FILEACCESS_READ ) { <nl> + desired | = GENERIC_READ ; <nl> + sharemode | = FILE_SHARE_READ ; <nl> + } <nl> + if ( access & FILEACCESS_WRITE ) { <nl> + desired | = GENERIC_WRITE ; <nl> + sharemode | = FILE_SHARE_WRITE ; <nl> + } <nl> + if ( access & FILEACCESS_CREATE ) { <nl> + openmode = OPEN_ALWAYS ; <nl> + } else { <nl> + openmode = OPEN_EXISTING ; <nl> + } <nl> + / / Let ' s do it ! <nl> + hFile = CreateFile ( fullName . c_str ( ) , desired , sharemode , 0 , openmode , 0 , 0 ) ; <nl> + bool success = hFile ! = INVALID_HANDLE_VALUE ; <nl> + # else <nl> + / / Convert flags in access parameter to fopen access mode <nl> + const char * mode = NULL ; <nl> + if ( access & FILEACCESS_APPEND ) { <nl> + if ( access & FILEACCESS_READ ) <nl> + mode = " ab + " ; / / append + read , create if needed <nl> + else <nl> + mode = " ab " ; / / append only , create if needed <nl> + } else if ( access & FILEACCESS_WRITE ) { <nl> + if ( access & FILEACCESS_READ ) { <nl> + / / FILEACCESS_CREATE is ignored for read only , write only , and append <nl> + / / because C + + standard fopen ' s nonexistant file creation can only be <nl> + / / customized for files opened read + write <nl> + if ( access & FILEACCESS_CREATE ) <nl> + mode = " wb + " ; / / read + write , create if needed <nl> + else <nl> + mode = " rb + " ; / / read + write , but don ' t create <nl> + } else { <nl> + mode = " wb " ; / / write only , create if needed <nl> + } <nl> + } else { / / neither write nor append , so default to read only <nl> + mode = " rb " ; / / read only , don ' t create <nl> + } <nl> + <nl> + hFile = fopen ( fullName . c_str ( ) , mode ) ; <nl> + bool success = hFile ! = 0 ; <nl> + # endif <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + if ( ! success & & <nl> + ! ( access & FILEACCESS_APPEND ) & & <nl> + ! ( access & FILEACCESS_CREATE ) & & <nl> + ! ( access & FILEACCESS_WRITE ) ) <nl> + { <nl> + if ( ! FixPathCase ( basePath , fileName , FPC_PATH_MUST_EXIST ) ) <nl> + return 0 ; / / or go on and attempt ( for a better error code than just 0 ? ) <nl> + fullName = GetLocalPath ( basePath , fileName ) ; <nl> + const char * fullNameC = fullName . c_str ( ) ; <nl> + <nl> + DEBUG_LOG ( FILESYS , " Case may have been incorrect , second try opening % s ( % s ) " , fullNameC , fileName . c_str ( ) ) ; <nl> + <nl> + / / And try again with the correct case this time <nl> + # ifdef _WIN32 <nl> + hFile = CreateFile ( fullNameC , desired , sharemode , 0 , openmode , 0 , 0 ) ; <nl> + success = hFile ! = INVALID_HANDLE_VALUE ; <nl> + # else <nl> + hFile = fopen ( fullNameC , mode ) ; <nl> + success = hFile ! = 0 ; <nl> + # endif <nl> + } <nl> + # endif <nl> + <nl> + return success ; <nl> + } <nl> + <nl> + size_t DirectoryFileHandle : : Read ( u8 * pointer , s64 size ) <nl> + { <nl> + size_t bytesRead = 0 ; <nl> + # ifdef _WIN32 <nl> + : : ReadFile ( hFile , ( LPVOID ) pointer , ( DWORD ) size , ( LPDWORD ) & bytesRead , 0 ) ; <nl> + # else <nl> + bytesRead = fread ( pointer , 1 , size , hFile ) ; <nl> + # endif <nl> + return bytesRead ; <nl> + } <nl> + <nl> + size_t DirectoryFileHandle : : Write ( const u8 * pointer , s64 size ) <nl> + { <nl> + size_t bytesWritten = 0 ; <nl> + # ifdef _WIN32 <nl> + : : WriteFile ( hFile , ( LPVOID ) pointer , ( DWORD ) size , ( LPDWORD ) & bytesWritten , 0 ) ; <nl> + # else <nl> + bytesWritten = fwrite ( pointer , 1 , size , hFile ) ; <nl> + # endif <nl> + return bytesWritten ; <nl> + } <nl> + <nl> + size_t DirectoryFileHandle : : Seek ( s32 position , FileMove type ) <nl> + { <nl> + # ifdef _WIN32 <nl> + DWORD moveMethod = 0 ; <nl> + switch ( type ) { <nl> + case FILEMOVE_BEGIN : moveMethod = FILE_BEGIN ; break ; <nl> + case FILEMOVE_CURRENT : moveMethod = FILE_CURRENT ; break ; <nl> + case FILEMOVE_END : moveMethod = FILE_END ; break ; <nl> + } <nl> + DWORD newPos = SetFilePointer ( hFile , ( LONG ) position , 0 , moveMethod ) ; <nl> + return newPos ; <nl> + # else <nl> + int moveMethod = 0 ; <nl> + switch ( type ) { <nl> + case FILEMOVE_BEGIN : moveMethod = SEEK_SET ; break ; <nl> + case FILEMOVE_CURRENT : moveMethod = SEEK_CUR ; break ; <nl> + case FILEMOVE_END : moveMethod = SEEK_END ; break ; <nl> + } <nl> + fseek ( hFile , position , moveMethod ) ; <nl> + return ftell ( hFile ) ; <nl> + # endif <nl> + } <nl> + <nl> + void DirectoryFileHandle : : Close ( ) <nl> + { <nl> + # ifdef _WIN32 <nl> + if ( hFile ! = ( HANDLE ) - 1 ) <nl> + CloseHandle ( hFile ) ; <nl> + # else <nl> + if ( hFile ! = 0 ) <nl> + fclose ( hFile ) ; <nl> + # endif <nl> + } <nl> + <nl> + DirectoryFileSystem : : DirectoryFileSystem ( IHandleAllocator * _hAlloc , std : : string _basePath ) : basePath ( _basePath ) { <nl> + File : : CreateFullPath ( basePath ) ; <nl> + hAlloc = _hAlloc ; <nl> + } <nl> + <nl> + DirectoryFileSystem : : ~ DirectoryFileSystem ( ) { <nl> + for ( auto iter = entries . begin ( ) ; iter ! = entries . end ( ) ; + + iter ) { <nl> + iter - > second . hFile . Close ( ) ; <nl> + } <nl> + } <nl> + <nl> + std : : string DirectoryFileSystem : : GetLocalPath ( std : : string localpath ) { <nl> + if ( localpath . empty ( ) ) <nl> + return basePath ; <nl> + <nl> + if ( localpath [ 0 ] = = ' / ' ) <nl> + localpath . erase ( 0 , 1 ) ; <nl> + / / Convert slashes <nl> + # ifdef _WIN32 <nl> + for ( size_t i = 0 ; i < localpath . size ( ) ; i + + ) { <nl> + if ( localpath [ i ] = = ' / ' ) <nl> + localpath [ i ] = ' \ \ ' ; <nl> + } <nl> + # endif <nl> + return basePath + localpath ; <nl> + } <nl> + <nl> + bool DirectoryFileSystem : : MkDir ( const std : : string & dirname ) { <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + / / Must fix case BEFORE attempting , because MkDir would create <nl> + / / duplicate ( different case ) directories <nl> + <nl> + std : : string fixedCase = dirname ; <nl> + if ( ! FixPathCase ( basePath , fixedCase , FPC_PARTIAL_ALLOWED ) ) <nl> + return false ; <nl> + <nl> + return File : : CreateFullPath ( GetLocalPath ( fixedCase ) ) ; <nl> + # else <nl> + return File : : CreateFullPath ( GetLocalPath ( dirname ) ) ; <nl> + # endif <nl> + } <nl> + <nl> + bool DirectoryFileSystem : : RmDir ( const std : : string & dirname ) { <nl> + std : : string fullName = GetLocalPath ( dirname ) ; <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + / / Maybe we ' re lucky ? <nl> + if ( File : : DeleteDirRecursively ( fullName ) ) <nl> + return true ; <nl> + <nl> + / / Nope , fix case and try again <nl> + fullName = dirname ; <nl> + if ( ! FixPathCase ( basePath , fullName , FPC_FILE_MUST_EXIST ) ) <nl> + return false ; / / or go on and attempt ( for a better error code than just false ? ) <nl> + <nl> + fullName = GetLocalPath ( fullName ) ; <nl> + # endif <nl> + <nl> + / * # ifdef _WIN32 <nl> + return RemoveDirectory ( fullName . c_str ( ) ) = = TRUE ; <nl> + # else <nl> + return 0 = = rmdir ( fullName . c_str ( ) ) ; <nl> + # endif * / <nl> + return File : : DeleteDirRecursively ( fullName ) ; <nl> + } <nl> + <nl> + int DirectoryFileSystem : : RenameFile ( const std : : string & from , const std : : string & to ) { <nl> + std : : string fullTo = to ; <nl> + <nl> + / / Rename ignores the path ( even if specified ) on to . <nl> + size_t chop_at = to . find_last_of ( ' / ' ) ; <nl> + if ( chop_at ! = to . npos ) <nl> + fullTo = to . substr ( chop_at + 1 ) ; <nl> + <nl> + / / Now put it in the same directory as from . <nl> + size_t dirname_end = from . find_last_of ( ' / ' ) ; <nl> + if ( dirname_end ! = from . npos ) <nl> + fullTo = from . substr ( 0 , dirname_end + 1 ) + fullTo ; <nl> + <nl> + / / At this point , we should check if the paths match and give an already exists error . <nl> + if ( from = = fullTo ) <nl> + return SCE_KERNEL_ERROR_ERRNO_FILE_ALREADY_EXISTS ; <nl> + <nl> + std : : string fullFrom = GetLocalPath ( from ) ; <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + / / In case TO should overwrite a file with different case <nl> + if ( ! FixPathCase ( basePath , fullTo , FPC_PATH_MUST_EXIST ) ) <nl> + return - 1 ; / / or go on and attempt ( for a better error code than just false ? ) <nl> + # endif <nl> + <nl> + fullTo = GetLocalPath ( fullTo ) ; <nl> + const char * fullToC = fullTo . c_str ( ) ; <nl> + <nl> + # ifdef _WIN32 <nl> + bool retValue = ( MoveFile ( fullFrom . c_str ( ) , fullToC ) = = TRUE ) ; <nl> + # else <nl> + bool retValue = ( 0 = = rename ( fullFrom . c_str ( ) , fullToC ) ) ; <nl> + # endif <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + if ( ! retValue ) <nl> + { <nl> + / / May have failed due to case sensitivity on FROM , so try again <nl> + fullFrom = from ; <nl> + if ( ! FixPathCase ( basePath , fullFrom , FPC_FILE_MUST_EXIST ) ) <nl> + return - 1 ; / / or go on and attempt ( for a better error code than just false ? ) <nl> + fullFrom = GetLocalPath ( fullFrom ) ; <nl> + <nl> + # ifdef _WIN32 <nl> + retValue = ( MoveFile ( fullFrom . c_str ( ) , fullToC ) = = TRUE ) ; <nl> + # else <nl> + retValue = ( 0 = = rename ( fullFrom . c_str ( ) , fullToC ) ) ; <nl> + # endif <nl> + } <nl> + # endif <nl> + <nl> + / / TODO : Better error codes . <nl> + return retValue ? 0 : SCE_KERNEL_ERROR_ERRNO_FILE_ALREADY_EXISTS ; <nl> + } <nl> + <nl> + bool DirectoryFileSystem : : RemoveFile ( const std : : string & filename ) { <nl> + std : : string fullName = GetLocalPath ( filename ) ; <nl> + # ifdef _WIN32 <nl> + bool retValue = ( : : DeleteFileA ( fullName . c_str ( ) ) = = TRUE ) ; <nl> + # else <nl> + bool retValue = ( 0 = = unlink ( fullName . c_str ( ) ) ) ; <nl> + # endif <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + if ( ! retValue ) <nl> + { <nl> + / / May have failed due to case sensitivity , so try again <nl> + fullName = filename ; <nl> + if ( ! FixPathCase ( basePath , fullName , FPC_FILE_MUST_EXIST ) ) <nl> + return false ; / / or go on and attempt ( for a better error code than just false ? ) <nl> + fullName = GetLocalPath ( fullName ) ; <nl> + <nl> + # ifdef _WIN32 <nl> + retValue = ( : : DeleteFileA ( fullName . c_str ( ) ) = = TRUE ) ; <nl> + # else <nl> + retValue = ( 0 = = unlink ( fullName . c_str ( ) ) ) ; <nl> + # endif <nl> + } <nl> + # endif <nl> + <nl> + return retValue ; <nl> + } <nl> + <nl> + u32 DirectoryFileSystem : : OpenFile ( std : : string filename , FileAccess access , const char * devicename ) { <nl> + OpenFileEntry entry ; <nl> + bool success = entry . hFile . Open ( basePath , filename , access ) ; <nl> + <nl> + if ( ! success ) { <nl> + # ifdef _WIN32 <nl> + ERROR_LOG ( FILESYS , " DirectoryFileSystem : : OpenFile : FAILED , % i - access = % i " , GetLastError ( ) , ( int ) access ) ; <nl> + # else <nl> + ERROR_LOG ( FILESYS , " DirectoryFileSystem : : OpenFile : FAILED , access = % i " , ( int ) access ) ; <nl> + # endif <nl> + / / wwwwaaaaahh ! ! <nl> + return 0 ; <nl> + } else { <nl> + # ifdef _WIN32 <nl> + if ( access & FILEACCESS_APPEND ) <nl> + entry . hFile . Seek ( 0 , FILEMOVE_END ) ; <nl> + # endif <nl> + <nl> + u32 newHandle = hAlloc - > GetNewHandle ( ) ; <nl> + entries [ newHandle ] = entry ; <nl> + <nl> + return newHandle ; <nl> + } <nl> + } <nl> + <nl> + void DirectoryFileSystem : : CloseFile ( u32 handle ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) { <nl> + hAlloc - > FreeHandle ( handle ) ; <nl> + iter - > second . hFile . Close ( ) ; <nl> + entries . erase ( iter ) ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot close file that hasn ' t been opened : % 08x " , handle ) ; <nl> + } <nl> + } <nl> + <nl> + bool DirectoryFileSystem : : OwnsHandle ( u32 handle ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + return ( iter ! = entries . end ( ) ) ; <nl> + } <nl> + <nl> + size_t DirectoryFileSystem : : ReadFile ( u32 handle , u8 * pointer , s64 size ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) <nl> + { <nl> + size_t bytesRead = iter - > second . hFile . Read ( pointer , size ) ; <nl> + return bytesRead ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot read file that hasn ' t been opened : % 08x " , handle ) ; <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + size_t DirectoryFileSystem : : WriteFile ( u32 handle , const u8 * pointer , s64 size ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) <nl> + { <nl> + size_t bytesWritten = iter - > second . hFile . Write ( pointer , size ) ; <nl> + return bytesWritten ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot write to file that hasn ' t been opened : % 08x " , handle ) ; <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + size_t DirectoryFileSystem : : SeekFile ( u32 handle , s32 position , FileMove type ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) { <nl> + return iter - > second . hFile . Seek ( position , type ) ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot seek in file that hasn ' t been opened : % 08x " , handle ) ; <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + PSPFileInfo DirectoryFileSystem : : GetFileInfo ( std : : string filename ) { <nl> + PSPFileInfo x ; <nl> + x . name = filename ; <nl> + <nl> + std : : string fullName = GetLocalPath ( filename ) ; <nl> + if ( ! File : : Exists ( fullName ) ) { <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + if ( ! FixPathCase ( basePath , filename , FPC_FILE_MUST_EXIST ) ) <nl> + return x ; <nl> + fullName = GetLocalPath ( filename ) ; <nl> + <nl> + if ( ! File : : Exists ( fullName ) ) <nl> + return x ; <nl> + # else <nl> + return x ; <nl> + # endif <nl> + } <nl> + x . type = File : : IsDirectory ( fullName ) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL ; <nl> + x . exists = true ; <nl> + <nl> + if ( x . type ! = FILETYPE_DIRECTORY ) <nl> + { <nl> + # ifdef _WIN32 <nl> + struct _stat64i32 s ; <nl> + _wstat64i32 ( fullName . c_str ( ) , & s ) ; <nl> + # else <nl> + struct stat s ; <nl> + stat ( fullName . c_str ( ) , & s ) ; <nl> + # endif <nl> + <nl> + x . size = File : : GetSize ( fullName ) ; <nl> + x . access = s . st_mode & 0x1FF ; <nl> + localtime_r ( ( time_t * ) & s . st_atime , & x . atime ) ; <nl> + localtime_r ( ( time_t * ) & s . st_ctime , & x . ctime ) ; <nl> + localtime_r ( ( time_t * ) & s . st_mtime , & x . mtime ) ; <nl> + } <nl> + <nl> + return x ; <nl> + } <nl> + <nl> + bool DirectoryFileSystem : : GetHostPath ( const std : : string & inpath , std : : string & outpath ) { <nl> + outpath = GetLocalPath ( inpath ) ; <nl> + return true ; <nl> + } <nl> + <nl> + # ifdef _WIN32 <nl> + # define FILETIME_FROM_UNIX_EPOCH_US 11644473600000000ULL <nl> + <nl> + static void tmFromFiletime ( tm & dest , FILETIME & src ) <nl> + { <nl> + u64 from_1601_us = ( ( ( u64 ) src . dwHighDateTime < < 32ULL ) + ( u64 ) src . dwLowDateTime ) / 10ULL ; <nl> + u64 from_1970_us = from_1601_us - FILETIME_FROM_UNIX_EPOCH_US ; <nl> + <nl> + time_t t = ( time_t ) ( from_1970_us / 1000000UL ) ; <nl> + localtime_r ( & t , & dest ) ; <nl> + } <nl> + # endif <nl> + <nl> + std : : vector < PSPFileInfo > DirectoryFileSystem : : GetDirListing ( std : : string path ) { <nl> + std : : vector < PSPFileInfo > myVector ; <nl> + # ifdef _WIN32 <nl> + WIN32_FIND_DATA findData ; <nl> + HANDLE hFind ; <nl> + <nl> + std : : string w32path = GetLocalPath ( path ) + " \ \ * . * " ; <nl> + <nl> + hFind = FindFirstFile ( ConvertUTF8ToWString ( w32path ) . c_str ( ) , & findData ) ; <nl> + <nl> + if ( hFind = = INVALID_HANDLE_VALUE ) { <nl> + return myVector ; / / the empty list <nl> + } <nl> + <nl> + while ( true ) { <nl> + PSPFileInfo entry ; <nl> + if ( findData . dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) <nl> + entry . type = FILETYPE_DIRECTORY ; <nl> + else <nl> + entry . type = FILETYPE_NORMAL ; <nl> + <nl> + / / TODO : Make this more correct ? <nl> + entry . access = entry . type = = FILETYPE_NORMAL ? 0666 : 0777 ; <nl> + / / TODO : is this just for . . or all subdirectories ? Need to add a directory to the test <nl> + / / to find out . Also why so different than the old test results ? <nl> + if ( ! wcscmp ( findData . cFileName , L " . . " ) ) <nl> + entry . size = 4096 ; <nl> + else <nl> + entry . size = findData . nFileSizeLow | ( ( u64 ) findData . nFileSizeHigh < < 32 ) ; <nl> + entry . name = ConvertWStringToUTF8 ( findData . cFileName ) ; <nl> + tmFromFiletime ( entry . atime , findData . ftLastAccessTime ) ; <nl> + tmFromFiletime ( entry . ctime , findData . ftCreationTime ) ; <nl> + tmFromFiletime ( entry . mtime , findData . ftLastWriteTime ) ; <nl> + myVector . push_back ( entry ) ; <nl> + <nl> + int retval = FindNextFile ( hFind , & findData ) ; <nl> + if ( ! retval ) <nl> + break ; <nl> + } <nl> + # else <nl> + dirent * dirp ; <nl> + std : : string localPath = GetLocalPath ( path ) ; <nl> + DIR * dp = opendir ( localPath . c_str ( ) ) ; <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + if ( dp = = NULL & & FixPathCase ( basePath , path , FPC_FILE_MUST_EXIST ) ) { <nl> + / / May have failed due to case sensitivity , try again <nl> + localPath = GetLocalPath ( path ) ; <nl> + dp = opendir ( localPath . c_str ( ) ) ; <nl> + } <nl> + # endif <nl> + <nl> + if ( dp = = NULL ) { <nl> + ERROR_LOG ( FILESYS , " Error opening directory % s \ n " , path . c_str ( ) ) ; <nl> + return myVector ; <nl> + } <nl> + <nl> + while ( ( dirp = readdir ( dp ) ) ! = NULL ) { <nl> + PSPFileInfo entry ; <nl> + struct stat s ; <nl> + std : : string fullName = GetLocalPath ( path ) + " / " + dirp - > d_name ; <nl> + stat ( fullName . c_str ( ) , & s ) ; <nl> + if ( S_ISDIR ( s . st_mode ) ) <nl> + entry . type = FILETYPE_DIRECTORY ; <nl> + else <nl> + entry . type = FILETYPE_NORMAL ; <nl> + entry . access = s . st_mode & 0x1FF ; <nl> + entry . name = dirp - > d_name ; <nl> + entry . size = s . st_size ; <nl> + localtime_r ( ( time_t * ) & s . st_atime , & entry . atime ) ; <nl> + localtime_r ( ( time_t * ) & s . st_ctime , & entry . ctime ) ; <nl> + localtime_r ( ( time_t * ) & s . st_mtime , & entry . mtime ) ; <nl> + myVector . push_back ( entry ) ; <nl> + } <nl> + closedir ( dp ) ; <nl> + # endif <nl> + return myVector ; <nl> + } <nl> + <nl> + void DirectoryFileSystem : : DoState ( PointerWrap & p ) { <nl> + if ( ! entries . empty ( ) ) { <nl> + p . SetError ( p . ERROR_WARNING ) ; <nl> + ERROR_LOG ( FILESYS , " FIXME : Open files during savestate , could go badly . " ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + <nl> + VFSFileSystem : : VFSFileSystem ( IHandleAllocator * _hAlloc , std : : string _basePath ) : basePath ( _basePath ) { <nl> + INFO_LOG ( FILESYS , " Creating VFS file system " ) ; <nl> + hAlloc = _hAlloc ; <nl> + } <nl> + <nl> + VFSFileSystem : : ~ VFSFileSystem ( ) { <nl> + for ( auto iter = entries . begin ( ) ; iter ! = entries . end ( ) ; + + iter ) { <nl> + delete [ ] iter - > second . fileData ; <nl> + } <nl> + entries . clear ( ) ; <nl> + } <nl> + <nl> + std : : string VFSFileSystem : : GetLocalPath ( std : : string localPath ) { <nl> + return basePath + localPath ; <nl> + } <nl> + <nl> + bool VFSFileSystem : : MkDir ( const std : : string & dirname ) { <nl> + / / NOT SUPPORTED - READ ONLY <nl> + return false ; <nl> + } <nl> + <nl> + bool VFSFileSystem : : RmDir ( const std : : string & dirname ) { <nl> + / / NOT SUPPORTED - READ ONLY <nl> + return false ; <nl> + } <nl> + <nl> + int VFSFileSystem : : RenameFile ( const std : : string & from , const std : : string & to ) { <nl> + / / NOT SUPPORTED - READ ONLY <nl> + return - 1 ; <nl> + } <nl> + <nl> + bool VFSFileSystem : : RemoveFile ( const std : : string & filename ) { <nl> + / / NOT SUPPORTED - READ ONLY <nl> + return false ; <nl> + } <nl> + <nl> + u32 VFSFileSystem : : OpenFile ( std : : string filename , FileAccess access , const char * devicename ) { <nl> + if ( access ! = FILEACCESS_READ ) { <nl> + ERROR_LOG ( FILESYS , " VFSFileSystem only supports plain reading " ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + std : : string fullName = GetLocalPath ( filename ) ; <nl> + const char * fullNameC = fullName . c_str ( ) ; <nl> + INFO_LOG ( FILESYS , " VFSFileSystem actually opening % s ( % s ) " , fullNameC , filename . c_str ( ) ) ; <nl> + <nl> + size_t size ; <nl> + u8 * data = VFSReadFile ( fullNameC , & size ) ; <nl> + if ( ! data ) { <nl> + ERROR_LOG ( FILESYS , " VFSFileSystem failed to open % s " , filename . c_str ( ) ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + OpenFileEntry entry ; <nl> + entry . fileData = data ; <nl> + entry . size = size ; <nl> + entry . seekPos = 0 ; <nl> + u32 newHandle = hAlloc - > GetNewHandle ( ) ; <nl> + entries [ newHandle ] = entry ; <nl> + return newHandle ; <nl> + } <nl> + <nl> + PSPFileInfo VFSFileSystem : : GetFileInfo ( std : : string filename ) { <nl> + PSPFileInfo x ; <nl> + x . name = filename ; <nl> + <nl> + std : : string fullName = GetLocalPath ( filename ) ; <nl> + INFO_LOG ( FILESYS , " Getting VFS file info % s ( % s ) " , fullName . c_str ( ) , filename . c_str ( ) ) ; <nl> + FileInfo fo ; <nl> + VFSGetFileInfo ( fullName . c_str ( ) , & fo ) ; <nl> + x . exists = fo . exists ; <nl> + if ( x . exists ) { <nl> + x . size = fo . size ; <nl> + x . type = fo . isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL ; <nl> + } <nl> + INFO_LOG ( FILESYS , " Got VFS file info : size = % i " , ( int ) x . size ) ; <nl> + return x ; <nl> + } <nl> + <nl> + void VFSFileSystem : : CloseFile ( u32 handle ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) { <nl> + delete [ ] iter - > second . fileData ; <nl> + entries . erase ( iter ) ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot close file that hasn ' t been opened : % 08x " , handle ) ; <nl> + } <nl> + } <nl> + <nl> + bool VFSFileSystem : : OwnsHandle ( u32 handle ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + return ( iter ! = entries . end ( ) ) ; <nl> + } <nl> + <nl> + size_t VFSFileSystem : : ReadFile ( u32 handle , u8 * pointer , s64 size ) { <nl> + INFO_LOG ( FILESYS , " VFSFileSystem : : ReadFile % 08x % p % i " , handle , pointer , ( u32 ) size ) ; <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) <nl> + { <nl> + size_t bytesRead = size ; <nl> + memcpy ( pointer , iter - > second . fileData + iter - > second . seekPos , size ) ; <nl> + iter - > second . seekPos + = size ; <nl> + return bytesRead ; <nl> + } else { <nl> + ERROR_LOG ( FILESYS , " Cannot read file that hasn ' t been opened : % 08x " , handle ) ; <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + size_t VFSFileSystem : : WriteFile ( u32 handle , const u8 * pointer , s64 size ) { <nl> + / / NOT SUPPORTED - READ ONLY <nl> + return 0 ; <nl> + } <nl> + <nl> + size_t VFSFileSystem : : SeekFile ( u32 handle , s32 position , FileMove type ) { <nl> + EntryMap : : iterator iter = entries . find ( handle ) ; <nl> + if ( iter ! = entries . end ( ) ) { <nl> + switch ( type ) { <nl> + case FILEMOVE_BEGIN : iter - > second . seekPos = position ; break ; <nl> + case FILEMOVE_CURRENT : iter - > second . seekPos + = position ; break ; <nl> + case FILEMOVE_END : iter - > second . seekPos = iter - > second . size + position ; break ; <nl> + } <nl> + return iter - > second . seekPos ; <nl> + } else { <nl> + / / This shouldn ' t happen . . . <nl> + ERROR_LOG ( FILESYS , " Cannot seek in file that hasn ' t been opened : % 08x " , handle ) ; <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + <nl> + bool VFSFileSystem : : GetHostPath ( const std : : string & inpath , std : : string & outpath ) { <nl> + / / NOT SUPPORTED <nl> + return false ; <nl> + } <nl> + <nl> + std : : vector < PSPFileInfo > VFSFileSystem : : GetDirListing ( std : : string path ) { <nl> + std : : vector < PSPFileInfo > myVector ; <nl> + / / TODO <nl> + return myVector ; <nl> + } <nl> + <nl> + void VFSFileSystem : : DoState ( PointerWrap & p ) { <nl> + if ( ! entries . empty ( ) ) { <nl> + p . SetError ( p . ERROR_WARNING ) ; <nl> + ERROR_LOG ( FILESYS , " FIXME : Open files during savestate , could go badly . " ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 5591cd7d929 <nl> mmm / dev / null <nl> ppp b / src / core / src / file_sys / file_sys_directory . h <nl> <nl> + / / Copyright ( c ) 2012 - PPSSPP Project . <nl> + <nl> + / / This program is free software : you can redistribute it and / or modify <nl> + / / it under the terms of the GNU General Public License as published by <nl> + / / the Free Software Foundation , version 2 . 0 or later versions . <nl> + <nl> + / / This program is distributed in the hope that it will be useful , <nl> + / / but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + / / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + / / GNU General Public License 2 . 0 for more details . <nl> + <nl> + / / A copy of the GPL 2 . 0 should have been included with the program . <nl> + / / If not , see http : / / www . gnu . org / licenses / <nl> + <nl> + / / Official git repository and contact information can be found at <nl> + / / https : / / github . com / hrydgard / ppsspp and http : / / www . ppsspp . org / . <nl> + <nl> + # ifndef CORE_FILE_SYS_DIRECTORY_H_ <nl> + # define CORE_FILE_SYS_DIRECTORY_H_ <nl> + <nl> + / / TODO : Remove the Windows - specific code , FILE is fine there too . <nl> + <nl> + # include < map > <nl> + <nl> + # include " file_sys . h " <nl> + <nl> + # ifdef _WIN32 <nl> + typedef void * HANDLE ; <nl> + # endif <nl> + <nl> + # if defined ( __APPLE__ ) <nl> + <nl> + # if TARGET_OS_IPHONE <nl> + # define HOST_IS_CASE_SENSITIVE 1 <nl> + # elif TARGET_IPHONE_SIMULATOR <nl> + # define HOST_IS_CASE_SENSITIVE 0 <nl> + # else <nl> + / / Mac OSX case sensitivity defaults off , but is user configurable ( when <nl> + / / creating a filesytem ) , so assume the worst : <nl> + # define HOST_IS_CASE_SENSITIVE 1 <nl> + # endif <nl> + <nl> + # elif defined ( _WIN32 ) | | defined ( __SYMBIAN32__ ) <nl> + # define HOST_IS_CASE_SENSITIVE 0 <nl> + <nl> + # else / / Android , Linux , BSD ( and the rest ? ) <nl> + # define HOST_IS_CASE_SENSITIVE 1 <nl> + <nl> + # endif <nl> + <nl> + # if HOST_IS_CASE_SENSITIVE <nl> + enum FixPathCaseBehavior { <nl> + FPC_FILE_MUST_EXIST , / / all path components must exist ( rmdir , move from ) <nl> + FPC_PATH_MUST_EXIST , / / all except the last one must exist - still tries to fix last one ( fopen , move to ) <nl> + FPC_PARTIAL_ALLOWED , / / don ' t care how many exist ( mkdir recursive ) <nl> + } ; <nl> + <nl> + bool FixPathCase ( std : : string & basePath , std : : string & path , FixPathCaseBehavior behavior ) ; <nl> + # endif <nl> + <nl> + struct DirectoryFileHandle <nl> + { <nl> + # ifdef _WIN32 <nl> + HANDLE hFile ; <nl> + # else <nl> + FILE * hFile ; <nl> + # endif <nl> + DirectoryFileHandle ( ) <nl> + { <nl> + # ifdef _WIN32 <nl> + hFile = ( HANDLE ) - 1 ; <nl> + # else <nl> + hFile = 0 ; <nl> + # endif <nl> + } <nl> + <nl> + std : : string GetLocalPath ( std : : string & basePath , std : : string localpath ) ; <nl> + bool Open ( std : : string & basePath , std : : string & fileName , FileAccess access ) ; <nl> + size_t Read ( u8 * pointer , s64 size ) ; <nl> + size_t Write ( const u8 * pointer , s64 size ) ; <nl> + size_t Seek ( s32 position , FileMove type ) ; <nl> + void Close ( ) ; <nl> + } ; <nl> + <nl> + class DirectoryFileSystem : public IFileSystem { <nl> + public : <nl> + DirectoryFileSystem ( IHandleAllocator * _hAlloc , std : : string _basePath ) ; <nl> + ~ DirectoryFileSystem ( ) ; <nl> + <nl> + void DoState ( PointerWrap & p ) ; <nl> + std : : vector < PSPFileInfo > GetDirListing ( std : : string path ) ; <nl> + u32 OpenFile ( std : : string filename , FileAccess access , const char * devicename = NULL ) ; <nl> + void CloseFile ( u32 handle ) ; <nl> + size_t ReadFile ( u32 handle , u8 * pointer , s64 size ) ; <nl> + size_t WriteFile ( u32 handle , const u8 * pointer , s64 size ) ; <nl> + size_t SeekFile ( u32 handle , s32 position , FileMove type ) ; <nl> + PSPFileInfo GetFileInfo ( std : : string filename ) ; <nl> + bool OwnsHandle ( u32 handle ) ; <nl> + <nl> + bool MkDir ( const std : : string & dirname ) ; <nl> + bool RmDir ( const std : : string & dirname ) ; <nl> + int RenameFile ( const std : : string & from , const std : : string & to ) ; <nl> + bool RemoveFile ( const std : : string & filename ) ; <nl> + bool GetHostPath ( const std : : string & inpath , std : : string & outpath ) ; <nl> + <nl> + private : <nl> + struct OpenFileEntry { <nl> + DirectoryFileHandle hFile ; <nl> + } ; <nl> + <nl> + typedef std : : map < u32 , OpenFileEntry > EntryMap ; <nl> + EntryMap entries ; <nl> + std : : string basePath ; <nl> + IHandleAllocator * hAlloc ; <nl> + <nl> + / / In case of Windows : Translate slashes , etc . <nl> + std : : string GetLocalPath ( std : : string localpath ) ; <nl> + } ; <nl> + <nl> + / / VFSFileSystem : Ability to map in Android APK paths as well ! Does not support all features , only meant for fonts . <nl> + / / Very inefficient - always load the whole file on open . <nl> + class VFSFileSystem : public IFileSystem { <nl> + public : <nl> + VFSFileSystem ( IHandleAllocator * _hAlloc , std : : string _basePath ) ; <nl> + ~ VFSFileSystem ( ) ; <nl> + <nl> + void DoState ( PointerWrap & p ) ; <nl> + std : : vector < PSPFileInfo > GetDirListing ( std : : string path ) ; <nl> + u32 OpenFile ( std : : string filename , FileAccess access , const char * devicename = NULL ) ; <nl> + void CloseFile ( u32 handle ) ; <nl> + size_t ReadFile ( u32 handle , u8 * pointer , s64 size ) ; <nl> + size_t WriteFile ( u32 handle , const u8 * pointer , s64 size ) ; <nl> + size_t SeekFile ( u32 handle , s32 position , FileMove type ) ; <nl> + PSPFileInfo GetFileInfo ( std : : string filename ) ; <nl> + bool OwnsHandle ( u32 handle ) ; <nl> + <nl> + bool MkDir ( const std : : string & dirname ) ; <nl> + bool RmDir ( const std : : string & dirname ) ; <nl> + int RenameFile ( const std : : string & from , const std : : string & to ) ; <nl> + bool RemoveFile ( const std : : string & filename ) ; <nl> + bool GetHostPath ( const std : : string & inpath , std : : string & outpath ) ; <nl> + <nl> + private : <nl> + struct OpenFileEntry { <nl> + u8 * fileData ; <nl> + size_t size ; <nl> + size_t seekPos ; <nl> + } ; <nl> + <nl> + typedef std : : map < u32 , OpenFileEntry > EntryMap ; <nl> + EntryMap entries ; <nl> + std : : string basePath ; <nl> + IHandleAllocator * hAlloc ; <nl> + <nl> + std : : string GetLocalPath ( std : : string localpath ) ; <nl> + } ; <nl> + <nl> + # endif / / CORE_FILE_SYS_DIRECTORY_H_ <nl>
ppsspp file system module - currently unused
yuzu-emu/yuzu
80b85ee7e6ca605820dfe3d983cf80c071330527
2013-09-20T03:28:34Z
mmm a / src / core / hle / service / am / am . cpp <nl> ppp b / src / core / hle / service / am / am . cpp <nl> class ILibraryAppletAccessor final : public ServiceFramework < ILibraryAppletAcces <nl> void GetAppletStateChangedEvent ( Kernel : : HLERequestContext & ctx ) { <nl> LOG_DEBUG ( Service_AM , " called " ) ; <nl> <nl> - applet - > GetBroker ( ) . SignalStateChanged ( ) ; <nl> const auto event = applet - > GetBroker ( ) . GetStateChangedEvent ( ) ; <nl> <nl> IPC : : ResponseBuilder rb { ctx , 2 , 1 } ; <nl> mmm a / src / core / hle / service / am / applets / applets . cpp <nl> ppp b / src / core / hle / service / am / applets / applets . cpp <nl> namespace Service : : AM : : Applets { <nl> AppletDataBroker : : AppletDataBroker ( ) { <nl> auto & kernel = Core : : System : : GetInstance ( ) . Kernel ( ) ; <nl> state_changed_event = Kernel : : WritableEvent : : CreateEventPair ( <nl> - kernel , Kernel : : ResetType : : OneShot , " ILibraryAppletAccessor : StateChangedEvent " ) ; <nl> + kernel , Kernel : : ResetType : : Sticky , " ILibraryAppletAccessor : StateChangedEvent " ) ; <nl> pop_out_data_event = Kernel : : WritableEvent : : CreateEventPair ( <nl> - kernel , Kernel : : ResetType : : OneShot , " ILibraryAppletAccessor : PopDataOutEvent " ) ; <nl> + kernel , Kernel : : ResetType : : Sticky , " ILibraryAppletAccessor : PopDataOutEvent " ) ; <nl> pop_interactive_out_data_event = Kernel : : WritableEvent : : CreateEventPair ( <nl> - kernel , Kernel : : ResetType : : OneShot , " ILibraryAppletAccessor : PopInteractiveDataOutEvent " ) ; <nl> + kernel , Kernel : : ResetType : : Sticky , " ILibraryAppletAccessor : PopInteractiveDataOutEvent " ) ; <nl> } <nl> <nl> AppletDataBroker : : ~ AppletDataBroker ( ) = default ; <nl> mmm a / src / core / hle / service / am / applets / software_keyboard . cpp <nl> ppp b / src / core / hle / service / am / applets / software_keyboard . cpp <nl> void SoftwareKeyboard : : WriteText ( std : : optional < std : : u16string > text ) { <nl> <nl> if ( complete ) { <nl> broker . PushNormalDataFromApplet ( IStorage { output_main } ) ; <nl> + broker . SignalStateChanged ( ) ; <nl> } else { <nl> broker . PushInteractiveDataFromApplet ( IStorage { output_sub } ) ; <nl> } <nl> - <nl> - broker . SignalStateChanged ( ) ; <nl> } else { <nl> output_main [ 0 ] = 1 ; <nl> complete = true ; <nl>
applets : Correct usage of SignalStateChanged event
yuzu-emu/yuzu
0d2ba2ca4c43aeadf5f65dfbc978f20ff3bf0a2c
2018-12-10T00:46:15Z