diff --git a/.gitignore b/.gitignore index c968f47c7..e4c55cefb 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,7 @@ local.properties .builds *.dotCover *.dll +!d3dcompiler_47.dll *.lib *.exp *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index a94931c74..0f1be940a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,6 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo;Release" CACHE STRING "" FOR include("${CMAKE_SOURCE_DIR}/Tools/CMake/torque_macros.cmake") include("${CMAKE_SOURCE_DIR}/Tools/CMake/torque_configs.cmake") -file(GLOB OS_SCRIPTS "${CMAKE_SOURCE_DIR}/Tools/CMake/torque*configs.cmake") -foreach (TORQUE_OS_SCRIPT ${OS_SCRIPTS}) - include(${TORQUE_OS_SCRIPT}) -endforeach() # Ensure multi-core compilation is enabled for everything add_compile_options($<$:/MP>) @@ -27,9 +23,10 @@ set(TORQUE_APP_GAME_DIRECTORY "${TORQUE_APP_ROOT_DIRECTORY}/game") #library handling set(TORQUE_LIB_ROOT_DIRECTORY "${CMAKE_SOURCE_DIR}/Engine/lib") set(TORQUE_LIB_TARG_DIRECTORY "${CMAKE_BINARY_DIR}/Engine/lib") +set(TORQUE_SOURCE_DIRECTROY "${CMAKE_SOURCE_DIR}/Engine/source") # Ensure all possible configurations end up in the project directory -set(CMAKE_INSTALL_PREFIX "${TORQUE_APP_ROOT_DIRECTORY}") +set(CMAKE_INSTALL_PREFIX "${TORQUE_APP_ROOT_DIRECTORY}" CACHE STRING "" FORCE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${TORQUE_APP_GAME_DIRECTORY}") foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG ) @@ -73,4 +70,8 @@ endif(NOT TORQUE_INSTALLED_TEMPLATE) # Generate torqueConfig.h in our temp directory configure_file("${CMAKE_SOURCE_DIR}/Tools/CMake/torqueConfig.h.in" "${TORQUE_APP_ROOT_DIRECTORY}/source/torqueConfig.h") +if(APPLE) +include("${CMAKE_SOURCE_DIR}/Tools/CMake/torqueMacOSconfigs.cmake") +endif(APPLE) + add_subdirectory(Engine) diff --git a/Engine/lib/CMakeLists.txt b/Engine/lib/CMakeLists.txt index 318c333bc..6a3c9985d 100644 --- a/Engine/lib/CMakeLists.txt +++ b/Engine/lib/CMakeLists.txt @@ -110,6 +110,7 @@ mark_as_advanced(SDL_X11) mark_as_advanced(SDL_XINPUT) add_subdirectory(sdl ${TORQUE_LIB_TARG_DIRECTORY}/sdl2 EXCLUDE_FROM_ALL) + add_subdirectory(nativeFileDialogs ${TORQUE_LIB_TARG_DIRECTORY}/nfd EXCLUDE_FROM_ALL) # Assimp @@ -153,10 +154,17 @@ mark_as_advanced(ASSIMP_PACKAGE_VERSION) mark_as_advanced(ASSIMP_RUNTIME_OUTPUT_DIRECTORY) add_subdirectory(assimp ${TORQUE_LIB_TARG_DIRECTORY}/assimp EXCLUDE_FROM_ALL) target_compile_definitions(assimp PUBLIC ASSIMP_BUILD_NO_OWN_ZLIB) + if (TORQUE_CPU_ARM32 OR TORQUE_CPU_ARM64) - set(PNG_ARM_NEON on CACHE BOOL "" FORCE) + if(NOT APPLE) + set(PNG_ARM_NEON on CACHE BOOL "" FORCE) + endif(NOT APPLE) endif (TORQUE_CPU_ARM32 OR TORQUE_CPU_ARM64) +if(APPLE) + set(PNG_ARM_NEON off CACHE BOOL "" FORCE) +endif() + #PNG set(PNG_STATIC on CACHE BOOL "" FORCE) mark_as_advanced(PNG_STATIC) @@ -168,10 +176,12 @@ set(PNG_TESTS off CACHE BOOL "" FORCE) mark_as_advanced(PNG_TESTS) set(PNG_HARDWARE_OPTIMIZATIONS on CACHE BOOL "" FORCE) mark_as_advanced(PNG_HARDWARE_OPTIMIZATIONS) + if(APPLE) set(PNG_FRAMEWORK on CACHE BOOL "" FORCE) addDef(PNG_DEBUG Debug) endif() + mark_as_advanced(PNG_DEBUG) mark_as_advanced(PNG_FRAMEWORK) mark_as_advanced(PNG_PREFIX) diff --git a/Engine/lib/Torque_postBuild.cmake b/Engine/lib/Torque_postBuild.cmake index d5863dd61..d8430e112 100644 --- a/Engine/lib/Torque_postBuild.cmake +++ b/Engine/lib/Torque_postBuild.cmake @@ -2,9 +2,9 @@ # When on Windows, we need to link against winsock and windows codecs if (WIN32) - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} WS2_32.LIB windowscodecs.lib) + set(TORQUE_LINK_WINDOWS ${TORQUE_LINK_WINDOWS} WS2_32.LIB windowscodecs.lib) if (TORQUE_D3D11) - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} dxguid.lib) + set(TORQUE_LINK_WINDOWS ${TORQUE_LINK_WINDOWS} dxguid.lib) endif (TORQUE_D3D11) endif (WIN32) @@ -19,7 +19,7 @@ if (APPLE) addFramework("IOKit") #grrr damn you sdl! addFramework("Carbon") - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} iconv) + set(TORQUE_LINK_FRAMEWORKS ${TORQUE_LINK_FRAMEWORKS} iconv) if(NOT TORQUE_DEDICATED) addFramework("OpenGL") addFramework("CoreVideo") @@ -36,8 +36,8 @@ set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} nativeFileDialogs) # Linux requires X11 & freetype if (UNIX AND NOT APPLE) - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} "X11" "Xft" "dl" "pthread") + set(TORQUE_LINK_LINUX ${TORQUE_LINK_LINUX} "X11" "Xft" "dl" "pthread") find_package(Freetype REQUIRED) set(TORQUE_INCLUDE_DIRECTORIES ${TORQUE_INCLUDE_DIRECTORIES} ${FREETYPE_INCLUDE_DIRS}) - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} ${FREETYPE_LIBRARIES}) + set(TORQUE_LINK_LINUX ${TORQUE_LINK_LINUX} ${FREETYPE_LIBRARIES}) endif (UNIX AND NOT APPLE) \ No newline at end of file diff --git a/Engine/lib/nativeFileDialogs/CMakeLists.txt b/Engine/lib/nativeFileDialogs/CMakeLists.txt index 1d0454bc6..606be00fc 100644 --- a/Engine/lib/nativeFileDialogs/CMakeLists.txt +++ b/Engine/lib/nativeFileDialogs/CMakeLists.txt @@ -5,7 +5,9 @@ set(TORQUE_NFD_COMMON_SOURCES "${TORQUE_NFD_ROOT}/nfd_common.c") set(TORQUE_NFD_INCLUDE_DIRECTORIES "${TORQUE_NFD_ROOT}" "${TORQUE_NFD_ROOT}/include") if (APPLE) + enable_language(OBJC) set(TORQUE_NFD_SOURCES ${TORQUE_NFD_COMMON_SOURCES} "${TORQUE_NFD_ROOT}/nfd_cocoa.m") + set_source_files_properties(${TORQUE_NFD_SOURCES} PROPERTIES LANGUAGE OBJC) elseif (UNIX) if (TORQUE_USE_ZENITY) set(TORQUE_NFD_SOURCES ${TORQUE_NFD_COMMON_SOURCES} "${TORQUE_NFD_ROOT}/nfd_zenity.c") diff --git a/Engine/lib/nativeFileDialogs/nfd_cocoa.m b/Engine/lib/nativeFileDialogs/nfd_cocoa.m index 776152d41..1e51d4efb 100644 --- a/Engine/lib/nativeFileDialogs/nfd_cocoa.m +++ b/Engine/lib/nativeFileDialogs/nfd_cocoa.m @@ -64,7 +64,7 @@ static void SetDefaultPath( NSSavePanel *dialog, const nfdchar_t *defaultPath ) NSString *defaultPathString = [NSString stringWithUTF8String: defaultPath]; NSURL *url = [NSURL fileURLWithPath:defaultPathString isDirectory:YES]; - [dialog setDirectoryURL:url]; + [dialog setDirectoryURL:url]; } @@ -76,7 +76,7 @@ static nfdresult_t AllocPathSet( NSArray *urls, nfdpathset_t *pathset ) pathset->count = (size_t)[urls count]; pathset->indices = NFDi_Malloc( sizeof(size_t)*pathset->count ); - if ( !pathset->indices ) + if ( !pathset->indices ) { return NFD_ERROR; } @@ -125,7 +125,7 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList, { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; [dialog setAllowsMultipleSelection:NO]; @@ -148,7 +148,7 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList, if ( !*outPath ) { [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return NFD_ERROR; } memcpy( *outPath, utf8Path, len+1 ); /* copy null term */ @@ -185,14 +185,14 @@ nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList, if ( [urls count] == 0 ) { [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return NFD_CANCEL; } if ( AllocPathSet( urls, outPaths ) == NFD_ERROR ) { [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return NFD_ERROR; } @@ -200,7 +200,7 @@ nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList, } [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return nfdResult; } @@ -233,7 +233,7 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, if ( !*outPath ) { [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return NFD_ERROR; } memcpy( *outPath, utf8Path, byteLen ); @@ -273,7 +273,7 @@ nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, if ( !*outPath ) { [pool release]; - [keyWindow makeKeyAndOrderFront:nil]; + [keyWindow makeKeyAndOrderFront:nil]; return NFD_ERROR; } memcpy( *outPath, utf8Path, len+1 ); /* copy null term */ diff --git a/Engine/source/CMakeLists.txt b/Engine/source/CMakeLists.txt index 3ec15127a..f5ff160b7 100644 --- a/Engine/source/CMakeLists.txt +++ b/Engine/source/CMakeLists.txt @@ -57,7 +57,6 @@ torqueAddSourceDirectories("platform" "platform/threads" "platform/async" "platform/input" "platform/output") torqueAddSourceDirectories("platform/nativeDialogs") - # Handle T3D torqueAddSourceDirectories("T3D/fps" "T3D/fx" "T3D/vehicles" "T3D/physics" "T3D/decal" "T3D/sfx" "T3D/gameBase" "T3D/turret" @@ -151,6 +150,12 @@ endif (TORQUE_OPENGL) # Handle terrain torqueAddSourceDirectories("terrain") +# Handle theora +if (TORQUE_THEORA) + torqueAddSourceDirectories("core/ogg") + torqueAddSourceDirectories("gui/theora") +endif(TORQUE_THEORA) + if (WIN32 AND TORQUE_D3D11) torqueAddSourceDirectories("terrain/hlsl") endif (WIN32 AND TORQUE_D3D11) @@ -199,9 +204,11 @@ torqueAddSourceDirectories("i18n") if (UNIX) torqueAddSourceDirectories("platformPOSIX") - if (TORQUE_CPU_X32 OR TORQUE_CPU_X64) - torqueAddSourceDirectories("platformX86UNIX") - endif (TORQUE_CPU_X32 OR TORQUE_CPU_X64) + if(NOT APPLE) + if (TORQUE_CPU_X32 OR TORQUE_CPU_X64) + torqueAddSourceDirectories("platformX86UNIX") + endif (TORQUE_CPU_X32 OR TORQUE_CPU_X64) + endif(NOT APPLE) endif (UNIX) # Handle platformMac @@ -308,8 +315,23 @@ endif (WIN32) # Prepare OSX Plist if (APPLE) - set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_PLATFORM_MAC_SOURCES} "${CMAKE_SOURCE_DIR}/Tools/CMake/torque.icns") - set_source_files_properties("${CMAKE_SOURCE_DIR}/Tools/CMake/torque.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") + set(MACOSX_RESOURCES "${CMAKE_SOURCE_DIR}/Tools/CMake/torque.icns" + "${TORQUE_APP_GAME_DIRECTORY}/data" + "${TORQUE_APP_GAME_DIRECTORY}/core" + "${TORQUE_APP_GAME_DIRECTORY}/tools" + "${TORQUE_APP_GAME_DIRECTORY}/main.${TORQUE_SCRIPT_EXTENSION}" + "${TORQUE_APP_GAME_DIRECTORY}/${TORQUE_APP_NAME}.torsion" + "${TORQUE_APP_GAME_DIRECTORY}/Template.torsion.exports") + + if(TORQUE_TESTING) + set(MACOSX_RESOURCES ${MACOSX_RESOURCES} "${TORQUE_APP_GAME_DIRECTORY}/runTests.${TORQUE_SCRIPT_EXTENSION}") + endif() + + set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_PLATFORM_MAC_SOURCES} ${MACOSX_RESOURCES}) + + source_group("Resources" FILES ${MACOSX_RESOURCES}) + + set_source_files_properties(${MACOSX_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set(EXECUTABLE_NAME "${TORQUE_APP_NAME}") configure_file("${CMAKE_SOURCE_DIR}/Tools/CMake/Info.plist.in" "${TORQUE_APP_ROOT_DIRECTORY}/source/Info.plist" COPYONLY) @@ -321,6 +343,10 @@ addDef(TORQUE_ENABLE_ASSERTS "Debug;RelWithDebInfo") addDef(TORQUE_DEBUG_GFX_MODE "RelWithDebInfo") addDef(TORQUE_OGGVORBIS) +if (TORQUE_THEORA) + addDef(TORQUE_OGGTHEORA) +endif(TORQUE_THEORA) + if(NOT TORQUE_SDL) filterOut("platform/nativeDialogs/fileDialog.cpp" ) endif() @@ -351,10 +377,19 @@ endif (TORQUE_DYNAMIC_LIBRARY AND NOT TORQUE_TESTING) if (APPLE) add_executable(${TORQUE_APP_NAME} MACOSX_BUNDLE ${TORQUE_SOURCE_FILES}) - set_target_properties(${TORQUE_APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${TORQUE_APP_ROOT_DIRECTORY}/source/Info.plist") + set_target_properties(${TORQUE_APP_NAME} PROPERTIES + BUNDLE true + MACOSX_BUNDLE_INFO_PLIST "${TORQUE_APP_ROOT_DIRECTORY}/source/Info.plist" + XCODE_ATTRIBUTE_INSTALL_PATH "/Applications" + XCODE_ATTRIBUTE_SKIP_INSTALL "No" + XCODE_ATTRIBUTE_LINKER_DISPLAYS_MANGLED_NAMES[variant=Debug] YES + XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] YES + XCODE_ATTRIBUTE_ENABLE_TESTABILITY[variant=Debug] YES + XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=Debug] parent + XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=RelWithDebInfo] parent + XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=Release] resource + MACOSX_RPATH TRUE) - # Ensure the shared libraries are actually referenced at the correct path - set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks") elseif (WIN32) add_executable(${TORQUE_APP_NAME} WIN32 ${TORQUE_SOURCE_FILES}) @@ -401,8 +436,29 @@ if(MSVC) set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${TORQUE_APP_NAME}) endif() +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +foreach (TORQUE_LIBRARY ${TORQUE_LINK_LIBRARIES}) + set_target_properties(${TORQUE_LIBRARY} PROPERTIES + FOLDER "Libraries") + # remove warnings from 3rd parties. + target_compile_options(${TORQUE_LIBRARY} PRIVATE "-w") +endforeach() + target_compile_definitions(${TORQUE_APP_NAME} PUBLIC ${TORQUE_COMPILE_DEFINITIONS}) target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_LIBRARIES}) + +if(APPLE) + target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_FRAMEWORKS}) +endif(APPLE) + +if(WIN32) + target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_WINDOWS}) +endif(WIN32) + +if(UNIX AND NOT APPLE) + target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_LINUX}) +endif(UNIX AND NOT APPLE) + target_link_options(${TORQUE_APP_NAME} PUBLIC ${TORQUE_LINK_OPTIONS}) if (TORQUE_TARGET_PROPERTIES) set_target_properties(${TORQUE_APP_NAME} PROPERTIES ${TORQUE_TARGET_PROPERTIES}) @@ -425,7 +481,7 @@ append_defs() foreach (LIBRARY_BINARY ${TORQUE_ADDITIONAL_LIBRARY_BINARIES}) if (APPLE) # For OSX, we want these binaries to be copied to the Frameworks directory - add_custom_command(TARGET ${TORQUE_APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_BINARY} "${TORQUE_APP_GAME_DIRECTORY}/${TORQUE_APP_NAME}.app/Contents/Frameworks") + add_custom_command(TARGET ${TORQUE_APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_BINARY} "${TORQUE_APP_GAME_DIRECTORY}/${TORQUE_APP_NAME}.app/Contents/Frameworks/$(CONFIGURATION)") else() # All other platforms expect the file next to the executable add_custom_command(TARGET ${TORQUE_APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_BINARY} "${TORQUE_APP_GAME_DIRECTORY}") @@ -442,11 +498,11 @@ if (UNIX) # For eg. OSX some links are not valid targets - for example frameworks provided by OS if (TARGET ${GAME_LINK_LIBRARY}) get_target_property(LINK_LIBRARY_TYPE ${GAME_LINK_LIBRARY} TYPE) - # Only pay attention to shared libraries and make them output to the app resources if ("${LINK_LIBRARY_TYPE}" STREQUAL "SHARED_LIBRARY") if (APPLE) - set_target_properties(${GAME_LINK_LIBRARY} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TORQUE_APP_GAME_DIRECTORY}/${TORQUE_APP_NAME}.app/Contents/Frameworks") + set_target_properties(${GAME_LINK_LIBRARY} PROPERTIES + XCODE_ATTRIBUTE_INSTALL_PATH "@rpath") else() set_target_properties(${GAME_LINK_LIBRARY} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TORQUE_APP_GAME_DIRECTORY}") endif(APPLE) diff --git a/Engine/source/T3D/accumulationVolume.h b/Engine/source/T3D/accumulationVolume.h index 4c4049b6c..85b78cb53 100644 --- a/Engine/source/T3D/accumulationVolume.h +++ b/Engine/source/T3D/accumulationVolume.h @@ -74,7 +74,7 @@ class AccumulationVolume : public ScenePolyhedralSpace // SimObject. DECLARE_CONOBJECT( AccumulationVolume ); DECLARE_DESCRIPTION( "Allows objects in an area to have accumulation effect applied." ); - DECLARE_CATEGORY( "3D Scene" ); + DECLARE_CATEGORY("Volume"); virtual bool onAdd(); virtual void onRemove(); diff --git a/Engine/source/T3D/aiPlayer.h b/Engine/source/T3D/aiPlayer.h index 524b0ba16..adeb3a009 100644 --- a/Engine/source/T3D/aiPlayer.h +++ b/Engine/source/T3D/aiPlayer.h @@ -150,6 +150,7 @@ protected: public: DECLARE_CONOBJECT( AIPlayer ); + DECLARE_CATEGORY("Actor \t AI"); AIPlayer(); ~AIPlayer(); diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 325acfe09..af03cfe2d 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -207,8 +207,7 @@ U32 ImageAsset::getAssetByFilename(StringTableEntry fileName, AssetPtrsetAssetId(query.mAssetList[0]); - (*imageAsset)->loadImage(); - return (*imageAsset)->mLoadedState; + return (*imageAsset)->load(); } } @@ -240,23 +239,18 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr* ima if (imageAsset->notNull()) { - (*imageAsset)->loadImage(); - return (*imageAsset)->mLoadedState; + return (*imageAsset)->load(); } else { if (imageAsset->isNull()) { - (*imageAsset)->loadImage(); - //Well that's bad, loading the fallback failed. - Con::warnf("ImageAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId); return AssetErrCode::Failed; } - //handle noshape not being loaded itself + //handle fallback not being loaded itself if ((*imageAsset)->mLoadedState == BadFileReference) { - (*imageAsset)->loadImage(); Con::warnf("ImageAsset::getAssetById - Finding of asset with id %s failed, and fallback asset reported error of Bad File Reference.", assetId); return AssetErrCode::BadFileReference; } @@ -275,25 +269,26 @@ void ImageAsset::copyTo(SimObject* object) Parent::copyTo(object); } -void ImageAsset::loadImage() +U32 ImageAsset::load() { - if (mLoadedState == AssetErrCode::Ok) return; + if (mLoadedState == AssetErrCode::Ok) return mLoadedState; if (mImagePath) { if (!Torque::FS::IsFile(mImagePath)) { Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName); mLoadedState = BadFileReference; - return; + return mLoadedState; } mLoadedState = Ok; mIsValidImage = true; - return; + return mLoadedState; } mLoadedState = BadFileReference; mIsValidImage = false; + return mLoadedState; } void ImageAsset::initializeAsset() @@ -330,11 +325,6 @@ void ImageAsset::setImageFileName(const char* pScriptFile) refreshAsset(); } -const GBitmap& ImageAsset::getImage() -{ - return GBitmap(); //TODO fix this -} - GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile) { if (mResourceMap.contains(requestedProfile)) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index c4826a0ef..d5b3b0b48 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -136,7 +136,6 @@ public: bool isValid() { return mIsValidImage; } - const GBitmap& getImage(); GFXTexHandle getTexture(GFXTextureProfile* requestedProfile); StringTableEntry getImageInfo(); @@ -152,14 +151,14 @@ public: static U32 getAssetById(StringTableEntry assetId, AssetPtr* imageAsset); static U32 getAssetById(String assetId, AssetPtr* imageAsset) { return getAssetById(assetId.c_str(), imageAsset); }; + U32 load(); + protected: virtual void initializeAsset(void); virtual void onAssetRefresh(void); static bool setImageFileName(void* obj, StringTableEntry index, StringTableEntry data) { static_cast(obj)->setImageFileName(data); return false; } static StringTableEntry getImageFileName(void* obj, StringTableEntry data) { return static_cast(obj)->getImageFileName(); } - - void loadImage(); }; DefineConsoleType(TypeImageAssetPtr, ImageAsset) diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 363d7bc30..02f0a163a 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -206,7 +206,7 @@ void MaterialAsset::initializeAsset() } } - loadMaterial(); + load(); } void MaterialAsset::onAssetRefresh() @@ -236,7 +236,7 @@ void MaterialAsset::onAssetRefresh() Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str()); } - loadMaterial(); + load(); } void MaterialAsset::setScriptFile(const char* pScriptFile) @@ -255,7 +255,7 @@ void MaterialAsset::setScriptFile(const char* pScriptFile) //------------------------------------------------------------------------------ -void MaterialAsset::loadMaterial() +U32 MaterialAsset::load() { if (mMaterialDefinition) { @@ -274,7 +274,7 @@ void MaterialAsset::loadMaterial() mLoadedState = Ok; mMaterialDefinition->setInternalName(getAssetId()); mMaterialDefinition->reload(); - return; + return mLoadedState; } } } @@ -286,7 +286,7 @@ void MaterialAsset::loadMaterial() { Con::errorf("MaterialAsset: Unable to find the Material %s", mMatDefinitionName); mLoadedState = BadFileReference; - return; + return mLoadedState; } mMaterialDefinition = matDef; @@ -294,10 +294,11 @@ void MaterialAsset::loadMaterial() mLoadedState = Ok; mMaterialDefinition->setInternalName(getAssetId()); mMaterialDefinition->reload(); - return; + return mLoadedState; } mLoadedState = Failed; + return mLoadedState; } //------------------------------------------------------------------------------ diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index d51f6dabb..4fa868ff7 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -104,7 +104,7 @@ public: static void initPersistFields(); virtual void copyTo(SimObject* object); - void loadMaterial(); + U32 load(); StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; } SimObjectPtr getMaterialDefinition() { return mMaterialDefinition; } diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 7958212c7..4197b0100 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -308,9 +308,9 @@ void ShapeAsset::_onResourceChanged(const Torque::Path &path) onAssetRefresh(); } -bool ShapeAsset::loadShape() +U32 ShapeAsset::load() { - if (mLoadedState == AssetErrCode::Ok) return true; + if (mLoadedState == AssetErrCode::Ok) return mLoadedState; mMaterialAssets.clear(); mMaterialAssetIds.clear(); @@ -357,7 +357,7 @@ bool ShapeAsset::loadShape() { Con::errorf("ShapeAsset::loadShape : failed to load shape file %s (%s)!", getAssetName(), mFilePath); mLoadedState = BadFileReference; - return false; //if it failed to load, bail out + return mLoadedState; //if it failed to load, bail out } // Construct billboards if not done already if (GFXDevice::devicePresent()) @@ -379,7 +379,7 @@ bool ShapeAsset::loadShape() mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms())) { mLoadedState = MissingAnimatons; - return false; + return mLoadedState; } if (mAnimationAssets[i]->isBlend()) hasBlends = true; @@ -402,7 +402,7 @@ bool ShapeAsset::loadShape() Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName()); { mLoadedState = MissingAnimatons; - return false; + return mLoadedState; } } @@ -412,7 +412,7 @@ bool ShapeAsset::loadShape() Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to set animation clip %s for asset %s to blend!", mAnimationAssets[i]->getAnimationName(), mAnimationAssets[i]->getAssetName()); { mLoadedState = MissingAnimatons; - return false; + return mLoadedState; } } } @@ -422,7 +422,7 @@ bool ShapeAsset::loadShape() mChangeSignal.trigger(); mLoadedState = Ok; - return true; + return mLoadedState; } //------------------------------------------------------------------------------ @@ -706,7 +706,7 @@ DefineEngineMethod(ShapeAsset, generateCachedPreviewImage, const char*, (S32 res "@param resolution Optional field for what resolution to bake the preview image at. Must be pow2\n" "@param overrideMaterialName Optional field for overriding the material used when rendering the shape for the bake.") { - object->loadShape(); + object->load(); return object->generateCachedPreviewImage(resolution, overrideMaterialName); } diff --git a/Engine/source/T3D/assets/ShapeAsset.h b/Engine/source/T3D/assets/ShapeAsset.h index abeb13c39..29a72e2bf 100644 --- a/Engine/source/T3D/assets/ShapeAsset.h +++ b/Engine/source/T3D/assets/ShapeAsset.h @@ -132,11 +132,11 @@ public: /// Declare Console Object. DECLARE_CONOBJECT(ShapeAsset); - bool loadShape(); + U32 load(); TSShape* getShape() { return mShape; } - Resource getShapeResource() { loadShape(); return mShape; } + Resource getShapeResource() { load(); return mShape; } void SplitSequencePathAndName(String& srcPath, String& srcName); StringTableEntry getShapeFileName() { return mFileName; } diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp index dd6ab9a0a..d9aeb7f4a 100644 --- a/Engine/source/T3D/assets/SoundAsset.cpp +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -44,6 +44,10 @@ #include "sfx/sfxSource.h" #endif +#ifndef _SFXPROFILE_H_ +#include "sfx/sfxProfile.h" +#endif // !_SFXPROFILE_H_ + // Debug Profiling. #include "platform/profiler.h" #include "sfx/sfxTypes.h" @@ -119,8 +123,28 @@ const String SoundAsset::mErrCodeStrings[] = SoundAsset::SoundAsset() : AssetBase() { - mSoundFile = StringTable->EmptyString(); - mSoundPath = StringTable->EmptyString(); + dMemset(mPlaylist.mSlots.mReplayMode, 0, sizeof(mPlaylist.mSlots.mReplayMode)); + dMemset(mPlaylist.mSlots.mTransitionIn, 0, sizeof(mPlaylist.mSlots.mTransitionIn)); + dMemset(mPlaylist.mSlots.mRepeatCount, 0, sizeof(mPlaylist.mSlots.mRepeatCount)); + dMemset(mPlaylist.mSlots.mState, 0, sizeof(mPlaylist.mSlots.mState)); + dMemset(mPlaylist.mSlots.mTrack, 0, sizeof(mPlaylist.mSlots.mTrack)); + dMemset(mPlaylist.mSlots.mStateMode, 0, sizeof(mPlaylist.mSlots.mStateMode)); + + for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++) + { + mSoundFile[i] = StringTable->EmptyString(); + mSoundPath[i] = StringTable->EmptyString(); + + mPlaylist.mSlots.mTransitionOut[i] = SFXPlayList::TRANSITION_Wait; + mPlaylist.mSlots.mVolumeScale.mValue[i] = 1.f; + mPlaylist.mSlots.mPitchScale.mValue[i] = 1.f; + mPlaylist.mSlots.mFadeTimeIn.mValue[i] = -1.f; // Don't touch by default. + mPlaylist.mSlots.mFadeTimeOut.mValue[i] = -1.f; // Don't touch by default. + mPlaylist.mSlots.mMinDistance.mValue[i] = -1.f; // Don't touch by default. + mPlaylist.mSlots.mMaxDistance.mValue[i] = -1.f; // Don't touch by default. + + } + mSubtitleString = StringTable->EmptyString(); mLoadedState = AssetErrCode::NotLoaded; @@ -143,6 +167,14 @@ SoundAsset::SoundAsset() mProfileDesc.mPriority = 1.0f; mProfileDesc.mSourceGroup = NULL; + mIsPlaylist = false; + + mPlaylist.mNumSlotsToPlay = SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; + mPlaylist.mRandomMode = SFXPlayList::RANDOM_NotRandom; + mPlaylist.mTrace = false; + mPlaylist.mLoopMode = SFXPlayList::LOOP_All; + mPlaylist.mActiveSlots = 12; + } //----------------------------------------------------------------------------- @@ -158,9 +190,79 @@ void SoundAsset::initPersistFields() docsURL; // Call parent. Parent::initPersistFields(); + addArray("slots", SFXPlayList::SFXPlaylistSettings::NUM_SLOTS); + addProtectedField("soundFile", TypeAssetLooseFilePath, Offset(mSoundFile, SoundAsset), + &_setSoundFile, &_getSoundFile, SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, "Path to the sound file."); - addProtectedField("soundFile", TypeAssetLooseFilePath, Offset(mSoundFile, SoundAsset), - &setSoundFile, &getSoundFile, "Path to the sound file."); + addField("replay", TYPEID< SFXPlayList::EReplayMode >(), Offset(mPlaylist.mSlots.mReplayMode, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Behavior when an already playing sound is encountered on this slot from a previous cycle.\n" + "Each slot can have an arbitrary number of sounds playing on it from previous cycles. This field determines " + "how SFXController will handle these sources."); + addField("transitionIn", TYPEID< SFXPlayList::ETransitionMode >(), Offset(mPlaylist.mSlots.mTransitionIn, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Behavior when moving into this slot.\n" + "After the delayIn time has expired (if any), this slot determines what the controller " + "will do before actually playing the slot."); + addField("transitionOut", TYPEID< SFXPlayList::ETransitionMode >(), Offset(mPlaylist.mSlots.mTransitionOut, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Behavior when moving out of this slot.\n" + "After the #detailTimeOut has expired (if any), this slot determines what the controller " + "will do before moving on to the next slot."); + addField("delayTimeIn", TypeF32, Offset(mPlaylist.mSlots.mDelayTimeIn.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Seconds to wait after moving into slot before #transitionIn."); + addField("delayTimeInVariance", TypePoint2F, Offset(mPlaylist.mSlots.mDelayTimeIn.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #delayTimeIn.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("delayTimeOut", TypeF32, Offset(mPlaylist.mSlots.mDelayTimeOut.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Seconds to wait before moving out of slot after #transitionOut."); + addField("delayTimeOutVariance", TypePoint2F, Offset(mPlaylist.mSlots.mDelayTimeOut.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #delayTimeOut.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("fadeTimeIn", TypeF32, Offset(mPlaylist.mSlots.mFadeTimeIn.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Seconds to fade sound in (-1 to use the track's own fadeInTime.)\n" + "@see SFXDescription::fadeTimeIn"); + addField("fadeTimeInVariance", TypePoint2F, Offset(mPlaylist.mSlots.mFadeTimeIn.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #fadeInTime.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("fadeTimeOut", TypeF32, Offset(mPlaylist.mSlots.mFadeTimeOut.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Seconds to fade sound out (-1 to use the track's own fadeOutTime.)\n" + "@see SFXDescription::fadeTimeOut"); + addField("fadeTimeOutVariance", TypePoint2F, Offset(mPlaylist.mSlots.mFadeTimeOut.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #fadeOutTime\n\n" + "@ref SFXPlayList_randomization\n"); + addField("referenceDistance", TypeF32, Offset(mPlaylist.mSlots.mMinDistance.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "@c referenceDistance to set for 3D sounds in this slot (<1 to use @c referenceDistance of track's own description).\n" + "@see SFXDescription::referenceDistance"); + addField("referenceDistanceVariance", TypePoint2F, Offset(mPlaylist.mSlots.mMinDistance.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #referenceDistance.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("maxDistance", TypeF32, Offset(mPlaylist.mSlots.mMaxDistance.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "@c maxDistance to apply to 3D sounds in this slot (<1 to use @c maxDistance of track's own description).\n" + "@see SFXDescription::maxDistance"); + addField("maxDistanceVariance", TypePoint2F, Offset(mPlaylist.mSlots.mMaxDistance.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #maxDistance.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("volumeScale", TypeF32, Offset(mPlaylist.mSlots.mVolumeScale.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Scale factor to apply to volume of sounds played on this list slot.\n" + "This value will scale the actual volume level set on the track assigned to the slot, i.e. a value of 0.5 will " + "cause the track to play at half-volume."); + addField("volumeScaleVariance", TypePoint2F, Offset(mPlaylist.mSlots.mVolumeScale.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #volumeScale.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("pitchScale", TypeF32, Offset(mPlaylist.mSlots.mPitchScale.mValue, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Scale factor to apply to pitch of sounds played on this list slot.\n" + "This value will scale the actual pitch set on the track assigned to the slot, i.e. a value of 0.5 will " + "cause the track to play at half its assigned speed."); + addField("pitchScaleVariance", TypePoint2F, Offset(mPlaylist.mSlots.mPitchScale.mVariance, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Bounds on randomization of #pitchScale.\n\n" + "@ref SFXPlayList_randomization\n"); + addField("repeatCount", TypeS32, Offset(mPlaylist.mSlots.mRepeatCount, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Number of times to loop this slot."); + addField("state", TypeSFXStateName, Offset(mPlaylist.mSlots.mState, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "State that must be active for this slot to play.\n\n" + "@ref SFXPlayList_states"); + addField("stateMode", TYPEID< SFXPlayList::EStateMode >(), Offset(mPlaylist.mSlots.mStateMode, SoundAsset), SFXPlayList::SFXPlaylistSettings::NUM_SLOTS, + "Behavior when assigned state is deactivated while slot is playing.\n\n" + "@ref SFXPlayList_states"); + endArray("slots"); addField("pitchAdjust", TypeF32, Offset(mProfileDesc.mPitch, SoundAsset), "Adjustment of the pitch value 1 is default."); addField("volumeAdjust", TypeF32, Offset(mProfileDesc.mVolume, SoundAsset), "Adjustment to the volume."); @@ -170,16 +272,33 @@ void SoundAsset::initPersistFields() addField("isStreaming", TypeBool, Offset(mProfileDesc.mIsStreaming, SoundAsset), "Use streaming."); //....why? addField("useHardware", TypeBool, Offset(mProfileDesc.mUseHardware, SoundAsset), "Use hardware mixing for this sound."); - addField("minDistance", TypeF32, Offset(mProfileDesc.mMinDistance, SoundAsset), "Minimum distance for sound."); - // more like it. - addField("maxDistance", TypeF32, Offset(mProfileDesc.mMaxDistance, SoundAsset), "Max distance for sound."); - addField("coneInsideAngle", TypeS32, Offset(mProfileDesc.mConeInsideAngle, SoundAsset), "Cone inside angle."); - addField("coneOutsideAngle", TypeS32, Offset(mProfileDesc.mConeOutsideAngle, SoundAsset), "Cone outside angle."); - addField("coneOutsideVolume", TypeF32, Offset(mProfileDesc.mConeOutsideVolume, SoundAsset), "Cone outside volume."); - addField("rolloffFactor", TypeF32, Offset(mProfileDesc.mRolloffFactor, SoundAsset), "Rolloff factor."); - addField("scatterDistance", TypePoint3F, Offset(mProfileDesc.mScatterDistance, SoundAsset), "Randomization to the spacial position of the sound."); addField("sourceGroup", TypeSFXSourceName, Offset(mProfileDesc.mSourceGroup, SoundAsset), "Group that sources playing with this description should be put into."); + addField("preload", TypeBool, Offset(mPreload, SoundAsset), "Whether to preload sound data when the profile is added to system."); + addGroup("Fading"); + addField("fadeInTime", TypeF32, Offset(mProfileDesc.mFadeInTime, SoundAsset), "Number of seconds to gradually fade in volume from zero when playback starts."); + addField("fadeOutTime", TypeF32, Offset(mProfileDesc.mFadeOutTime, SoundAsset), "Number of seconds to gradually fade out volume down to zero when playback is stopped or paused."); + addField("fadeInEase", TypeEaseF, Offset(mProfileDesc.mFadeInEase, SoundAsset), "Easing curve for fade-in transition."); + addField("fadeOutEase", TypeEaseF, Offset(mProfileDesc.mFadeOutEase, SoundAsset), "Easing curve for fade-out transition."); + addField("fadeLoops", TypeBool, Offset(mProfileDesc.mFadeLoops, SoundAsset), "Fade each cycle of a loop in and/or out; otherwise only fade-in first cycle."); + endGroup("Fading"); + + addGroup("3D"); + addField("minDistance", TypeF32, Offset(mProfileDesc.mMinDistance, SoundAsset), "Minimum distance for sound."); + addField("maxDistance", TypeF32, Offset(mProfileDesc.mMaxDistance, SoundAsset), "Max distance for sound."); + addField("coneInsideAngle", TypeS32, Offset(mProfileDesc.mConeInsideAngle, SoundAsset), "Cone inside angle."); + addField("coneOutsideAngle", TypeS32, Offset(mProfileDesc.mConeOutsideAngle, SoundAsset), "Cone outside angle."); + addField("coneOutsideVolume", TypeF32, Offset(mProfileDesc.mConeOutsideVolume, SoundAsset), "Cone outside volume."); + addField("rolloffFactor", TypeF32, Offset(mProfileDesc.mRolloffFactor, SoundAsset), "Rolloff factor."); + addField("scatterDistance", TypePoint3F, Offset(mProfileDesc.mScatterDistance, SoundAsset), "Randomization to the spacial position of the sound."); + endGroup("3D"); + + addGroup("Playlist settings"); + addField("random", TYPEID< SFXPlayList::ERandomMode >(), Offset(mPlaylist.mRandomMode, SoundAsset), "Slot playback order randomization pattern."); + addField("loopMode", TYPEID< SFXPlayList::ELoopMode >(), Offset(mPlaylist.mLoopMode, SoundAsset), "Behavior when description has looping enabled."); + addField("numSlotsToPlay", TypeS32, Offset(mPlaylist.mNumSlotsToPlay, SoundAsset), "Number of slots to play."); + addField("trace", TypeBool, Offset(mPlaylist.mTrace, SoundAsset), "Enable/disable execution tracing for this playlist (local only)."); + endGroup("Playlist settings"); } //------------------------------------------------------------------------------ @@ -193,67 +312,141 @@ void SoundAsset::copyTo(SimObject* object) void SoundAsset::initializeAsset(void) { Parent::initializeAsset(); + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + { + if (i == 0 && mSoundFile[i] == StringTable->EmptyString()) + return; - if (mSoundFile == StringTable->EmptyString()) - return; + if (mSoundFile[i] == StringTable->EmptyString()) + break; - mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; - //loadSound(); + mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i]; + } } void SoundAsset::_onResourceChanged(const Torque::Path &path) { - if (path != Torque::Path(mSoundPath)) - return; + for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++) + { + if (path != Torque::Path(mSoundPath[i])) + return; + } refreshAsset(); - - //loadSound(); } void SoundAsset::onAssetRefresh(void) { - if (mSoundFile == StringTable->EmptyString()) - return; + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + { + if (i == 0 && mSoundFile[i] == StringTable->EmptyString()) + return; - //Update - mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; - //loadSound(); + if (mSoundFile[i] == StringTable->EmptyString()) + break; + + mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i]; + } } -bool SoundAsset::loadSound() +U32 SoundAsset::load() { - if (mLoadedState == AssetErrCode::Ok) return true; - if (mSoundPath) + if (mLoadedState == AssetErrCode::Ok) return mLoadedState; + + // find out how many active slots we have. + U32 numSlots = 0; + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) { - if (!Torque::FS::IsFile(mSoundPath)) - { - Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile); - mLoadedState = BadFileReference; - mSFXProfile.setDescription(NULL); - mSFXProfile.setSoundFileName(StringTable->insert(StringTable->EmptyString())); - mSFXProfile.setPreload(false); + if (i == 0 && mSoundPath[i] == StringTable->EmptyString()) return false; - } - else - {// = new SFXProfile(mProfileDesc, mSoundFile, mPreload); - if (mProfileDesc.mSourceGroup == NULL) - mProfileDesc.mSourceGroup = dynamic_cast(Sim::findObject("AudioChannelMaster")); - mSFXProfile.setDescription(&mProfileDesc); - mSFXProfile.setSoundFileName(mSoundPath); - mSFXProfile.setPreload(mPreload); - //give it a nudge to preload if required - mSFXProfile.getBuffer(); - } + if (mSoundPath[i] == StringTable->EmptyString()) + break; + numSlots++; } + + + if (numSlots > 1) + { + mIsPlaylist = true; + + for (U32 i = 0; i < numSlots; i++) + { + if (mSoundPath[i]) + { + if (!Torque::FS::IsFile(mSoundPath[i])) + { + Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[i]); + mLoadedState = BadFileReference; + mSFXProfile[i].setDescription(NULL); + mSFXProfile[i].setSoundFileName(StringTable->insert(StringTable->EmptyString())); + mSFXProfile[i].setPreload(false); + return mLoadedState; + } + else + {// = new SFXProfile(mProfileDesc, mSoundFile, mPreload); + if (mProfileDesc.mSourceGroup == NULL) + mProfileDesc.mSourceGroup = dynamic_cast(Sim::findObject("AudioChannelMaster")); + SFXProfile* trackProfile = new SFXProfile(); + trackProfile->setDescription(&mProfileDesc); + trackProfile->setSoundFileName(mSoundPath[i]); + trackProfile->setPreload(mPreload); + trackProfile->getBuffer(); + + mSFXProfile[i] = *trackProfile; + + mPlaylist.mSlots.mTrack[i] = trackProfile; + + } + } + } + + mPlaylist.setDescription(&mProfileDesc); + } + else + { + if (mSoundPath[0]) + { + if (!Torque::FS::IsFile(mSoundPath[0])) + { + Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[0]); + mLoadedState = BadFileReference; + mSFXProfile[0].setDescription(NULL); + mSFXProfile[0].setSoundFileName(StringTable->insert(StringTable->EmptyString())); + mSFXProfile[0].setPreload(false); + return mLoadedState; + } + else + {// = new SFXProfile(mProfileDesc, mSoundFile, mPreload); + if (mProfileDesc.mSourceGroup == NULL) + mProfileDesc.mSourceGroup = dynamic_cast(Sim::findObject("AudioChannelMaster")); + mSFXProfile[0].setDescription(&mProfileDesc); + mSFXProfile[0].setSoundFileName(mSoundPath[0]); + mSFXProfile[0].setPreload(mPreload); + + //give it a nudge to preload if required + mSFXProfile[0].getBuffer(); + } + + } + } + mChangeSignal.trigger(); mLoadedState = Ok; - return true; + return mLoadedState; } -void SoundAsset::setSoundFile(const char* pSoundFile) +StringTableEntry SoundAsset::getSoundFile(const char* pSoundFile, const U32 slotId) +{ + for (U32 i = 0; i < 12; i++) + { + if(mSoundFile[i] == pSoundFile) + return mSoundFile[i]; + } +} + +void SoundAsset::setSoundFile(const char* pSoundFile, const U32 slotId) { // Sanity! AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file."); @@ -261,12 +454,12 @@ void SoundAsset::setSoundFile(const char* pSoundFile) // Fetch sound file. pSoundFile = StringTable->insert(pSoundFile, true); - // Ignore no change, - if (pSoundFile == mSoundFile) + //Ignore no change, + if (pSoundFile == mSoundFile[slotId]) return; // Update. - mSoundFile = getOwned() ? expandAssetFilePath(pSoundFile) : pSoundFile; + mSoundFile[slotId] = getOwned() ? expandAssetFilePath(pSoundFile) : pSoundFile; // Refresh the asset. refreshAsset(); @@ -353,11 +546,11 @@ DefineEngineMethod(SoundAsset, playSound, S32, (Point3F position), (Point3F::Zer "Plays the sound for this asset.\n" "@return (sound plays).\n") { - if (object->getSfxProfile()) + if (object->getSFXTrack()) { MatrixF transform; transform.setPosition(position); - SFXSource* source = SFX->playOnce(object->getSfxProfile(), &transform, NULL, -1); + SFXSource* source = SFX->playOnce(object->getSFXTrack(), &transform, NULL, -1); if(source) return source->getId(); else diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h index 63f81194a..9aaf51224 100644 --- a/Engine/source/T3D/assets/SoundAsset.h +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -55,6 +55,11 @@ #include "sfx/sfxDescription.h" #endif // !_SFXDESCRIPTION_H_ + +#ifndef _SFXTRACK_H_ +#include "sfx/sfxTrack.h" +#endif + #ifndef _SFXPROFILE_H_ #include "sfx/sfxProfile.h" #endif // !_SFXPROFILE_H_ @@ -63,8 +68,17 @@ #include "core/resourceManager.h" #endif +#ifndef _SFXPLAYLIST_H_ +#include "sfx/sfxPlayList.h" +#endif + +#ifndef _SFXTYPES_H_ +#include "sfx/sfxTypes.h" +#endif + #include "assetMacroHelpers.h" class SFXResource; +class SFXPlayList; //----------------------------------------------------------------------------- class SoundAsset : public AssetBase @@ -73,13 +87,17 @@ class SoundAsset : public AssetBase typedef AssetPtr ConcreteAssetPtr; protected: - StringTableEntry mSoundFile; - StringTableEntry mSoundPath; - SFXProfile mSFXProfile; + StringTableEntry mSoundFile[12]; + StringTableEntry mSoundPath[12]; + SFXProfile mSFXProfile[12]; + SFXDescription mProfileDesc; + SFXPlayList mPlaylist; // subtitles StringTableEntry mSubtitleString; bool mPreload; + bool mIsPlaylist; + //SFXPlayList::SlotData mSlots; /*These will be needed in the refactor! Resource mSoundResource; @@ -132,17 +150,20 @@ public: virtual void copyTo(SimObject* object); //SFXResource* getSound() { return mSoundResource; } - Resource getSoundResource() { loadSound(); return mSFXProfile.getResource(); } + Resource getSoundResource(const U32 slotId = 0) { load(); return mSFXProfile[slotId].getResource(); } /// Declare Console Object. DECLARE_CONOBJECT(SoundAsset); - void setSoundFile(const char* pSoundFile); - bool loadSound(); - inline StringTableEntry getSoundFile(void) const { return mSoundFile; }; - inline StringTableEntry getSoundPath(void) const { return mSoundPath; }; - SFXProfile* getSfxProfile() { return &mSFXProfile; } + void setSoundFile(const char* pSoundFile, const U32 slotId = 0); + U32 load(); + StringTableEntry getSoundFile(const char* pSoundFile, const U32 slotId = 0); + inline StringTableEntry getSoundPath(const U32 slotId = 0) const { return mSoundPath[slotId]; }; + SFXProfile* getSfxProfile(const U32 slotId = 0) { return &mSFXProfile[slotId]; } + SFXPlayList* getSfxPlaylist() { return &mPlaylist; } + SFXTrack* getSFXTrack() { return mIsPlaylist ? dynamic_cast(&mPlaylist) : dynamic_cast(&mSFXProfile[0]); } SFXDescription* getSfxDescription() { return &mProfileDesc; } + bool isPlaylist(){ return mIsPlaylist; } bool isLoop() { return mProfileDesc.mIsLooping; } bool is3D() { return mProfileDesc.mIs3D; } @@ -156,8 +177,8 @@ protected: void _onResourceChanged(const Torque::Path & path); virtual void onAssetRefresh(void); - static bool setSoundFile(void *obj, const char *index, const char *data) { static_cast(obj)->setSoundFile(data); return false; } - static const char* getSoundFile(void* obj, const char* data) { return static_cast(obj)->getSoundFile(); } + static bool _setSoundFile(void *obj, const char *index, const char *data) { static_cast(obj)->setSoundFile(data, index ? dAtoi(index) : 0); return false; } + static const char* _getSoundFile(void* obj, const char* data) { return static_cast(obj)->getSoundFile(data); } }; DefineConsoleType(TypeSoundAssetPtr, SoundAsset) @@ -175,7 +196,7 @@ DefineConsoleType(TypeSoundAssetId, String) StringTableEntry m##name##Name; \ StringTableEntry m##name##AssetId;\ AssetPtr m##name##Asset = NULL;\ - SFXProfile* m##name##Profile = NULL;\ + SFXTrack* m##name##Profile = NULL;\ SFXDescription* m##name##Desc = NULL;\ SimObjectId m##name##SFXId = 0;\ public: \ @@ -268,11 +289,12 @@ public: \ {\ return m##name;\ }\ - SFXProfile* get##name##Profile()\ + SFXTrack* get##name##Profile()\ {\ if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull()){\ - m##name##Profile = m##name##Asset->getSfxProfile();\ - return m##name##Profile;}\ + m##name##Profile = m##name##Asset->getSFXTrack(); \ + return m##name##Profile;\ + }\ return NULL;\ }\ SFXDescription* get##name##Description()\ @@ -308,9 +330,9 @@ public: \ {\ if(stream->writeFlag(Sim::findObject(m##name##Name)))\ {\ - SFXTrack* sndTrack;\ - Sim::findObject(m##name##Name, sndTrack);\ + SFXTrack* sndTrack = get##name##Profile();\ stream->writeRangedU32(SimObjectId(sndTrack->getId()), DataBlockObjectIdFirst, DataBlockObjectIdLast);\ + sfxWrite(stream, sndTrack);\ }\ else\ {\ @@ -330,7 +352,10 @@ public: \ {\ if(stream->readFlag())\ {\ + String errorStr;\ m##name##SFXId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );\ + sfxReadAndResolve(stream, &m##name##Profile, errorStr);\ + Con::errorf("%s", errorStr.c_str());\ }\ else\ {\ @@ -359,7 +384,7 @@ public: \ StringTableEntry m##name##Name[max]; \ StringTableEntry m##name##AssetId[max];\ AssetPtr m##name##Asset[max];\ - SFXProfile* m##name##Profile[max];\ + SFXTrack* m##name##Profile[max];\ SimObjectId m##name##SFXId[max];\ public: \ const StringTableEntry get##name##File(const U32& index) const { return m##name##Name[index]; }\ @@ -461,10 +486,10 @@ public: \ return ResourceManager::get().load( "" );\ return m##name[id];\ }\ - SFXProfile* get##name##Profile(const U32& id)\ + SFXTrack* get##name##Profile(const U32& id)\ {\ - if (get##name(id) != StringTable->EmptyString() && m##name##Asset[id].notNull())\ - return m##name##Asset[id]->getSfxProfile();\ + if (m##name##Asset[id].notNull())\ + return m##name##Asset[id]->getSFXTrack(); \ return NULL;\ }\ bool is##name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id] && m##name##Asset[id]->getStatus() == AssetBase::Ok); } @@ -518,9 +543,12 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\ {\ if(stream->writeFlag(Sim::findObject(m##name##Name[index])))\ {\ - SFXTrack* sndTrack;\ - Sim::findObject(m##name##Name[index], sndTrack);\ - stream->writeRangedU32(SimObjectId(sndTrack->getId()), DataBlockObjectIdFirst, DataBlockObjectIdLast);\ + SFXTrack* sndTrack = get##name##Profile(index);\ + if(stream->writeFlag(sndTrack != nullptr))\ + {\ + stream->writeRangedU32(SimObjectId(sndTrack->getId()), DataBlockObjectIdFirst, DataBlockObjectIdLast);\ + sfxWrite(stream, sndTrack);\ + }\ }\ else\ {\ @@ -540,7 +568,12 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\ {\ if(stream->readFlag())\ {\ - m##name##SFXId[index] = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );\ + String errorStr;\ + if(stream->readFlag())\ + {\ + m##name##SFXId[index] = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );\ + sfxReadAndResolve(stream, &m##name##Profile[index], errorStr);\ + }\ }\ else\ {\ diff --git a/Engine/source/T3D/assets/TerrainAsset.cpp b/Engine/source/T3D/assets/TerrainAsset.cpp index 4b295a95b..11dd64796 100644 --- a/Engine/source/T3D/assets/TerrainAsset.cpp +++ b/Engine/source/T3D/assets/TerrainAsset.cpp @@ -161,14 +161,14 @@ void TerrainAsset::initializeAsset() mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath; - loadTerrain(); + load(); } void TerrainAsset::onAssetRefresh() { mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath; - loadTerrain(); + load(); } void TerrainAsset::setTerrainFileName(const char* pScriptFile) @@ -189,10 +189,10 @@ void TerrainAsset::setTerrainFileName(const char* pScriptFile) refreshAsset(); } -bool TerrainAsset::loadTerrain() +U32 TerrainAsset::load() { if (!Torque::FS::IsFile(mTerrainFilePath)) - return false; + return BadFileReference; mTerrMaterialAssets.clear(); mTerrMaterialAssetIds.clear(); @@ -229,9 +229,9 @@ bool TerrainAsset::loadTerrain() mTerrainFile = ResourceManager::get().load(mTerrainFilePath); if (mTerrainFile) - return true; + return Ok; - return false; + return BadFileReference; } //------------------------------------------------------------------------------ diff --git a/Engine/source/T3D/assets/TerrainAsset.h b/Engine/source/T3D/assets/TerrainAsset.h index 1ae593c62..991bab461 100644 --- a/Engine/source/T3D/assets/TerrainAsset.h +++ b/Engine/source/T3D/assets/TerrainAsset.h @@ -82,7 +82,7 @@ public: inline Resource getTerrainResource(void) const { return mTerrainFile; }; - bool loadTerrain(); + U32 load(); static bool getAssetByFilename(StringTableEntry fileName, AssetPtr* shapeAsset); static StringTableEntry getAssetIdByFilename(StringTableEntry fileName); diff --git a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp index 18d175f3d..e186e0e4e 100644 --- a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp +++ b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp @@ -202,7 +202,7 @@ void TerrainMaterialAsset::initializeAsset() } } - loadMaterial(); + load(); } void TerrainMaterialAsset::onAssetRefresh() @@ -232,7 +232,7 @@ void TerrainMaterialAsset::onAssetRefresh() Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str()); } - loadMaterial(); + load(); } void TerrainMaterialAsset::setScriptFile(const char* pScriptFile) @@ -251,7 +251,7 @@ void TerrainMaterialAsset::setScriptFile(const char* pScriptFile) //------------------------------------------------------------------------------ -void TerrainMaterialAsset::loadMaterial() +U32 TerrainMaterialAsset::load() { if (mMaterialDefinition) mMaterialDefinition->safeDeleteObject(); @@ -287,7 +287,7 @@ void TerrainMaterialAsset::loadMaterial() } if(mLoadedState == Ok) - return; + return mLoadedState; } else if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString()) { @@ -296,17 +296,18 @@ void TerrainMaterialAsset::loadMaterial() { Con::errorf("TerrainMaterialAsset: Unable to find the Material %s", mMatDefinitionName); mLoadedState = BadFileReference; - return; + return mLoadedState; } mMaterialDefinition = matDef; mLoadedState = Ok; mMaterialDefinition->setInternalName(getAssetId()); - return; + return mLoadedState; } mLoadedState = Failed; + return mLoadedState; } //------------------------------------------------------------------------------ diff --git a/Engine/source/T3D/assets/TerrainMaterialAsset.h b/Engine/source/T3D/assets/TerrainMaterialAsset.h index e8e268255..107c6fc92 100644 --- a/Engine/source/T3D/assets/TerrainMaterialAsset.h +++ b/Engine/source/T3D/assets/TerrainMaterialAsset.h @@ -89,7 +89,7 @@ public: static void initPersistFields(); virtual void copyTo(SimObject* object); - void loadMaterial(); + U32 load(); StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; } SimObjectPtr getMaterialDefinition() { return mMaterialDefinition; } diff --git a/Engine/source/T3D/camera.h b/Engine/source/T3D/camera.h index 8f3b1ac35..e54c90ab1 100644 --- a/Engine/source/T3D/camera.h +++ b/Engine/source/T3D/camera.h @@ -249,7 +249,7 @@ class Camera: public ShapeBase virtual void unpackUpdate( NetConnection* conn, BitStream* stream ); DECLARE_CONOBJECT( Camera ); - DECLARE_CATEGORY( "Game" ); + DECLARE_CATEGORY("Actor \t Controllable"); DECLARE_DESCRIPTION( "Represents a position, direction and field of view to render a scene from." ); static F32 getMovementSpeed() { return smMovementSpeed; } bool isCamera() const { return true; } diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index b59163392..c8341e8a8 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -221,10 +221,8 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch &mat[12], &mat[13], &mat[14], &mat[15] ); */ - String t = data; - - dSscanf( data, "%g %g %g %g %g %g %g %i %g %g %g %g %f", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z, - &matID, &offset.x, &offset.y, &scale.x, &scale.y, &rot); + dSscanf( data, "%g %g %g %g %g %g %g %i %g %g %g %g %g %i %i", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z, + &matID, &offset.x, &offset.y, &scale.x, &scale.y, &rot, &horz, &vert); MatrixF surface; quat.setMatrix( &surface ); diff --git a/Engine/source/T3D/convexShape.h b/Engine/source/T3D/convexShape.h index cf02165b6..45a2bb551 100644 --- a/Engine/source/T3D/convexShape.h +++ b/Engine/source/T3D/convexShape.h @@ -194,6 +194,7 @@ public: virtual ~ConvexShape(); DECLARE_CONOBJECT( ConvexShape ); + DECLARE_CATEGORY("Object \t Simple"); // ConsoleObject static void initPersistFields(); diff --git a/Engine/source/T3D/debris.h b/Engine/source/T3D/debris.h index 83224f190..4f896d184 100644 --- a/Engine/source/T3D/debris.h +++ b/Engine/source/T3D/debris.h @@ -179,6 +179,7 @@ public: void setRotAngles( const Point3F &angles ){ mRotAngles = angles; } DECLARE_CONOBJECT(Debris); + DECLARE_CATEGORY("UNLISTED"); private: SimObject* ss_object; diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index 2c683275a..bf1e7ad2a 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -87,6 +87,7 @@ const U32 DecalManager::smMaxIndices = 10000; DecalManager *gDecalManager = NULL; IMPLEMENT_CONOBJECT(DecalManager); +DECLARE_CATEGORY("UNLISTED"); ConsoleDoc( "@defgroup Decals\n" diff --git a/Engine/source/T3D/decal/decalManager.h b/Engine/source/T3D/decal/decalManager.h index 9e03c59c7..4ab636f06 100644 --- a/Engine/source/T3D/decal/decalManager.h +++ b/Engine/source/T3D/decal/decalManager.h @@ -270,6 +270,7 @@ class DecalManager : public SceneObject // SimObject. DECLARE_CONOBJECT( DecalManager ); + DECLARE_CATEGORY("UNLISTED"); static void consoleInit(); }; diff --git a/Engine/source/T3D/fps/guiHealthBarHud.cpp b/Engine/source/T3D/fps/guiHealthBarHud.cpp index a01d17a69..a76f8284e 100644 --- a/Engine/source/T3D/fps/guiHealthBarHud.cpp +++ b/Engine/source/T3D/fps/guiHealthBarHud.cpp @@ -147,7 +147,7 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect) if (!conn) return; ShapeBase* control = dynamic_cast(conn->getControlObject()); - if (!control || !(control->getTypeMask() & PlayerObjectType)) + if (!control || !(control->getTypeMask() & (PlayerObjectType | VehicleObjectType))) return; if(mDisplayEnergy) diff --git a/Engine/source/T3D/fps/guiHealthTextHud.cpp b/Engine/source/T3D/fps/guiHealthTextHud.cpp index 989287484..57b7f6751 100644 --- a/Engine/source/T3D/fps/guiHealthTextHud.cpp +++ b/Engine/source/T3D/fps/guiHealthTextHud.cpp @@ -149,7 +149,7 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect) if (!conn) return; ShapeBase* control = dynamic_cast(conn->getControlObject()); - if (!control || !(control->getTypeMask() & PlayerObjectType)) + if (!control || !(control->getTypeMask() & (PlayerObjectType | VehicleObjectType))) return; // Just grab the damage/energy right off the control object. diff --git a/Engine/source/T3D/fps/guiShapeNameHud.cpp b/Engine/source/T3D/fps/guiShapeNameHud.cpp index 27eca76f6..b293a4a87 100644 --- a/Engine/source/T3D/fps/guiShapeNameHud.cpp +++ b/Engine/source/T3D/fps/guiShapeNameHud.cpp @@ -209,7 +209,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect) // Target pos to test, if it's a player run the LOS to his eye // point, otherwise we'll grab the generic box center. Point3F shapePos; - if (shape->getTypeMask() & PlayerObjectType) + if (shape->getTypeMask() & (PlayerObjectType | VehicleObjectType)) { MatrixF eye; diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index d9cfc1367..d4d621cdf 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -1403,7 +1403,7 @@ bool Explosion::explode() resetWorldBox(); } - SFXProfile* sound_prof = mDataBlock->getSoundProfile(); + SFXProfile* sound_prof = static_cast(mDataBlock->getSoundProfile()); if (sound_prof) { soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index); diff --git a/Engine/source/T3D/fx/explosion.h b/Engine/source/T3D/fx/explosion.h index eac392e11..ab17cf6d3 100644 --- a/Engine/source/T3D/fx/explosion.h +++ b/Engine/source/T3D/fx/explosion.h @@ -205,6 +205,7 @@ class Explosion : public GameBase, public ISceneLight void setCollideType( U32 cType ){ mCollideType = cType; } DECLARE_CONOBJECT(Explosion); + DECLARE_CATEGORY("UNLISTED"); static void initPersistFields(); private: SimObject* ss_object; diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.h b/Engine/source/T3D/fx/fxFoliageReplicator.h index 0d8224652..901ac128b 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.h +++ b/Engine/source/T3D/fx/fxFoliageReplicator.h @@ -390,6 +390,7 @@ public: // Declare Console Object. DECLARE_CONOBJECT(fxFoliageReplicator); + DECLARE_CATEGORY("UNLISTED"); }; #pragma warning( pop ) #endif // _FOLIAGEREPLICATOR_H_ diff --git a/Engine/source/T3D/fx/fxShapeReplicator.h b/Engine/source/T3D/fx/fxShapeReplicator.h index 6d894ae8a..08df63506 100644 --- a/Engine/source/T3D/fx/fxShapeReplicator.h +++ b/Engine/source/T3D/fx/fxShapeReplicator.h @@ -59,6 +59,7 @@ public: void setTransform(const MatrixF & mat) { Parent::setTransform(mat); setRenderTransform(mat); }; DECLARE_CONOBJECT(fxShapeReplicatedStatic); + DECLARE_CATEGORY("UNLISTED"); }; @@ -187,6 +188,7 @@ public: // Declare Console Object. DECLARE_CONOBJECT(fxShapeReplicator); + DECLARE_CATEGORY("UNLISTED"); }; #endif // _SHAPEREPLICATOR_H_ diff --git a/Engine/source/T3D/fx/groundCover.h b/Engine/source/T3D/fx/groundCover.h index 906a96a7e..3cd03887a 100644 --- a/Engine/source/T3D/fx/groundCover.h +++ b/Engine/source/T3D/fx/groundCover.h @@ -123,6 +123,7 @@ public: ~GroundCover(); DECLARE_CONOBJECT(GroundCover); + DECLARE_CATEGORY("Environment \t BackGround"); static void consoleInit(); static void initPersistFields(); diff --git a/Engine/source/T3D/fx/lightning.h b/Engine/source/T3D/fx/lightning.h index be3b65319..d68f6c1d2 100644 --- a/Engine/source/T3D/fx/lightning.h +++ b/Engine/source/T3D/fx/lightning.h @@ -239,6 +239,7 @@ class Lightning : public GameBase void processEvent(LightningStrikeEvent*); DECLARE_CONOBJECT(Lightning); + DECLARE_CATEGORY("Environment \t Weather"); static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 32bf5beca..b11e53ce8 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -168,6 +168,7 @@ class ParticleEmitter : public GameBase ~ParticleEmitter(); DECLARE_CONOBJECT(ParticleEmitter); + DECLARE_CATEGORY("UNLISTED"); static Point3F mWindVelocity; static void setWindVelocity( const Point3F &vel ){ mWindVelocity = vel; } @@ -237,7 +238,7 @@ class ParticleEmitter : public GameBase const LinearColorF &ambientColor, ParticleVertexType *lVerts ); - inline void setupOriented( Particle *part, + void setupOriented( Particle *part, const Point3F &camPos, const LinearColorF &ambientColor, ParticleVertexType *lVerts ); diff --git a/Engine/source/T3D/fx/particleEmitterNode.h b/Engine/source/T3D/fx/particleEmitterNode.h index 48b7c4306..24c45e697 100644 --- a/Engine/source/T3D/fx/particleEmitterNode.h +++ b/Engine/source/T3D/fx/particleEmitterNode.h @@ -103,6 +103,7 @@ class ParticleEmitterNode : public GameBase void advanceTime(F32 dt); DECLARE_CONOBJECT(ParticleEmitterNode); + DECLARE_CATEGORY("Environment \t FX"); static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream* stream); diff --git a/Engine/source/T3D/fx/precipitation.h b/Engine/source/T3D/fx/precipitation.h index eb3a540e0..04bc02f46 100644 --- a/Engine/source/T3D/fx/precipitation.h +++ b/Engine/source/T3D/fx/precipitation.h @@ -280,6 +280,7 @@ class Precipitation : public GameBase bool onNewDataBlock( GameBaseData *dptr, bool reload ); DECLARE_CONOBJECT(Precipitation); + DECLARE_CATEGORY("Environment \t Weather"); static void initPersistFields(); U32 packUpdate(NetConnection*, U32 mask, BitStream* stream); diff --git a/Engine/source/T3D/fx/ribbon.h b/Engine/source/T3D/fx/ribbon.h index 954dd3cf0..b10041ba3 100644 --- a/Engine/source/T3D/fx/ribbon.h +++ b/Engine/source/T3D/fx/ribbon.h @@ -124,6 +124,7 @@ public: ~Ribbon(); DECLARE_CONOBJECT(Ribbon); + DECLARE_CATEGORY("UNLISTED"); static void initPersistFields(); bool onNewDataBlock(GameBaseData*,bool); void onRemove(); diff --git a/Engine/source/T3D/fx/ribbonNode.h b/Engine/source/T3D/fx/ribbonNode.h index d4be52fa8..a071f87a2 100644 --- a/Engine/source/T3D/fx/ribbonNode.h +++ b/Engine/source/T3D/fx/ribbonNode.h @@ -87,6 +87,7 @@ public: void advanceTime(F32 dt); DECLARE_CONOBJECT(RibbonNode); + DECLARE_CATEGORY("Environment \t FX"); static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream* stream); diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 3b8c6da24..07c3a52f3 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -686,7 +686,7 @@ void Splash::spawnExplosion() /// could just play the explosion one, but explosion could be weapon specific, /// splash sound could be liquid specific. food for thought. - SFXProfile* sound_prof = mDataBlock->getSoundProfile(); + SFXTrack* sound_prof = mDataBlock->getSoundProfile(); if (sound_prof) { SFX->playOnce(sound_prof, &getTransform()); diff --git a/Engine/source/T3D/fx/splash.h b/Engine/source/T3D/fx/splash.h index a395739ff..523fd6e19 100644 --- a/Engine/source/T3D/fx/splash.h +++ b/Engine/source/T3D/fx/splash.h @@ -195,6 +195,7 @@ public: bool onNewDataBlock( GameBaseData *dptr, bool reload ); DECLARE_CONOBJECT(Splash); + DECLARE_CATEGORY("UNLISTED"); }; diff --git a/Engine/source/T3D/gameBase/gameBase.h b/Engine/source/T3D/gameBase/gameBase.h index 4f1aee2ef..bda0aa479 100644 --- a/Engine/source/T3D/gameBase/gameBase.h +++ b/Engine/source/T3D/gameBase/gameBase.h @@ -105,6 +105,7 @@ public: // The derived class should provide the following: DECLARE_CONOBJECT(GameBaseData); + DECLARE_CATEGORY("Datablock"); GameBaseData(); static void initPersistFields(); bool preload(bool server, String &errorStr); @@ -442,6 +443,7 @@ public: #endif DECLARE_CONOBJECT (GameBase ); + DECLARE_CATEGORY("UNLISTED"); /// @name Callbacks /// @{ diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index b88bde05e..6b19b40b5 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -478,7 +478,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr setProtocolVersion(currentProtocol < CurrentProtocolVersion ? currentProtocol : CurrentProtocolVersion); const char *serverPassword = Con::getVariable("pref::Server::Password"); - if(serverPassword[0]) + if(serverPassword[0] && !isLocalConnection()) { if(String::compare(joinPassword, serverPassword)) { diff --git a/Engine/source/T3D/gameBase/gameConnectionEvents.cpp b/Engine/source/T3D/gameBase/gameConnectionEvents.cpp index 184d504bf..a24a80c87 100644 --- a/Engine/source/T3D/gameBase/gameConnectionEvents.cpp +++ b/Engine/source/T3D/gameBase/gameConnectionEvents.cpp @@ -387,9 +387,9 @@ void SimSoundAssetEvent::process(NetConnection* con) { if (mAsset->is3D()) - SFX->playOnce(mAsset->getSfxProfile(), &mTransform); + SFX->playOnce(mAsset->getSFXTrack(), &mTransform); else - SFX->playOnce(mAsset->getSfxProfile()); + SFX->playOnce(mAsset->getSFXTrack()); } diff --git a/Engine/source/T3D/groundPlane.h b/Engine/source/T3D/groundPlane.h index 9e57c325c..4b9ded740 100644 --- a/Engine/source/T3D/groundPlane.h +++ b/Engine/source/T3D/groundPlane.h @@ -60,6 +60,7 @@ public: typedef SceneObject Parent; DECLARE_CONOBJECT( GroundPlane ); + DECLARE_CATEGORY("Environment \t BackGround"); GroundPlane(); virtual ~GroundPlane(); diff --git a/Engine/source/T3D/guiObjectView.cpp b/Engine/source/T3D/guiObjectView.cpp index 1fb8451f5..9dfc13a5d 100644 --- a/Engine/source/T3D/guiObjectView.cpp +++ b/Engine/source/T3D/guiObjectView.cpp @@ -91,7 +91,7 @@ IMPLEMENT_CALLBACK( GuiObjectView, onMouseLeave, void, (),(), GuiObjectView::GuiObjectView() : mMouseState( None ), mLastMousePoint( 0, 0 ), - mModel( NULL ), + mModelInstance(NULL), mMaxOrbitDist( 5.0f ), mMinOrbitDist( 0.0f ), mCameraRotation( 0.0f, 0.0f, 0.0f ), @@ -99,13 +99,13 @@ GuiObjectView::GuiObjectView() mCameraSpeed( 0.01f ), mMountNode( -1 ), mMountNodeName( "mount0" ), - mMountedModel( NULL ), + mMountedModelInstance( NULL ), mAnimationSeq( -1 ), mRunThread( NULL ), mLastRenderTime( 0 ), mLight( NULL ), mLightColor( 1.0f, 1.0f, 1.0f ), - mLightAmbient( 0.5f, 0.5f, 0.5f ), + mLightAmbient( 1.0f, 1.0f, 1.0f ), mLightDirection( 0.f, 0.707f, -0.707f ) { mCameraMatrix.identity(); @@ -117,16 +117,14 @@ GuiObjectView::GuiObjectView() // By default don't do dynamic reflection // updates for this viewport. mReflectPriority = 0.0f; + INIT_ASSET(Model); + INIT_ASSET(MountedModel); } //------------------------------------------------------------------------------ GuiObjectView::~GuiObjectView() { - if( mModel ) - SAFE_DELETE( mModel ); - if( mMountedModel ) - SAFE_DELETE( mMountedModel ); if( mLight ) SAFE_DELETE( mLight ); } @@ -136,13 +134,10 @@ GuiObjectView::~GuiObjectView() void GuiObjectView::initPersistFields() { docsURL; - addGroup( "Model" ); - - addField( "shapeFile", TypeStringFilename, Offset( mModelName, GuiObjectView ), - "The object model shape file to show in the view." ); + addGroup( "Model" ); + INITPERSISTFIELD_SHAPEASSET(Model, GuiObjectView, "The source shape asset."); addField( "skin", TypeRealString, Offset( mSkinName, GuiObjectView ), - "The skin to use on the object model." ); - + "The skin to use on the object model." ); endGroup( "Model" ); addGroup( "Animation" ); @@ -152,10 +147,8 @@ void GuiObjectView::initPersistFields() endGroup( "Animation" ); - addGroup( "Mounting" ); - - addField( "mountedShapeFile", TypeStringFilename, Offset( mMountedModelName, GuiObjectView ), - "Optional shape file to mount on the primary model (e.g. weapon)." ); + addGroup( "Mounting" ); + INITPERSISTFIELD_SHAPEASSET(MountedModel, GuiObjectView, "The mounted shape asset."); addField( "mountedSkin", TypeRealString, Offset( mMountSkinName, GuiObjectView ), "Skin name used on mounted shape file." ); addField( "mountedNode", TypeRealString, Offset( mMountNodeName, GuiObjectView ), @@ -197,9 +190,7 @@ void GuiObjectView::onStaticModified( StringTableEntry slotName, const char* new { Parent::onStaticModified( slotName, newValue ); - static StringTableEntry sShapeFile = StringTable->insert( "shapeFile" ); static StringTableEntry sSkin = StringTable->insert( "skin" ); - static StringTableEntry sMountedShapeFile = StringTable->insert( "mountedShapeFile" ); static StringTableEntry sMountedSkin = StringTable->insert( "mountedSkin" ); static StringTableEntry sMountedNode = StringTable->insert( "mountedNode" ); static StringTableEntry sLightColor = StringTable->insert( "lightColor" ); @@ -211,12 +202,8 @@ void GuiObjectView::onStaticModified( StringTableEntry slotName, const char* new static StringTableEntry sCameraRotation = StringTable->insert( "cameraRotation" ); static StringTableEntry sAnimSequence = StringTable->insert( "animSequence" ); - if( slotName == sShapeFile ) - setObjectModel( String( mModelName ) ); - else if( slotName == sSkin ) + if( slotName == sSkin ) setSkin( String( mSkinName ) ); - else if( slotName == sMountedShapeFile ) - setMountedObject( String( mMountedModelName ) ); else if( slotName == sMountedSkin ) setMountSkin( String( mMountSkinName ) ); else if( slotName == sMountedNode ) @@ -325,7 +312,7 @@ void GuiObjectView::setObjectAnimation( S32 index ) mAnimationSeq = index; mAnimationSeqName = String(); - if( mModel ) + if(mModelInstance) _initAnimation(); } @@ -336,107 +323,123 @@ void GuiObjectView::setObjectAnimation( const String& sequenceName ) mAnimationSeq = -1; mAnimationSeqName = sequenceName; - if( mModel ) + if(mModelInstance) _initAnimation(); } //------------------------------------------------------------------------------ -void GuiObjectView::setObjectModel( const String& modelName ) +bool GuiObjectView::setObjectModel( const String& modelName ) { - SAFE_DELETE( mModel ); mRunThread = 0; - mModelName = String::EmptyString; - - // Load the shape. - Resource< TSShape > model = ResourceManager::get().load( modelName ); - if( !model ) + // Load the shape. + _setModel(modelName); + if( !getModelResource()) { Con::warnf( "GuiObjectView::setObjectModel - Failed to load model '%s'", modelName.c_str() ); - return; + return false; } - + + if (!getModelResource()->preloadMaterialList(getModelResource().getPath())) return false; + // Instantiate it. - mModel = new TSShapeInstance( model, true ); - mModelName = modelName; + mModelInstance = new TSShapeInstance(getModelResource(), true ); + mModelInstance->resetMaterialList(); + mModelInstance->cloneMaterialList(); if( !mSkinName.isEmpty() ) - mModel->reSkin( mSkinName ); + mModelInstance->reSkin( mSkinName ); + TSMaterialList* pMatList = mModelInstance->getMaterialList(); + pMatList->setTextureLookupPath(mModelAsset->getShapeFileName()); + mModelInstance->initMaterialList(); // Initialize camera values. - mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->mRadius; + mOrbitPos = getModelResource()->center; + mMinOrbitDist = getModelResource()->mRadius; // Initialize animation. _initAnimation(); _initMount(); + return true; +} + +void GuiObjectView::onModelChanged() +{ + } //------------------------------------------------------------------------------ void GuiObjectView::setSkin( const String& name ) { - if( mModel ) - mModel->reSkin( name, mSkinName ); + if(mModelInstance) + mModelInstance->reSkin( name, mSkinName ); mSkinName = name; } + //------------------------------------------------------------------------------ -void GuiObjectView::setMountSkin( const String& name ) +bool GuiObjectView::setMountedObject( const String& modelName ) { - if( mMountedModel ) - mMountedModel->reSkin( name, mMountSkinName ); - + // Load the model. + _setMountedModel(modelName); + if (!getMountedModelResource()) + { + Con::warnf("GuiObjectView::setMountedObject - Failed to load model '%s'", modelName.c_str()); + return false; + } + + if (!getMountedModelResource()->preloadMaterialList(getMountedModelResource().getPath())) return false; + + mMountedModelInstance = new TSShapeInstance(getMountedModelResource(), true); + mMountedModelInstance->resetMaterialList(); + mMountedModelInstance->cloneMaterialList(); + + if( !mMountSkinName.isEmpty() ) + mMountedModelInstance->reSkin( mMountSkinName ); + + mMountedModelInstance->initMaterialList(); + + if(mMountedModelInstance) + _initMount(); + return true; +} + +void GuiObjectView::onMountedModelChanged() +{ + +} + +//------------------------------------------------------------------------------ + +void GuiObjectView::setMountSkin(const String& name) +{ + if (mMountedModelInstance) + mMountedModelInstance->reSkin(name, mMountSkinName); + mMountSkinName = name; } //------------------------------------------------------------------------------ -void GuiObjectView::setMountNode( S32 index ) +void GuiObjectView::setMountNode(S32 index) { - setMountNode( String::ToString( "mount%i", index ) ); + setMountNode(String::ToString("mount%i", index)); } //------------------------------------------------------------------------------ -void GuiObjectView::setMountNode( const String& name ) +void GuiObjectView::setMountNode(const String& name) { mMountNodeName = name; - - if( mModel ) - _initMount(); -} -//------------------------------------------------------------------------------ - -void GuiObjectView::setMountedObject( const String& modelName ) -{ - SAFE_DELETE( mMountedModel ); - mMountedModelName = String::EmptyString; - - // Load the model. - - Resource< TSShape > model = ResourceManager::get().load( modelName ); - if( !model ) - { - Con::warnf( "GuiObjectView::setMountedObject - Failed to load object model '%s'", - modelName.c_str() ); - return; - } - - mMountedModel = new TSShapeInstance( model, true ); - mMountedModelName = modelName; - - if( !mMountSkinName.isEmpty() ) - mMountedModel->reSkin( mMountSkinName ); - - if( mModel ) + if (mModelInstance) _initMount(); } @@ -483,7 +486,7 @@ void GuiObjectView::onMouseLeave( const GuiEvent & event ) void GuiObjectView::renderWorld( const RectI& updateRect ) { - if( !mModel ) + if( !mModelInstance) return; GFXTransformSaver _saveTransforms; @@ -538,26 +541,26 @@ void GuiObjectView::renderWorld( const RectI& updateRect ) // Render primary model. - if( mModel ) + if(mModelInstance) { if( mRunThread ) { - mModel->advanceTime( dt / 1000.f, mRunThread ); - mModel->animate(); + mModelInstance->advanceTime( dt / 1000.f, mRunThread ); + mModelInstance->animate(); } - mModel->render( rdata ); + mModelInstance->render( rdata ); } // Render mounted model. - if( mMountedModel && mMountNode != -1 ) + if( mMountedModelInstance && mMountNode != -1 ) { GFX->pushWorldMatrix(); - GFX->multWorld( mModel->mNodeTransforms[ mMountNode ] ); + GFX->multWorld(mModelInstance->mNodeTransforms[ mMountNode ] ); GFX->multWorld( mMountTransform ); - mMountedModel->render( rdata ); + mMountedModelInstance->render( rdata ); GFX->popWorldMatrix(); } @@ -620,7 +623,7 @@ void GuiObjectView::setLightDirection( const Point3F& direction ) void GuiObjectView::_initAnimation() { - AssertFatal( mModel, "GuiObjectView::_initAnimation - No model loaded!" ); + AssertFatal(getModelResource(), "GuiObjectView::_initAnimation - No model loaded!" ); if( mAnimationSeqName.isEmpty() && mAnimationSeq == -1 ) return; @@ -629,7 +632,7 @@ void GuiObjectView::_initAnimation() if( !mAnimationSeqName.isEmpty() ) { - mAnimationSeq = mModel->getShape()->findSequence( mAnimationSeqName ); + mAnimationSeq = getModelResource()->findSequence( mAnimationSeqName ); if( mAnimationSeq == -1 ) { @@ -646,7 +649,7 @@ void GuiObjectView::_initAnimation() if( mAnimationSeq != -1 ) { - if( mAnimationSeq >= mModel->getShape()->sequences.size() ) + if( mAnimationSeq >= getModelResource()->sequences.size() ) { Con::errorf( "GuiObjectView::_initAnimation - Sequence '%i' out of range for model '%s'", mAnimationSeq, @@ -658,9 +661,9 @@ void GuiObjectView::_initAnimation() } if( !mRunThread ) - mRunThread = mModel->addThread(); + mRunThread = mModelInstance->addThread(); - mModel->setSequence( mRunThread, mAnimationSeq, 0.f ); + mModelInstance->setSequence( mRunThread, mAnimationSeq, 0.f ); } mLastRenderTime = Platform::getVirtualMilliseconds(); @@ -670,9 +673,9 @@ void GuiObjectView::_initAnimation() void GuiObjectView::_initMount() { - AssertFatal( mModel, "GuiObjectView::_initMount - No model loaded!" ); + AssertFatal(mModelInstance, "GuiObjectView::_initMount - No model loaded!" ); - if( !mMountedModel ) + if( !mModelInstance) return; mMountTransform.identity(); @@ -681,7 +684,7 @@ void GuiObjectView::_initMount() if( !mMountNodeName.isEmpty() ) { - mMountNode = mModel->getShape()->findNode( mMountNodeName ); + mMountNode = getModelResource()->findNode( mMountNodeName ); if( mMountNode == -1 ) { Con::errorf( "GuiObjectView::_initMount - No node '%s' on '%s'", @@ -695,7 +698,7 @@ void GuiObjectView::_initMount() // Make sure mount node is valid. - if( mMountNode != -1 && mMountNode >= mModel->getShape()->nodes.size() ) + if( mMountNode != -1 && mMountNode >= getModelResource()->nodes.size() ) { Con::errorf( "GuiObjectView::_initMount - Mount node index '%i' out of range for '%s'", mMountNode, @@ -708,11 +711,11 @@ void GuiObjectView::_initMount() // Look up node on the mounted model from // which to mount to the primary model's node. - - S32 mountPoint = mMountedModel->getShape()->findNode( "mountPoint" ); + if (!getMountedModelResource()) return; + S32 mountPoint = getMountedModelResource()->findNode( "mountPoint" ); if( mountPoint != -1 ) { - mMountedModel->getShape()->getNodeWorldTransform( mountPoint, &mMountTransform ), + getMountedModelResource()->getNodeWorldTransform(mountPoint, &mMountTransform), mMountTransform.inverse(); } } @@ -733,12 +736,12 @@ DefineEngineMethod( GuiObjectView, getModel, const char*, (),, "@return Name of the displayed model.\n\n" "@see GuiControl") { - return Con::getReturnBuffer( object->getModelName() ); + return Con::getReturnBuffer( object->getModel() ); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiObjectView, setModel, void, (const char* shapeName),, +DefineEngineMethod( GuiObjectView, setModel, bool, (const char* shapeName),, "@brief Sets the model to be displayed in this control.\n\n" "@param shapeName Name of the model to display.\n" "@tsexample\n" @@ -749,7 +752,7 @@ DefineEngineMethod( GuiObjectView, setModel, void, (const char* shapeName),, "@endtsexample\n\n" "@see GuiControl") { - object->setObjectModel( shapeName ); + return object->setObjectModel( shapeName ); } //----------------------------------------------------------------------------- @@ -763,7 +766,7 @@ DefineEngineMethod( GuiObjectView, getMountedModel, const char*, (),, "@return Name of the mounted model.\n\n" "@see GuiControl") { - return Con::getReturnBuffer( object->getMountedModelName() ); + return Con::getReturnBuffer( object->getMountedModel() ); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/guiObjectView.h b/Engine/source/T3D/guiObjectView.h index ff84ff111..faeb06531 100644 --- a/Engine/source/T3D/guiObjectView.h +++ b/Engine/source/T3D/guiObjectView.h @@ -69,12 +69,17 @@ class GuiObjectView : public GuiTSCtrl /// @name Model /// @{ - /// Name of the model loaded for display. - StringTableEntry mModelName; - - /// Model being displayed in the view. - TSShapeInstance* mModel; - + ///Model loaded for display. + DECLARE_SHAPEASSET(GuiObjectView, Model, onModelChanged); + static bool _setModelData(void* obj, const char* index, const char* data)\ + { + bool ret = false; + GuiObjectView* object = static_cast(obj); + ret = object->setObjectModel(StringTable->insert(data)); + return ret; + } + void onModelChanged(); + TSShapeInstance* mModelInstance; /// Name of skin to use on model. String mSkinName; @@ -103,8 +108,17 @@ class GuiObjectView : public GuiTSCtrl /// @name Mounting /// @{ - /// Name of model to mount to the primary model. - String mMountedModelName; + ///Model to mount to the primary model. + DECLARE_SHAPEASSET(GuiObjectView, MountedModel, onMountedModelChanged); + static bool _setMountedModelData(void* obj, const char* index, const char* data)\ + { + bool ret = false; + GuiObjectView* object = static_cast(obj); + ret = object->setMountedObject(StringTable->insert(data)); + return ret; + } + void onMountedModelChanged(); + TSShapeInstance* mMountedModelInstance; /// String mMountSkinName; @@ -114,9 +128,6 @@ class GuiObjectView : public GuiTSCtrl /// Name of node to mount the secondary model to. Unset by default. String mMountNodeName; - - /// Model mounted as an image to the primary model. - TSShapeInstance* mMountedModel; /// MatrixF mMountTransform; @@ -173,13 +184,7 @@ class GuiObjectView : public GuiTSCtrl /// @name Model /// @{ - - /// - const String& getModelName() const { return mModelName; } - - /// Return the instance of the model being rendered in the view. - TSShapeInstance* getModel() const { return mModel; } - + /// Return the name of the skin used on the primary model. const String& getSkin() const { return mSkinName; } @@ -187,7 +192,7 @@ class GuiObjectView : public GuiTSCtrl void setSkin( const String& name ); /// Set the model to show in this view. - void setObjectModel( const String& modelName ); + bool setObjectModel( const String& modelName ); /// @} @@ -206,13 +211,7 @@ class GuiObjectView : public GuiTSCtrl /// @name Mounting /// @{ - - /// Return the model mounted to the current primary model; NULL if none. - TSShapeInstance* getMountedModel() const { return mMountedModel; } - - /// - const String& getMountedModelName() const { return mMountedModelName; } - + /// Return the name of the skin used on the mounted model. const String& getMountSkin() const { return mMountSkinName; } @@ -226,7 +225,7 @@ class GuiObjectView : public GuiTSCtrl void setMountNode( const String& nodeName ); /// - void setMountedObject( const String& modelName ); + bool setMountedObject( const String& modelName ); /// @} diff --git a/Engine/source/T3D/item.h b/Engine/source/T3D/item.h index 2fe968fc5..611d64738 100644 --- a/Engine/source/T3D/item.h +++ b/Engine/source/T3D/item.h @@ -159,6 +159,7 @@ class Item: public ShapeBase public: DECLARE_CONOBJECT(Item); + DECLARE_CATEGORY("Item"); Item(); diff --git a/Engine/source/T3D/lightBase.h b/Engine/source/T3D/lightBase.h index bdaf38b15..503292c16 100644 --- a/Engine/source/T3D/lightBase.h +++ b/Engine/source/T3D/lightBase.h @@ -111,6 +111,7 @@ public: void inspectPostApply(); static void initPersistFields(); DECLARE_CONOBJECT(LightBase); + DECLARE_CATEGORY("UNLISTED"); // NetObject U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream ); diff --git a/Engine/source/T3D/lighting/boxEnvironmentProbe.h b/Engine/source/T3D/lighting/boxEnvironmentProbe.h index b70bd4ee5..3d825caa1 100644 --- a/Engine/source/T3D/lighting/boxEnvironmentProbe.h +++ b/Engine/source/T3D/lighting/boxEnvironmentProbe.h @@ -69,6 +69,7 @@ public: // Declare this object as a ConsoleObject so that we can // instantiate it into the world and network it DECLARE_CONOBJECT(BoxEnvironmentProbe); + DECLARE_CATEGORY("Lighting \t Probes"); //-------------------------------------------------------------------------- // Object Editing diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index f993b795c..57f6e9485 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -184,6 +184,10 @@ void ReflectionProbe::initPersistFields() "@note Only works for shadow mapped lights.\n\n" "@ingroup Lighting"); + Con::addVariable("$Probes::Capturing", TypeBool, &RenderProbeMgr::smBakeReflectionProbes, + "Toggles probe rendering capture state.\n\n" + "@ingroup Lighting"); + Con::addVariable("$Light::renderPreviewProbes", TypeBool, &ReflectionProbe::smRenderPreviewProbes, "Toggles rendering of light frustums when the light is selected in the editor.\n\n" "@note Only works for shadow mapped lights.\n\n" @@ -793,7 +797,9 @@ void ReflectionProbe::bake() if (mReflectionModeType != BakedCubemap) return; + PROBEMGR->preBake(); PROBEMGR->bakeProbe(this); + PROBEMGR->postBake(); setMaskBits(-1); } @@ -823,7 +829,7 @@ void ReflectionProbe::createEditorResources() void ReflectionProbe::prepRenderImage(SceneRenderState *state) { - if (!mEnabled || (!RenderProbeMgr::smRenderReflectionProbes && !dStrcmp(Con::getVariable("$Probes::Capturing", "0"),"1"))) + if (!mEnabled || (!RenderProbeMgr::smRenderReflectionProbes || RenderProbeMgr::smBakeReflectionProbes)) return; Point3F distVec = getRenderPosition() - state->getCameraPosition(); diff --git a/Engine/source/T3D/lighting/reflectionProbe.h b/Engine/source/T3D/lighting/reflectionProbe.h index 2b3751cf8..deca62318 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.h +++ b/Engine/source/T3D/lighting/reflectionProbe.h @@ -274,6 +274,7 @@ public: // Declare this object as a ConsoleObject so that we can // instantiate it into the world and network it DECLARE_CONOBJECT(ReflectionProbe); + DECLARE_CATEGORY("UNLISTED"); //-------------------------------------------------------------------------- // Object Editing diff --git a/Engine/source/T3D/lighting/skylight.h b/Engine/source/T3D/lighting/skylight.h index 6db62a019..9735b0b3b 100644 --- a/Engine/source/T3D/lighting/skylight.h +++ b/Engine/source/T3D/lighting/skylight.h @@ -68,6 +68,7 @@ public: // Declare this object as a ConsoleObject so that we can // instantiate it into the world and network it DECLARE_CONOBJECT(Skylight); + DECLARE_CATEGORY("Lighting \t Probes"); //-------------------------------------------------------------------------- // Object Editing diff --git a/Engine/source/T3D/lighting/sphereEnvironmentProbe.h b/Engine/source/T3D/lighting/sphereEnvironmentProbe.h index 3df0b98b5..154d48747 100644 --- a/Engine/source/T3D/lighting/sphereEnvironmentProbe.h +++ b/Engine/source/T3D/lighting/sphereEnvironmentProbe.h @@ -64,6 +64,7 @@ public: // Declare this object as a ConsoleObject so that we can // instantiate it into the world and network it DECLARE_CONOBJECT(SphereEnvironmentProbe); + DECLARE_CATEGORY("Lighting \t Probes"); //-------------------------------------------------------------------------- // Object Editing diff --git a/Engine/source/T3D/missionMarker.h b/Engine/source/T3D/missionMarker.h index 3468553e5..db72eff64 100644 --- a/Engine/source/T3D/missionMarker.h +++ b/Engine/source/T3D/missionMarker.h @@ -85,6 +85,7 @@ class MissionMarker : public ShapeBase void unpackUpdate(NetConnection *conn, BitStream *stream); DECLARE_CONOBJECT(MissionMarker); + DECLARE_CATEGORY("Markers"); static void initPersistFields(); }; @@ -217,6 +218,7 @@ class CameraBookmark : public MissionMarker static void initPersistFields(); DECLARE_CONOBJECT(CameraBookmark); + DECLARE_CATEGORY("Markers"); /*DECLARE_CALLBACK( void, onAdd, () ); DECLARE_CALLBACK( void, onRemove, () ); DECLARE_CALLBACK( void, onGroupAdd, () ); @@ -224,4 +226,4 @@ class CameraBookmark : public MissionMarker DECLARE_CALLBACK( void, onInspectPostApply, () );*/ }; -#endif // _MISSIONMARKER_H_ \ No newline at end of file +#endif // _MISSIONMARKER_H_ diff --git a/Engine/source/T3D/notesObject.h b/Engine/source/T3D/notesObject.h index 80d16cd69..ace55804f 100644 --- a/Engine/source/T3D/notesObject.h +++ b/Engine/source/T3D/notesObject.h @@ -67,6 +67,7 @@ public: // Declare this object as a ConsoleObject so that we can // instantiate it into the world and network it DECLARE_CONOBJECT(NotesObject); + DECLARE_CATEGORY("Markers"); //-------------------------------------------------------------------------- // Object Editing diff --git a/Engine/source/T3D/occlusionVolume.h b/Engine/source/T3D/occlusionVolume.h index 49222bb94..4c1d6f75d 100644 --- a/Engine/source/T3D/occlusionVolume.h +++ b/Engine/source/T3D/occlusionVolume.h @@ -64,7 +64,7 @@ class OcclusionVolume : public ScenePolyhedralSpace // SimObject. DECLARE_CONOBJECT( OcclusionVolume ); DECLARE_DESCRIPTION( "A visibility blocking volume." ); - DECLARE_CATEGORY( "3D Scene" ); + DECLARE_CATEGORY("Volume"); virtual bool onAdd(); diff --git a/Engine/source/T3D/pathCamera.h b/Engine/source/T3D/pathCamera.h index b511917cb..91060796f 100644 --- a/Engine/source/T3D/pathCamera.h +++ b/Engine/source/T3D/pathCamera.h @@ -92,6 +92,7 @@ private: public: DECLARE_CONOBJECT(PathCamera); + DECLARE_CATEGORY("Cinematic"); DECLARE_CALLBACK( void, onNode, (S32 node)); diff --git a/Engine/source/T3D/pathShape.h b/Engine/source/T3D/pathShape.h index 351d2d19c..9748ff04d 100644 --- a/Engine/source/T3D/pathShape.h +++ b/Engine/source/T3D/pathShape.h @@ -79,6 +79,7 @@ private: public: DECLARE_CONOBJECT(PathShape); + DECLARE_CATEGORY("Cinematic"); PathShape(); ~PathShape(); diff --git a/Engine/source/T3D/physicalZone.h b/Engine/source/T3D/physicalZone.h index 004ce6cb3..33aec9ad4 100644 --- a/Engine/source/T3D/physicalZone.h +++ b/Engine/source/T3D/physicalZone.h @@ -77,6 +77,7 @@ class PhysicalZone : public SceneObject // SimObject DECLARE_CONOBJECT(PhysicalZone); + DECLARE_CATEGORY("Volume"); static void consoleInit(); static void initPersistFields(); bool onAdd(); diff --git a/Engine/source/T3D/physics/physicsDebris.h b/Engine/source/T3D/physics/physicsDebris.h index 2a4a3d0fc..917307339 100644 --- a/Engine/source/T3D/physics/physicsDebris.h +++ b/Engine/source/T3D/physics/physicsDebris.h @@ -129,6 +129,7 @@ public: virtual ~PhysicsDebris(); DECLARE_CONOBJECT(PhysicsDebris); + DECLARE_CATEGORY("UNLISTED"); static void initPersistFields(); bool onAdd(); diff --git a/Engine/source/T3D/physics/physicsForce.h b/Engine/source/T3D/physics/physicsForce.h index 15257fd06..c48425d46 100644 --- a/Engine/source/T3D/physics/physicsForce.h +++ b/Engine/source/T3D/physics/physicsForce.h @@ -48,7 +48,7 @@ public: virtual ~PhysicsForce(); DECLARE_CONOBJECT( PhysicsForce ); - + DECLARE_CATEGORY("UNLISTED"); // SimObject static void initPersistFields(); bool onAdd(); @@ -88,4 +88,4 @@ protected: }; -#endif // _T3D_PHYSICS_PHYSICSFORCE_H_ \ No newline at end of file +#endif // _T3D_PHYSICS_PHYSICSFORCE_H_ diff --git a/Engine/source/T3D/physics/physicsShape.h b/Engine/source/T3D/physics/physicsShape.h index ebbad92d2..989409262 100644 --- a/Engine/source/T3D/physics/physicsShape.h +++ b/Engine/source/T3D/physics/physicsShape.h @@ -229,6 +229,7 @@ public: virtual ~PhysicsShape(); DECLARE_CONOBJECT( PhysicsShape ); + DECLARE_CATEGORY("Object \t Destructable"); /// Returns the PhysicsShapeData datablock. PhysicsShapeData* getDataBlock() { return static_cast( Parent::getDataBlock() ); } diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index cd216fa53..b4fe44b40 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -697,6 +697,7 @@ protected: public: DECLARE_CONOBJECT(Player); + DECLARE_CATEGORY("Actor \t Controllable"); Player(); ~Player(); diff --git a/Engine/source/T3D/pointLight.h b/Engine/source/T3D/pointLight.h index 1a0923970..ad1f60bb9 100644 --- a/Engine/source/T3D/pointLight.h +++ b/Engine/source/T3D/pointLight.h @@ -47,6 +47,7 @@ public: // ConsoleObject DECLARE_CONOBJECT( PointLight ); + DECLARE_CATEGORY("Lighting \t Lights"); static void initPersistFields(); // SceneObject diff --git a/Engine/source/T3D/portal.h b/Engine/source/T3D/portal.h index 994e50dac..7a13b1348 100644 --- a/Engine/source/T3D/portal.h +++ b/Engine/source/T3D/portal.h @@ -185,7 +185,8 @@ class Portal : public Zone // SimObject. DECLARE_CONOBJECT( Portal ); - + DECLARE_CATEGORY("Volume"); + static void initPersistFields(); static void consoleInit(); diff --git a/Engine/source/T3D/prefab.h b/Engine/source/T3D/prefab.h index 95af5e7ed..6e8cc9a7b 100644 --- a/Engine/source/T3D/prefab.h +++ b/Engine/source/T3D/prefab.h @@ -57,6 +57,7 @@ public: virtual ~Prefab(); DECLARE_CONOBJECT(Prefab); + DECLARE_CATEGORY("Object \t Collection"); static void initPersistFields(); diff --git a/Engine/source/T3D/projectile.h b/Engine/source/T3D/projectile.h index 9aa0690d0..8e8f9542a 100644 --- a/Engine/source/T3D/projectile.h +++ b/Engine/source/T3D/projectile.h @@ -187,6 +187,7 @@ public: ~Projectile(); DECLARE_CONOBJECT(Projectile); + DECLARE_CATEGORY("UNLISTED"); // SimObject bool onAdd(); diff --git a/Engine/source/T3D/rigid.cpp b/Engine/source/T3D/rigid.cpp index 31f4d411a..3dea66a6a 100644 --- a/Engine/source/T3D/rigid.cpp +++ b/Engine/source/T3D/rigid.cpp @@ -156,7 +156,7 @@ bool Rigid::resolveCollision(const Point3F& p, const Point3F &normal, Rigid* rig return false; // Compute impulse - F32 d, n = -nv * (2.0f + restitution * rigid->restitution); + F32 d, n = -nv * (1.0+(restitution + rigid->restitution)*0.5); Point3F a1,b1,c1; mCross(r1,normal,&a1); invWorldInertia.mulV(a1,&b1); diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index 2fb3eee8d..faa704ba0 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -900,9 +900,11 @@ bool RigidShape::onNewDataBlock(GameBaseData* dptr, bool reload) mRigid.restitution = mDataBlock->body.restitution; mRigid.setCenterOfMass(mDataBlock->massCenter); - // Ignores massBox, just set sphere for now. Derived objects - // can set what they want. - mRigid.setObjectInertia(); + // Set inertial tensor, default for the RigidShape is sphere + if (mDataBlock->massBox.x > 0 && mDataBlock->massBox.y > 0 && mDataBlock->massBox.z > 0) + mRigid.setObjectInertia(mDataBlock->massBox); + else + mRigid.setObjectInertia(mObjBox.maxExtents - mObjBox.minExtents); scriptOnNewDataBlock(); @@ -1115,9 +1117,9 @@ void RigidShape::updatePos(F32 dt) if (mCollisionList.getCount()) { F32 k = mRigid.getKineticEnergy(); - F32 G = mNetGravity * dt; + F32 G = mNetGravity; F32 Kg = 0.5 * mRigid.mass * G * G; - if (k < sRestTol * Kg && ++restCount > sRestCount) + if (k < sRestTol * Kg* dt && ++restCount > sRestCount) mRigid.setAtRest(); } else @@ -1205,8 +1207,12 @@ void RigidShape::updatePos(F32 dt) void RigidShape::updateForces(F32 dt) { - if (mDisableMove) return; - + if (mDisableMove) + { + mRigid.linVelocity = Point3F::Zero; + mRigid.angMomentum = Point3F::Zero; + return; + } Point3F torque(0, 0, 0); Point3F force(0, 0, mRigid.mass * mNetGravity); @@ -1222,10 +1228,6 @@ void RigidShape::updateForces(F32 dt) mRigid.force = force; mRigid.torque = torque; - - // If we're still atRest, make sure we're not accumulating anything - if ((force.lenSquared() < mDataBlock->contactTol)&& (force.lenSquared() < mDataBlock->contactTol)) - mRigid.setAtRest(); } @@ -1260,8 +1262,7 @@ bool RigidShape::updateCollision(F32 dt) } // Resolve collisions - bool collided = resolveCollision(mRigid,mCollisionList); - resolveContacts(mRigid,mCollisionList,dt); + bool collided = resolveCollision(mRigid,mCollisionList, dt); return collided; } @@ -1271,7 +1272,7 @@ bool RigidShape::updateCollision(F32 dt) Handle collision impacts, as opposed to contacts. Impulses are calculated based on standard collision resolution formulas. */ -bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList) +bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList, F32 dt) { PROFILE_SCOPE(RigidShape_resolveCollision); // Apply impulses to resolve collision @@ -1279,6 +1280,11 @@ bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList) for (S32 i = 0; i < cList.getCount(); i++) { Collision& c = cList[i]; + if (c.object == this) + { + //Con::printf("IMPOSSIBLE!!!!--------------------------------> Self-collision event?"); + continue; + } if (c.distance < mDataBlock->collisionTol) { // Velocity into surface @@ -1288,9 +1294,7 @@ bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList) F32 vn = mDot(v, c.normal); // Only interested in velocities greater than sContactTol, - // velocities less than that will be dealt with as contacts - // "constraints". - if (vn < -mDataBlock->contactTol) + if (mFabs(vn) > mDataBlock->contactTol) { // Apply impulses to the rigid body to keep it from @@ -1313,45 +1317,15 @@ bool RigidShape::resolveCollision(Rigid& ns,CollisionList& cList) queueCollision(col, v - col->getVelocity()); } } - } - } - - return collided; -} - -//---------------------------------------------------------------------------- -/** Resolve contact forces -Resolve contact forces using the "penalty" method. Forces are generated based -on the depth of penetration and the moment of inertia at the point of contact. -*/ -bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) -{ - PROFILE_SCOPE(RigidShape_resolveContacts); - // Use spring forces to manage contact constraints. - bool collided = false; - Point3F t,p(0,0,0),l(0,0,0); - for (S32 i = 0; i < cList.getCount(); i++) - { - const Collision& c = cList[i]; - if (c.distance < mDataBlock->collisionTol) - { - - // Velocity into the surface - Point3F v,r; - ns.getOriginVector(c.point,&r); - ns.getVelocity(r,&v); - F32 vn = mDot(v,c.normal); - - // Only interested in velocities less than mDataBlock->contactTol, - // velocities greater than that are dealt with as collisions. - if (mFabs(vn) < mDataBlock->contactTol) + // velocities less than that will be dealt with as contacts + // "constraints". + else { - collided = true; - + Point3F t; // Penetration force. This is actually a spring which // will seperate the body from the collision surface. - F32 zi = 2 * mFabs(mRigid.getZeroImpulse(r,c.normal)); - F32 s = (mDataBlock->collisionTol - c.distance) * zi - ((vn / mDataBlock->contactTol) * zi); + F32 zi = 2 * mFabs(mRigid.getZeroImpulse(r, c.normal) / dt); + F32 s = mMax((mDataBlock->collisionTol - c.distance) * zi - ((vn / 2.0) * zi),0.0f); Point3F f = c.normal * s; // Friction impulse, calculated as a function of the @@ -1359,10 +1333,10 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) // perpendicular to the normal. Point3F uv = v - (c.normal * vn); F32 ul = uv.len(); - if (s > 0 && ul) + if (s > 0 && ul) { uv /= -ul; - F32 u = ul * ns.getZeroImpulse(r,uv); + F32 u = ul * ns.getZeroImpulse(r, uv) / dt; s *= mRigid.friction; if (u > s) u = s; @@ -1370,20 +1344,17 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) } // Accumulate forces - p += f; - mCross(r,f,&t); - l += t; + mCross(r, f, &t); + ns.linMomentum += f * dt; + ns.angMomentum += t * dt; + ns.updateVelocity(); } } } - // Contact constraint forces act over time... - ns.linMomentum += p * dt; - ns.angMomentum += l * dt; - ns.updateVelocity(); - return true; -} + return collided; +} //---------------------------------------------------------------------------- @@ -1693,6 +1664,8 @@ void RigidShape::initPersistFields() docsURL; addField("disableMove", TypeBool, Offset(mDisableMove, RigidShape), "When this flag is set, the vehicle will ignore throttle changes."); + addField("isAtRest", TypeBool, Offset(mRigid.atRest, RigidShape), + "Debug read of the rest state. do not set"); Parent::initPersistFields(); } diff --git a/Engine/source/T3D/rigidShape.h b/Engine/source/T3D/rigidShape.h index fe5d3623a..90d960162 100644 --- a/Engine/source/T3D/rigidShape.h +++ b/Engine/source/T3D/rigidShape.h @@ -216,8 +216,7 @@ class RigidShape: public ShapeBase bool onNewDataBlock( GameBaseData *dptr, bool reload ); void updatePos(F32 dt); bool updateCollision(F32 dt); - bool resolveCollision(Rigid& ns,CollisionList& cList); - bool resolveContacts(Rigid& ns,CollisionList& cList,F32 dt); + bool resolveCollision(Rigid& ns,CollisionList& cList, F32 dt); bool resolveDisplacement(Rigid& ns,CollisionState *state,F32 dt); void checkTriggers(); static void findCallback(SceneObject* obj,void * key); @@ -308,6 +307,7 @@ public: void unpackUpdate(NetConnection *conn, BitStream *stream); DECLARE_CONOBJECT(RigidShape); + DECLARE_CATEGORY("Object \t Destructable"); }; diff --git a/Engine/source/T3D/scopeAlwaysShape.cpp b/Engine/source/T3D/scopeAlwaysShape.cpp index ea804cf69..92b5c1ee7 100644 --- a/Engine/source/T3D/scopeAlwaysShape.cpp +++ b/Engine/source/T3D/scopeAlwaysShape.cpp @@ -30,6 +30,7 @@ class ScopeAlwaysShape : public StaticShape ScopeAlwaysShape(); static void initPersistFields(); DECLARE_CONOBJECT(ScopeAlwaysShape); + DECLARE_CATEGORY("UNLISTED"); }; ScopeAlwaysShape::ScopeAlwaysShape() diff --git a/Engine/source/T3D/sfx/sfxEmitter.cpp b/Engine/source/T3D/sfx/sfxEmitter.cpp index 2ff998eec..967da296a 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.cpp +++ b/Engine/source/T3D/sfx/sfxEmitter.cpp @@ -89,6 +89,120 @@ ColorI SFXEmitter::smRenderColorOutsideVolume( 255, 0, 0, 255 ); ColorI SFXEmitter::smRenderColorRangeSphere( 200, 0, 0, 90 ); + +//----------------------------------------------------------------------------- + +ConsoleType(SoundControls, TypeSoundControls, bool, "") + +ConsoleGetType(TypeSoundControls) +{ + return ""; +} +ConsoleSetType(TypeSoundControls) +{ +} + +IMPLEMENT_CONOBJECT(GuiInspectorTypeSoundControls); +ConsoleDocClass(GuiInspectorTypeSoundControls, + "@brief Inspector field type for Controlling playback of sounds\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeSoundControls::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeSoundControls)->setInspectorFieldType("GuiInspectorTypeSoundControls"); +} + +GuiControl* GuiInspectorTypeSoundControls::constructEditControl() +{ + // Create base filename edit controls + GuiControl* retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + char szBuffer[512]; + + setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); + + mPlayButton = new GuiBitmapButtonCtrl(); + dSprintf(szBuffer, sizeof(szBuffer), "%d.play();", mInspector->getInspectObject()->getId()); + mPlayButton->setField("Command", szBuffer); + + mPlayButton->setBitmap(StringTable->insert("ToolsModule:playbutton_n_image")); + + mPlayButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mPlayButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mPlayButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mPlayButton->setDataField(StringTable->insert("tooltip"), NULL, "Play this sound emitter"); + + mPlayButton->registerObject(); + addObject(mPlayButton); + + mPauseButton = new GuiBitmapButtonCtrl(); + dSprintf(szBuffer, sizeof(szBuffer), "%d.pause();", mInspector->getInspectObject()->getId()); + mPauseButton->setField("Command", szBuffer); + + mPauseButton->setBitmap(StringTable->insert("ToolsModule:pausebutton_n_image")); + + mPauseButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mPauseButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mPauseButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mPauseButton->setDataField(StringTable->insert("tooltip"), NULL, "Pause this sound emitter"); + + mPauseButton->registerObject(); + addObject(mPauseButton); + + mStopButton = new GuiBitmapButtonCtrl(); + dSprintf(szBuffer, sizeof(szBuffer), "%d.stop();", mInspector->getInspectObject()->getId()); + mStopButton->setField("Command", szBuffer); + + mStopButton->setBitmap(StringTable->insert("ToolsModule:stopbutton_n_image")); + + mStopButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mStopButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mStopButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mStopButton->setDataField(StringTable->insert("tooltip"), NULL, "Stop this sound emitter"); + + mStopButton->registerObject(); + addObject(mStopButton); + + return retCtrl; +} + +bool GuiInspectorTypeSoundControls::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + + if (mPlayButton != NULL) + { + RectI shapeEdRect(2, 2, 16, 16); + resized |= mPlayButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + if (mPauseButton != NULL) + { + RectI shapeEdRect(20, 2, 16, 16); + resized |= mPauseButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + if (mStopButton != NULL) + { + RectI shapeEdRect(38, 2, 16, 16); + resized |= mStopButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} + + //----------------------------------------------------------------------------- SFXEmitter::SFXEmitter() @@ -106,8 +220,7 @@ SFXEmitter::SFXEmitter() mDescription.mFadeInTime = -1.f; mDescription.mFadeOutTime = -1.f; mInstanceDescription = &mDescription; - mLocalProfile.mFilename = StringTable->EmptyString(); - mLocalProfile._registerSignals(); + mLocalProfile = NULL; INIT_ASSET(Sound); @@ -119,7 +232,9 @@ SFXEmitter::SFXEmitter() SFXEmitter::~SFXEmitter() { - mLocalProfile.onRemove(); + if(mLocalProfile != NULL) + mLocalProfile->onRemove(); + SFX_DELETE( mSource ); } @@ -191,6 +306,8 @@ void SFXEmitter::initPersistFields() addGroup( "Sound" ); + addField("Controls", TypeSoundControls, 0, ""); + addField( "playOnAdd", TypeBool, Offset( mPlayOnAdd, SFXEmitter ), "Whether playback of the emitter's sound should start as soon as the emitter object is added to the level.\n" "If this is true, the emitter will immediately start to play when the level is loaded." ); @@ -365,6 +482,7 @@ U32 SFXEmitter::packUpdate(NetConnection* con, U32 mask, BitStream* stream) // Write the source playback state. stream->writeFlag( mask & SourcePlayMask ); + stream->writeFlag( mask & SourcePauseMask ); stream->writeFlag( mask & SourceStopMask ); return retMask; @@ -490,6 +608,8 @@ void SFXEmitter::unpackUpdate( NetConnection *conn, BitStream *stream ) // Check the source playback masks. if ( stream->readFlag() ) // SourcePlayMask play(); + if (stream->readFlag()) //SourcePauseMask + pause(); if ( stream->readFlag() ) // SourceStopMask stop(); } @@ -653,7 +773,7 @@ void SFXEmitter::_update() SFXStatus prevState = mSource ? mSource->getStatus() : SFXStatusNull; // are we overriding the asset properties? - bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && mSoundAsset->getSfxProfile()); + bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile()); if (mSoundAsset.notNull()) { @@ -662,12 +782,12 @@ void SFXEmitter::_update() else mInstanceDescription = &mDescription; - mLocalProfile = *mSoundAsset->getSfxProfile(); - } - // Make sure all the settings are valid. - mInstanceDescription->validate(); - mLocalProfile.setDescription(mInstanceDescription); + mLocalProfile = getSoundProfile(); + // Make sure all the settings are valid. + mInstanceDescription->validate(); + mLocalProfile->setDescription(mInstanceDescription); + } const MatrixF& transform = getTransform(); const VectorF& velocity = getVelocity(); @@ -676,12 +796,12 @@ void SFXEmitter::_update() if( mDirty.test( Track | Is3D | IsLooping | IsStreaming | TrackOnly ) ) { SFX_DELETE( mSource ); - if (mLocalProfile.getSoundFileName().isNotEmpty()) + if (getSoundProfile()) { - mSource = SFX->createSource(&mLocalProfile, &transform, &velocity); + mSource = SFX->createSource(mLocalProfile, &transform, &velocity); if (!mSource) Con::errorf("SFXEmitter::_update() - failed to create sound for track %i (%s)", - mSoundAsset->getSfxProfile()->getId(), mSoundAsset->getSfxProfile()->getName()); + getSoundProfile()->getId(), getSoundProfile()->getName()); // If we're supposed to play when the emitter is // added to the scene then also restart playback @@ -999,6 +1119,23 @@ void SFXEmitter::play() //----------------------------------------------------------------------------- +void SFXEmitter::pause() +{ + if (mSource) + mSource->pause(); + else + { + // By clearing the playback masks first we + // ensure the last playback command called + // within a single tick is the one obeyed. + clearMaskBits(AllSourceMasks); + + setMaskBits(SourcePauseMask); + } +} + +//----------------------------------------------------------------------------- + void SFXEmitter::stop() { if ( mSource ) @@ -1043,8 +1180,8 @@ SFXStatus SFXEmitter::_getPlaybackStatus() const bool SFXEmitter::is3D() const { - if( mSoundAsset.notNull() && mSoundAsset->getSfxProfile() != NULL ) - return mSoundAsset->getSfxProfile()->getDescription()->mIs3D; + if( mSoundAsset.notNull() ) + return mSoundAsset->getSfxDescription()->mIs3D; else return mInstanceDescription->mIs3D; } @@ -1080,8 +1217,8 @@ void SFXEmitter::setScale( const VectorF &scale ) { F32 maxDistance; - if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && mSoundAsset->getSfxProfile()) - maxDistance = mSoundAsset->getSfxProfile()->getDescription()->mMaxDistance; + if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile()) + maxDistance = mSoundAsset->getSfxDescription()->mMaxDistance; else { // Use the average of the three coords. @@ -1113,6 +1250,15 @@ DefineEngineMethod( SFXEmitter, play, void, (),, //----------------------------------------------------------------------------- +DefineEngineMethod(SFXEmitter, pause, void, (), , + "Manually pause playback of the emitter's sound.\n" + "If this is called on the server-side object, the pause command will be related to all client-side ghosts.\n") +{ + object->pause(); +} + +//----------------------------------------------------------------------------- + DefineEngineMethod( SFXEmitter, stop, void, (),, "Manually stop playback of the emitter's sound.\n" "If this is called on the server-side object, the stop command will be related to all client-side ghosts.\n" ) @@ -1130,3 +1276,4 @@ DefineEngineMethod( SFXEmitter, getSource, SFXSource*, (),, { return object->getSource(); } + diff --git a/Engine/source/T3D/sfx/sfxEmitter.h b/Engine/source/T3D/sfx/sfxEmitter.h index 134b6828c..f21ef168d 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.h +++ b/Engine/source/T3D/sfx/sfxEmitter.h @@ -41,6 +41,21 @@ class SFXSource; class SFXTrack; +DefineConsoleType(TypeSoundControls, bool) +class GuiInspectorTypeSoundControls : public GuiInspectorField +{ + typedef GuiInspectorField Parent; +public: + GuiBitmapButtonCtrl* mPlayButton; + GuiBitmapButtonCtrl* mPauseButton; + GuiBitmapButtonCtrl* mStopButton; + + DECLARE_CONOBJECT(GuiInspectorTypeSoundControls); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; //RDTODO: make 3D sound emitters yield their source when being culled /// The SFXEmitter is used to place 2D or 3D sounds into a @@ -69,7 +84,8 @@ class SFXEmitter : public SceneObject DirtyUpdateMask = BIT(2), SourcePlayMask = BIT(3), - SourceStopMask = BIT(4), + SourcePauseMask = BIT(4), + SourceStopMask = BIT(5), AllSourceMasks = SourcePlayMask | SourceStopMask, }; @@ -116,7 +132,7 @@ class SFXEmitter : public SceneObject /// A local profile object used to coax the /// sound system to play a custom sound. - SFXProfile mLocalProfile; + SFXTrack* mLocalProfile; /// The description used by the local profile. SFXDescription mDescription; @@ -219,6 +235,10 @@ class SFXEmitter : public SceneObject /// the emitter source is not already playing. void play(); + /// Sends network event to pause playback if + /// the emitter source is already playing. + void pause(); + /// Sends network event to stop emitter /// playback on all ghosted clients. void stop(); @@ -240,7 +260,7 @@ class SFXEmitter : public SceneObject DECLARE_CONOBJECT( SFXEmitter ); DECLARE_DESCRIPTION( "A 3D object emitting sound." ); - DECLARE_CATEGORY( "3D Sound" ); + DECLARE_CATEGORY("Environment \t FX"); }; #endif // _SFXEMITTER_H_ diff --git a/Engine/source/T3D/sfx/sfxSpace.h b/Engine/source/T3D/sfx/sfxSpace.h index 028a85fdf..d43339c30 100644 --- a/Engine/source/T3D/sfx/sfxSpace.h +++ b/Engine/source/T3D/sfx/sfxSpace.h @@ -55,7 +55,7 @@ class SFXSpace : public SceneAmbientSoundObject< ScenePolyhedralObject< SceneSpa // SimObject. DECLARE_CONOBJECT( SFXSpace ); DECLARE_DESCRIPTION( "A box volume that defines an ambient sound space." ); - DECLARE_CATEGORY( "3D Sound" ); + DECLARE_CATEGORY("Volume"); static void consoleInit(); }; diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index c130b57b4..e82400446 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -2303,9 +2303,12 @@ void ShapeBase::updateAudioState(SoundThread& st) // if asset is valid, play if (st.asset->isAssetValid() ) { - st.sound = SFX->createSource( st.asset->getSfxProfile() , &getTransform() ); - if ( st.sound ) - st.sound->play(); + if (st.asset->load() == AssetBase::Ok) + { + st.sound = SFX->createSource(st.asset->getSFXTrack(), &getTransform()); + if (st.sound) + st.sound->play(); + } } else st.play = false; diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 576c23e7f..ae823b6b9 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -91,7 +91,7 @@ class SFXProfile; typedef void* Light; -const F32 gGravity = -20; +const F32 gGravity = -9.8f; //-------------------------------------------------------------------------- diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index c71c6f938..9ecddfc21 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -2785,7 +2785,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force) // Delete any loooping sounds that were in the previous state. // this is the crazy bit =/ needs to know prev state in order to stop sounds. // lastState does not return an id for the prev state so we keep track of it. - if (lastState->sound && lastState->sound->getSfxProfile()->getDescription()->mIsLooping) + if (lastState->sound && lastState->sound->getSFXTrack()->getDescription()->mIsLooping) { for (Vector::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++) SFX_DELETE((*i)); @@ -2799,7 +2799,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force) if (stateData.sound) { const Point3F& velocity = getVelocity(); - image.addSoundSource(SFX->createSource(stateData.sound->getSfxProfile(), &getRenderTransform(), &velocity)); + image.addSoundSource(SFX->createSource(stateData.sound->getSFXTrack(), &getRenderTransform(), &velocity)); } if (stateData.soundTrack) { diff --git a/Engine/source/T3D/spotLight.h b/Engine/source/T3D/spotLight.h index 2552f2321..20e6426f6 100644 --- a/Engine/source/T3D/spotLight.h +++ b/Engine/source/T3D/spotLight.h @@ -51,6 +51,7 @@ public: // ConsoleObject DECLARE_CONOBJECT( SpotLight ); + DECLARE_CATEGORY("Lighting \t Lights"); static void initPersistFields(); // SceneObject diff --git a/Engine/source/T3D/staticShape.h b/Engine/source/T3D/staticShape.h index 7403b9e3a..a97375847 100644 --- a/Engine/source/T3D/staticShape.h +++ b/Engine/source/T3D/staticShape.h @@ -75,6 +75,7 @@ protected: public: DECLARE_CONOBJECT(StaticShape); + DECLARE_CATEGORY("Object \t Destructable"); StaticShape(); ~StaticShape(); diff --git a/Engine/source/T3D/trigger.h b/Engine/source/T3D/trigger.h index c5814edbb..a661c32bd 100644 --- a/Engine/source/T3D/trigger.h +++ b/Engine/source/T3D/trigger.h @@ -127,6 +127,7 @@ class Trigger : public GameBase // SimObject DECLARE_CONOBJECT(Trigger); + DECLARE_CATEGORY("Volume"); DECLARE_CALLBACK( void, onAdd, ( U32 objectId ) ); DECLARE_CALLBACK( void, onRemove, ( U32 objectId ) ); diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index 6aa8b8141..fb870b88a 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -236,6 +236,7 @@ public: ~TSStatic(); DECLARE_CONOBJECT(TSStatic); + DECLARE_CATEGORY("Object \t Simple"); static void initPersistFields(); /// returns the shape asset used for this object StringTableEntry getTypeHint() const override { return (getShapeAsset()) ? getShapeAsset()->getAssetName(): StringTable->EmptyString(); } diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 6fe8f6dce..179d6a4ca 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -541,13 +541,20 @@ void FlyingVehicle::updateForces(F32 /*dt*/) F32 vf = mRigid.mass * -mNetGravity; F32 h = getHeight(); if (h <= 1) { - if (h > 0) { - vf -= vf * h * 0.1; + F32 seperationForce = vf * (1.0 - h); + if (h > 0.5) { + vf -= seperationForce * mDataBlock->drag; } else { - vf += mDataBlock->jetForce * -h; + if (h < 0.0) + { + Point3F displacePos = getPosition(); + displacePos.z += mDataBlock->hoverHeight * (-h * 2); + mRigid.linPosition = displacePos; + } + vf += seperationForce; } } - force += zv * vf; + force.z += vf; // Damping "surfaces" force -= xv * mDot(xv,mRigid.linVelocity) * mDataBlock->horizontalSurfaceForce; @@ -599,8 +606,8 @@ F32 FlyingVehicle::getHeight() { Point3F sp,ep; RayInfo collision; - F32 height = (createHeightOn) ? mDataBlock->createHoverHeight : mDataBlock->hoverHeight; - F32 r = 10 + height; + F32 height = ((createHeightOn) ? mDataBlock->createHoverHeight : mDataBlock->hoverHeight) + mDataBlock->collisionTol*2; + F32 r = 3 * height; getTransform().getColumn(3, &sp); ep.x = sp.x; ep.y = sp.y; @@ -609,7 +616,7 @@ F32 FlyingVehicle::getHeight() if( !mContainer->castRay(sp, ep, sClientCollisionMask, &collision) == true ) collision.t = 1; enableCollision(); - return (r * collision.t - height) / 10; + return (r * collision.t - height) / r; } diff --git a/Engine/source/T3D/vehicles/flyingVehicle.h b/Engine/source/T3D/vehicles/flyingVehicle.h index 9567e7e03..96beed99a 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.h +++ b/Engine/source/T3D/vehicles/flyingVehicle.h @@ -180,6 +180,7 @@ class FlyingVehicle: public Vehicle U32 getCollisionMask(); public: DECLARE_CONOBJECT(FlyingVehicle); + DECLARE_CATEGORY("Actor \t Controllable"); static void initPersistFields(); FlyingVehicle(); diff --git a/Engine/source/T3D/vehicles/hoverVehicle.h b/Engine/source/T3D/vehicles/hoverVehicle.h index a49311f03..a39cefdc6 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.h +++ b/Engine/source/T3D/vehicles/hoverVehicle.h @@ -200,6 +200,7 @@ class HoverVehicle : public Vehicle void advanceTime(F32 dt); DECLARE_CONOBJECT(HoverVehicle); + DECLARE_CATEGORY("Actor \t Controllable"); // static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index 27d1ef922..fcddd5cc0 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -807,9 +807,9 @@ void Vehicle::updatePos(F32 dt) if (mCollisionList.getCount()) { F32 k = mRigid.getKineticEnergy(); - F32 G = mNetGravity * dt; + F32 G = mNetGravity; F32 Kg = 0.5 * mRigid.mass * G * G; - if (k < sRestTol * Kg && ++restCount > sRestCount) + if (k < sRestTol * Kg * dt && ++restCount > sRestCount) mRigid.setAtRest(); } else diff --git a/Engine/source/T3D/vehicles/vehicle.h b/Engine/source/T3D/vehicles/vehicle.h index ff6b29817..6fc31d43b 100644 --- a/Engine/source/T3D/vehicles/vehicle.h +++ b/Engine/source/T3D/vehicles/vehicle.h @@ -165,6 +165,7 @@ public: /// @} DECLARE_CONOBJECT(Vehicle); + DECLARE_CATEGORY("UNLISTED"); }; diff --git a/Engine/source/T3D/vehicles/vehicleBlocker.h b/Engine/source/T3D/vehicles/vehicleBlocker.h index e2861bbe7..12441b044 100644 --- a/Engine/source/T3D/vehicles/vehicleBlocker.h +++ b/Engine/source/T3D/vehicles/vehicleBlocker.h @@ -52,6 +52,7 @@ class VehicleBlocker : public SceneObject ~VehicleBlocker(); DECLARE_CONOBJECT(VehicleBlocker); + DECLARE_CATEGORY("Volume"); static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.h b/Engine/source/T3D/vehicles/wheeledVehicle.h index 93f197757..1c9e9bff3 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.h +++ b/Engine/source/T3D/vehicles/wheeledVehicle.h @@ -225,6 +225,7 @@ class WheeledVehicle: public Vehicle public: DECLARE_CONOBJECT(WheeledVehicle); + DECLARE_CATEGORY("Actor \t Controllable"); static void initPersistFields(); WheeledVehicle(); diff --git a/Engine/source/T3D/zone.h b/Engine/source/T3D/zone.h index 0f4e1e471..090764aea 100644 --- a/Engine/source/T3D/zone.h +++ b/Engine/source/T3D/zone.h @@ -68,7 +68,7 @@ class Zone : public SceneAmbientSoundObject< ScenePolyhedralZone > // SimObject DECLARE_CONOBJECT( Zone ); DECLARE_DESCRIPTION( "A volume that encloses objects for visibility culling." ); - DECLARE_CATEGORY( "3D" ); + DECLARE_CATEGORY("Volume"); static void consoleInit(); }; diff --git a/Engine/source/afx/afxCamera.h b/Engine/source/afx/afxCamera.h index e04afaa13..78e4bcb98 100644 --- a/Engine/source/afx/afxCamera.h +++ b/Engine/source/afx/afxCamera.h @@ -51,7 +51,6 @@ struct afxCameraData: public ShapeBaseData { // DECLARE_CONOBJECT(afxCameraData); - DECLARE_CATEGORY("AFX"); static void initPersistFields(); virtual void packData(BitStream* stream); virtual void unpackData(BitStream* stream); @@ -144,7 +143,7 @@ public: bool isCamera() const { return true; } DECLARE_CONOBJECT(afxCamera); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); private: // 3POV SECTION void cam_update_3pov(F32 dt, bool on_server); diff --git a/Engine/source/afx/afxChoreographer.h b/Engine/source/afx/afxChoreographer.h index e3b83585e..70a301350 100644 --- a/Engine/source/afx/afxChoreographer.h +++ b/Engine/source/afx/afxChoreographer.h @@ -57,7 +57,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxChoreographerData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -200,7 +199,7 @@ public: virtual void impactNotify(const Point3F& p, const Point3F& n, SceneObject*) { } DECLARE_CONOBJECT(afxChoreographer); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); // CONSTRAINT REMAPPING << protected: diff --git a/Engine/source/afx/afxEffectGroup.h b/Engine/source/afx/afxEffectGroup.h index 2942bddb0..87a99522e 100644 --- a/Engine/source/afx/afxEffectGroup.h +++ b/Engine/source/afx/afxEffectGroup.h @@ -96,7 +96,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxEffectGroupData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxEffectWrapper.h b/Engine/source/afx/afxEffectWrapper.h index 37a0e9fcb..b12678795 100644 --- a/Engine/source/afx/afxEffectWrapper.h +++ b/Engine/source/afx/afxEffectWrapper.h @@ -100,7 +100,6 @@ public: virtual void gather_cons_defs(Vector& defs) { }; DECLARE_CONOBJECT(afxEffectBaseData); - DECLARE_CATEGORY("AFX"); }; //class afxEffectWrapperData : public GameBaseData, public afxEffectDefs @@ -207,7 +206,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxEffectWrapperData); - DECLARE_CATEGORY("AFX"); }; inline bool afxEffectWrapperData::testExecConditions(U32 conditions) @@ -382,7 +380,6 @@ public: static afxEffectWrapper* ew_create(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*, F32 time_factor, S32 group_index=0); DECLARE_CONOBJECT(afxEffectWrapper); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxEffectron.h b/Engine/source/afx/afxEffectron.h index 9c05a48b3..bb66c988b 100644 --- a/Engine/source/afx/afxEffectron.h +++ b/Engine/source/afx/afxEffectron.h @@ -82,7 +82,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxEffectronData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -178,7 +177,6 @@ public: void finish_startup(); DECLARE_CONOBJECT(afxEffectron); - DECLARE_CATEGORY("AFX"); private: void process_server(); diff --git a/Engine/source/afx/afxMagicMissile.h b/Engine/source/afx/afxMagicMissile.h index 4b3430918..957066a4b 100644 --- a/Engine/source/afx/afxMagicMissile.h +++ b/Engine/source/afx/afxMagicMissile.h @@ -218,7 +218,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxMagicMissileData); - DECLARE_CATEGORY("AFX"); public: /*C*/ afxMagicMissileData(const afxMagicMissileData&, bool = false); @@ -400,7 +399,7 @@ public: virtual void onDeleteNotify(SimObject*); DECLARE_CONOBJECT(afxMagicMissile); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); static void initPersistFields(); diff --git a/Engine/source/afx/afxMagicSpell.h b/Engine/source/afx/afxMagicSpell.h index f7545bdb8..c97886802 100644 --- a/Engine/source/afx/afxMagicSpell.h +++ b/Engine/source/afx/afxMagicSpell.h @@ -122,7 +122,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxMagicSpellData); - DECLARE_CATEGORY("AFX"); /// @name Callbacks /// @{ @@ -320,7 +319,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxMagicSpell); - DECLARE_CATEGORY("AFX"); private: void process_server(); diff --git a/Engine/source/afx/afxResidueMgr.h b/Engine/source/afx/afxResidueMgr.h index 5219f331b..a4066828a 100644 --- a/Engine/source/afx/afxResidueMgr.h +++ b/Engine/source/afx/afxResidueMgr.h @@ -171,7 +171,7 @@ public: static void setMaster(afxResidueMgr* m) { the_mgr = m; } DECLARE_CONOBJECT(afxResidueMgr); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxSelectron.h b/Engine/source/afx/afxSelectron.h index f7b0c4e50..deca54fdf 100644 --- a/Engine/source/afx/afxSelectron.h +++ b/Engine/source/afx/afxSelectron.h @@ -106,7 +106,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxSelectronData); - DECLARE_CATEGORY("AFX"); }; inline bool afxSelectronData::matches(U32 mask, U8 style) @@ -219,7 +218,7 @@ public: void finish_startup(); DECLARE_CONOBJECT(afxSelectron); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); private: void process_server(); diff --git a/Engine/source/afx/afxSpellBook.h b/Engine/source/afx/afxSpellBook.h index 37a564104..e6bf8d580 100644 --- a/Engine/source/afx/afxSpellBook.h +++ b/Engine/source/afx/afxSpellBook.h @@ -68,7 +68,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxSpellBookData); - DECLARE_CATEGORY("AFX"); }; inline bool afxSpellBookData::verifyPageSlot(S32 page, S32 slot) @@ -128,7 +127,7 @@ public: F32 getCooldownFactor(S32 page, S32 slot); DECLARE_CONOBJECT(afxSpellBook); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; inline S32 afxSpellBook::getPageSlotIndex(S32 page, S32 slot) diff --git a/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h index 862c2bc86..5e8deafb9 100644 --- a/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h +++ b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h @@ -83,7 +83,6 @@ public: // ConsoleObject DECLARE_CONOBJECT(afxZodiacGroundPlaneRenderer); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h index bc8477bef..8fd5e10f7 100644 --- a/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h +++ b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h @@ -84,7 +84,6 @@ public: // ConsoleObject DECLARE_CONOBJECT(afxZodiacMeshRoadRenderer); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h index a01dffd34..b28fba9c1 100644 --- a/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h +++ b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h @@ -84,7 +84,6 @@ public: // ConsoleObject DECLARE_CONOBJECT(afxZodiacPolysoupRenderer); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h index cf93ded16..1f0f804a5 100644 --- a/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h +++ b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h @@ -84,7 +84,6 @@ public: // ConsoleObject DECLARE_CONOBJECT(afxZodiacTerrainRenderer); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index 4e67124d9..dccaca6c9 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -83,7 +83,6 @@ public: } DECLARE_CONOBJECT(ClientZoneInEvent); - DECLARE_CATEGORY("AFX"); }; IMPLEMENT_CO_SERVEREVENT_V1(ClientZoneInEvent); diff --git a/Engine/source/afx/ce/afxAnimClip.h b/Engine/source/afx/ce/afxAnimClip.h index 4b1dbb0f3..19bd3ccfa 100644 --- a/Engine/source/afx/ce/afxAnimClip.h +++ b/Engine/source/afx/ce/afxAnimClip.h @@ -73,7 +73,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxAnimClipData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAnimLock.h b/Engine/source/afx/ce/afxAnimLock.h index fea98194b..8aa9cf348 100644 --- a/Engine/source/afx/ce/afxAnimLock.h +++ b/Engine/source/afx/ce/afxAnimLock.h @@ -40,7 +40,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxAnimLockData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAreaDamage.h b/Engine/source/afx/ce/afxAreaDamage.h index 4386acd4e..dd8a2b30a 100644 --- a/Engine/source/afx/ce/afxAreaDamage.h +++ b/Engine/source/afx/ce/afxAreaDamage.h @@ -54,7 +54,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxAreaDamageData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAudioBank.h b/Engine/source/afx/ce/afxAudioBank.h index e7f9ee4d3..1f1fa42e8 100644 --- a/Engine/source/afx/ce/afxAudioBank.h +++ b/Engine/source/afx/ce/afxAudioBank.h @@ -59,7 +59,6 @@ public: virtual bool allowSubstitutions() const { return true; } DECLARE_CONOBJECT(afxAudioBank); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxBillboard.h b/Engine/source/afx/ce/afxBillboard.h index 8c6532539..da382ac20 100644 --- a/Engine/source/afx/ce/afxBillboard.h +++ b/Engine/source/afx/ce/afxBillboard.h @@ -74,7 +74,6 @@ public: void onChangeTexture() {} DECLARE_CONOBJECT(afxBillboardData); - DECLARE_CATEGORY("AFX"); }; typedef afxBillboardData::BlendStyle afxBillboard_BlendStyle; @@ -117,7 +116,7 @@ public: void _renderBillboard(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*); DECLARE_CONOBJECT(afxBillboard); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxCameraPuppet.h b/Engine/source/afx/ce/afxCameraPuppet.h index 4226e1242..da9f4eb7a 100644 --- a/Engine/source/afx/ce/afxCameraPuppet.h +++ b/Engine/source/afx/ce/afxCameraPuppet.h @@ -55,7 +55,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxCameraPuppetData); - DECLARE_CATEGORY("AFX"); }; diff --git a/Engine/source/afx/ce/afxCameraShake.h b/Engine/source/afx/ce/afxCameraShake.h index ca0bfb439..32d4393ca 100644 --- a/Engine/source/afx/ce/afxCameraShake.h +++ b/Engine/source/afx/ce/afxCameraShake.h @@ -49,7 +49,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxCameraShakeData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxCollisionEvent.h b/Engine/source/afx/ce/afxCollisionEvent.h index 31f6e09a1..29cb7b5a6 100644 --- a/Engine/source/afx/ce/afxCollisionEvent.h +++ b/Engine/source/afx/ce/afxCollisionEvent.h @@ -51,7 +51,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxCollisionEventData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxConsoleMessage.h b/Engine/source/afx/ce/afxConsoleMessage.h index 224107181..e91705a00 100644 --- a/Engine/source/afx/ce/afxConsoleMessage.h +++ b/Engine/source/afx/ce/afxConsoleMessage.h @@ -46,7 +46,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxConsoleMessageData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxDamage.h b/Engine/source/afx/ce/afxDamage.h index 19b6e7943..40249ef6b 100644 --- a/Engine/source/afx/ce/afxDamage.h +++ b/Engine/source/afx/ce/afxDamage.h @@ -55,7 +55,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxDamageData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxFootSwitch.h b/Engine/source/afx/ce/afxFootSwitch.h index 6420756e9..c15f4299a 100644 --- a/Engine/source/afx/ce/afxFootSwitch.h +++ b/Engine/source/afx/ce/afxFootSwitch.h @@ -48,7 +48,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxFootSwitchData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxGuiController.h b/Engine/source/afx/ce/afxGuiController.h index 90db3249c..744ddb7f3 100644 --- a/Engine/source/afx/ce/afxGuiController.h +++ b/Engine/source/afx/ce/afxGuiController.h @@ -50,7 +50,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxGuiControllerData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxGuiText.h b/Engine/source/afx/ce/afxGuiText.h index fa03de46c..a8f06af9d 100644 --- a/Engine/source/afx/ce/afxGuiText.h +++ b/Engine/source/afx/ce/afxGuiText.h @@ -49,7 +49,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxGuiTextData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxLight.h b/Engine/source/afx/ce/afxLight.h index 11181fdc5..84e2bd1cd 100644 --- a/Engine/source/afx/ce/afxLight.h +++ b/Engine/source/afx/ce/afxLight.h @@ -30,7 +30,6 @@ struct afxLightData : public GameBaseData { typedef GameBaseData Parent; DECLARE_CONOBJECT(afxLightData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxLightBase_T3D.h b/Engine/source/afx/ce/afxLightBase_T3D.h index 1a517d02d..0913c8b10 100644 --- a/Engine/source/afx/ce/afxLightBase_T3D.h +++ b/Engine/source/afx/ce/afxLightBase_T3D.h @@ -65,7 +65,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxT3DLightBaseData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMachineGun.h b/Engine/source/afx/ce/afxMachineGun.h index f01941f55..7a8612a48 100644 --- a/Engine/source/afx/ce/afxMachineGun.h +++ b/Engine/source/afx/ce/afxMachineGun.h @@ -51,7 +51,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxMachineGunData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxModel.h b/Engine/source/afx/ce/afxModel.h index ad8cb4c99..ec972a439 100644 --- a/Engine/source/afx/ce/afxModel.h +++ b/Engine/source/afx/ce/afxModel.h @@ -98,7 +98,6 @@ public: void onSequenceChanged() {} DECLARE_CONOBJECT(afxModelData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -162,7 +161,7 @@ public: F32 getAnimClipDuration(const char* clip); DECLARE_CONOBJECT(afxModel); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMooring.h b/Engine/source/afx/ce/afxMooring.h index d6cfb0b77..266331b21 100644 --- a/Engine/source/afx/ce/afxMooring.h +++ b/Engine/source/afx/ce/afxMooring.h @@ -52,7 +52,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxMooringData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -94,7 +93,7 @@ public: virtual void prepRenderImage(SceneRenderState*); DECLARE_CONOBJECT(afxMooring); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMultiLight.h b/Engine/source/afx/ce/afxMultiLight.h index 9a2261909..f6bae942f 100644 --- a/Engine/source/afx/ce/afxMultiLight.h +++ b/Engine/source/afx/ce/afxMultiLight.h @@ -30,7 +30,6 @@ struct afxMultiLightData : public GameBaseData { typedef GameBaseData Parent; DECLARE_CONOBJECT(afxMultiLightData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxParticleEmitter.h b/Engine/source/afx/ce/afxParticleEmitter.h index a7053a12b..69fb79c91 100644 --- a/Engine/source/afx/ce/afxParticleEmitter.h +++ b/Engine/source/afx/ce/afxParticleEmitter.h @@ -67,7 +67,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticleEmitterData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -92,7 +91,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticleEmitterVectorData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -121,7 +119,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticleEmitterConeData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -165,7 +162,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticleEmitterPathData); - DECLARE_CATEGORY("AFX"); }; typedef afxParticleEmitterPathData::PathOriginType afxParticleEmitterPath_OriginType; @@ -197,7 +193,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticleEmitterDiscData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxPhraseEffect.h b/Engine/source/afx/ce/afxPhraseEffect.h index ad189d787..827ac9ca9 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.h +++ b/Engine/source/afx/ce/afxPhraseEffect.h @@ -103,7 +103,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxPhraseEffectData); - DECLARE_CATEGORY("AFX"); }; typedef afxPhraseEffectData::MatchType afxPhraseEffect_MatchType; diff --git a/Engine/source/afx/ce/afxPhysicalZone.h b/Engine/source/afx/ce/afxPhysicalZone.h index 379e25b12..02012c5a0 100644 --- a/Engine/source/afx/ce/afxPhysicalZone.h +++ b/Engine/source/afx/ce/afxPhysicalZone.h @@ -57,7 +57,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxPhysicalZoneData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxPlayerMovement.h b/Engine/source/afx/ce/afxPlayerMovement.h index 725f388e3..13920d85f 100644 --- a/Engine/source/afx/ce/afxPlayerMovement.h +++ b/Engine/source/afx/ce/afxPlayerMovement.h @@ -62,7 +62,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxPlayerMovementData); - DECLARE_CATEGORY("AFX"); }; typedef afxPlayerMovementData::OpType afxPlayerMovement_OpType; diff --git a/Engine/source/afx/ce/afxPlayerPuppet.h b/Engine/source/afx/ce/afxPlayerPuppet.h index ca6624bd9..d8d96727a 100644 --- a/Engine/source/afx/ce/afxPlayerPuppet.h +++ b/Engine/source/afx/ce/afxPlayerPuppet.h @@ -55,7 +55,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxPlayerPuppetData); - DECLARE_CATEGORY("AFX"); }; diff --git a/Engine/source/afx/ce/afxPointLight_T3D.h b/Engine/source/afx/ce/afxPointLight_T3D.h index 0f40ba199..de5215aa8 100644 --- a/Engine/source/afx/ce/afxPointLight_T3D.h +++ b/Engine/source/afx/ce/afxPointLight_T3D.h @@ -48,7 +48,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxT3DPointLightData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxProjectile.h b/Engine/source/afx/ce/afxProjectile.h index 74609a4d3..d3bbff312 100644 --- a/Engine/source/afx/ce/afxProjectile.h +++ b/Engine/source/afx/ce/afxProjectile.h @@ -72,7 +72,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxProjectileData); - DECLARE_CATEGORY("AFX"); }; typedef afxProjectileData::LaunchDirType afxProjectile_LaunchDirType; @@ -109,7 +108,7 @@ public: virtual void explode(const Point3F& p, const Point3F& n, const U32 collideType); DECLARE_CONOBJECT(afxProjectile); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxScriptEvent.h b/Engine/source/afx/ce/afxScriptEvent.h index 234e50cf3..39a32f79f 100644 --- a/Engine/source/afx/ce/afxScriptEvent.h +++ b/Engine/source/afx/ce/afxScriptEvent.h @@ -49,7 +49,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxScriptEventData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxSpotLight_T3D.h b/Engine/source/afx/ce/afxSpotLight_T3D.h index 077850784..9fc5a2f4e 100644 --- a/Engine/source/afx/ce/afxSpotLight_T3D.h +++ b/Engine/source/afx/ce/afxSpotLight_T3D.h @@ -50,7 +50,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxT3DSpotLightData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxStaticShape.h b/Engine/source/afx/ce/afxStaticShape.h index d58ce4a0a..fce34d053 100644 --- a/Engine/source/afx/ce/afxStaticShape.h +++ b/Engine/source/afx/ce/afxStaticShape.h @@ -54,7 +54,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxStaticShapeData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -90,7 +89,7 @@ public: void setVisibility(bool flag) { mIs_visible = flag; } DECLARE_CONOBJECT(afxStaticShape); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxVolumeLight.h b/Engine/source/afx/ce/afxVolumeLight.h index 9b56c4f27..c74ce7f95 100644 --- a/Engine/source/afx/ce/afxVolumeLight.h +++ b/Engine/source/afx/ce/afxVolumeLight.h @@ -30,7 +30,6 @@ struct afxVolumeLightData : public GameBaseData { typedef GameBaseData Parent; DECLARE_CONOBJECT(afxVolumeLightData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxZodiac.h b/Engine/source/afx/ce/afxZodiac.h index 917ee5490..0a5104f7b 100644 --- a/Engine/source/afx/ce/afxZodiac.h +++ b/Engine/source/afx/ce/afxZodiac.h @@ -124,7 +124,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxZodiacData); - DECLARE_CATEGORY("AFX"); }; typedef afxZodiacData::BlendType afxZodiac_BlendType; diff --git a/Engine/source/afx/ce/afxZodiacPlane.h b/Engine/source/afx/ce/afxZodiacPlane.h index 7b2d7aec2..bb2b6ed33 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.h +++ b/Engine/source/afx/ce/afxZodiacPlane.h @@ -96,7 +96,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxZodiacPlaneData); - DECLARE_CATEGORY("AFX"); }; typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType; @@ -142,7 +141,7 @@ public: void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*); DECLARE_CONOBJECT(afxZodiacPlane); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_TLKLight.cpp b/Engine/source/afx/ea/afxEA_TLKLight.cpp index 160558cd9..6d76f8ac0 100644 --- a/Engine/source/afx/ea/afxEA_TLKLight.cpp +++ b/Engine/source/afx/ea/afxEA_TLKLight.cpp @@ -34,7 +34,6 @@ struct sgLightObjectData : public GameBaseData { typedef GameBaseData Parent; DECLARE_CONOBJECT(sgLightObjectData); - DECLARE_CATEGORY("AFX"); }; IMPLEMENT_CO_DATABLOCK_V1(sgLightObjectData); @@ -76,4 +75,4 @@ bool afxEA_TLKLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxE return (timing.lifetime < 0); } -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_Zodiac.cpp b/Engine/source/afx/ea/afxEA_Zodiac.cpp index dcaa05ee4..c42a36837 100644 --- a/Engine/source/afx/ea/afxEA_Zodiac.cpp +++ b/Engine/source/afx/ea/afxEA_Zodiac.cpp @@ -77,7 +77,7 @@ public: static void initPersistFields(); //DECLARE_CONOBJECT(afxEA_Zodiac); - DECLARE_CATEGORY("AFX"); + DECLARE_CATEGORY("UNLISTED"); }; //IMPLEMENT_CONOBJECT(afxEA_Zodiac); diff --git a/Engine/source/afx/forces/afxF_Drag.cpp b/Engine/source/afx/forces/afxF_Drag.cpp index 2eab36584..91fc394ae 100644 --- a/Engine/source/afx/forces/afxF_Drag.cpp +++ b/Engine/source/afx/forces/afxF_Drag.cpp @@ -50,7 +50,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxF_DragData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxF_Gravity.cpp b/Engine/source/afx/forces/afxF_Gravity.cpp index b91665031..946a412de 100644 --- a/Engine/source/afx/forces/afxF_Gravity.cpp +++ b/Engine/source/afx/forces/afxF_Gravity.cpp @@ -48,7 +48,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxF_GravityData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxXM_Force.cpp b/Engine/source/afx/forces/afxXM_Force.cpp index 2b8ab6278..eaabd9332 100644 --- a/Engine/source/afx/forces/afxXM_Force.cpp +++ b/Engine/source/afx/forces/afxXM_Force.cpp @@ -64,7 +64,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_ForceData); - DECLARE_CATEGORY("AFX"); }; class afxXM_Force : public afxXM_WeightedBase, public afxEffectDefs diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.h b/Engine/source/afx/rpg/afxRPGMagicSpell.h index 832898547..17e6ac0b4 100644 --- a/Engine/source/afx/rpg/afxRPGMagicSpell.h +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.h @@ -97,7 +97,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxRPGMagicSpellData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxParticlePool.h b/Engine/source/afx/util/afxParticlePool.h index d09b0dcd7..e4cfd1408 100644 --- a/Engine/source/afx/util/afxParticlePool.h +++ b/Engine/source/afx/util/afxParticlePool.h @@ -55,7 +55,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxParticlePoolData); - DECLARE_CATEGORY("AFX"); }; typedef afxParticlePoolData::PoolType afxParticlePool_PoolType; @@ -135,7 +134,6 @@ public: void setSortPriority(S8 priority); DECLARE_CONOBJECT(afxParticlePool); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath.h b/Engine/source/afx/util/afxPath.h index 50ce218e8..dc931641c 100644 --- a/Engine/source/afx/util/afxPath.h +++ b/Engine/source/afx/util/afxPath.h @@ -94,7 +94,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxPathData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_Aim.cpp b/Engine/source/afx/xm/afxXM_Aim.cpp index fb0bac753..8256ebf0b 100644 --- a/Engine/source/afx/xm/afxXM_Aim.cpp +++ b/Engine/source/afx/xm/afxXM_Aim.cpp @@ -54,7 +54,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_AimData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp index ba9faf695..5c7228cad 100644 --- a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp +++ b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp @@ -53,7 +53,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_AltitudeConformData); - DECLARE_CATEGORY("AFX"); }; class afxXM_AltitudeConform : public afxXM_WeightedBase diff --git a/Engine/source/afx/xm/afxXM_BoxAdapt.cpp b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp index e5fd631e6..d033c144a 100644 --- a/Engine/source/afx/xm/afxXM_BoxAdapt.cpp +++ b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp @@ -52,7 +52,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_BoxAdaptData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_BoxConform.cpp b/Engine/source/afx/xm/afxXM_BoxConform.cpp index 10c99d8c3..130e4421c 100644 --- a/Engine/source/afx/xm/afxXM_BoxConform.cpp +++ b/Engine/source/afx/xm/afxXM_BoxConform.cpp @@ -53,7 +53,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_BoxConformData); - DECLARE_CATEGORY("AFX"); }; class afxXM_BoxConform : public afxXM_Base diff --git a/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp b/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp index 96fce645a..d7418ba52 100644 --- a/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp +++ b/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp @@ -55,7 +55,6 @@ public: #endif DECLARE_CONOBJECT(afxXM_BoxHeightOffsetData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_Freeze.cpp b/Engine/source/afx/xm/afxXM_Freeze.cpp index 901715ffa..c7872f94a 100644 --- a/Engine/source/afx/xm/afxXM_Freeze.cpp +++ b/Engine/source/afx/xm/afxXM_Freeze.cpp @@ -53,7 +53,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_FreezeData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_GroundConform.cpp b/Engine/source/afx/xm/afxXM_GroundConform.cpp index 088ca5224..79fe44253 100644 --- a/Engine/source/afx/xm/afxXM_GroundConform.cpp +++ b/Engine/source/afx/xm/afxXM_GroundConform.cpp @@ -55,7 +55,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_GroundConformData); - DECLARE_CATEGORY("AFX"); }; class afxXM_GroundConform : public afxXM_WeightedBase diff --git a/Engine/source/afx/xm/afxXM_HeightSampler.cpp b/Engine/source/afx/xm/afxXM_HeightSampler.cpp index 261bb5488..eec80c9e6 100644 --- a/Engine/source/afx/xm/afxXM_HeightSampler.cpp +++ b/Engine/source/afx/xm/afxXM_HeightSampler.cpp @@ -52,7 +52,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_HeightSamplerData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp index 115c76598..9ab4ea029 100644 --- a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp +++ b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp @@ -54,7 +54,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_MountedImageNodeData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_Offset.cpp b/Engine/source/afx/xm/afxXM_Offset.cpp index 745885709..2500c8d9d 100644 --- a/Engine/source/afx/xm/afxXM_Offset.cpp +++ b/Engine/source/afx/xm/afxXM_Offset.cpp @@ -59,7 +59,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_LocalOffsetData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// @@ -145,7 +144,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_WorldOffsetData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_Oscillate.cpp b/Engine/source/afx/xm/afxXM_Oscillate.cpp index 55d8dd7c2..7a4c89caf 100644 --- a/Engine/source/afx/xm/afxXM_Oscillate.cpp +++ b/Engine/source/afx/xm/afxXM_Oscillate.cpp @@ -61,7 +61,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_OscillateData); - DECLARE_CATEGORY("AFX"); }; class afxXM_Oscillate_rot : public afxXM_WeightedBase diff --git a/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp index fc91e5046..6897023e8 100644 --- a/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp +++ b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp @@ -48,7 +48,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_OscillateZodiacColorData); - DECLARE_CATEGORY("AFX"); }; class afxXM_OscillateZodiacColor : public afxXM_WeightedBase diff --git a/Engine/source/afx/xm/afxXM_PathConform.cpp b/Engine/source/afx/xm/afxXM_PathConform.cpp index d2a92e7fd..365f5af92 100644 --- a/Engine/source/afx/xm/afxXM_PathConform.cpp +++ b/Engine/source/afx/xm/afxXM_PathConform.cpp @@ -67,7 +67,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_PathConformData); - DECLARE_CATEGORY("AFX"); }; class afxPath3D; diff --git a/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp b/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp index 7204b1ce3..5a274f162 100644 --- a/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp +++ b/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp @@ -55,7 +55,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_PivotNodeOffsetData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_RandomRot.cpp b/Engine/source/afx/xm/afxXM_RandomRot.cpp index c8278293f..1580e5f16 100644 --- a/Engine/source/afx/xm/afxXM_RandomRot.cpp +++ b/Engine/source/afx/xm/afxXM_RandomRot.cpp @@ -60,7 +60,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_RandomRotData); - DECLARE_CATEGORY("AFX"); }; class afxXM_RandomRot : public afxXM_Base diff --git a/Engine/source/afx/xm/afxXM_Scale.cpp b/Engine/source/afx/xm/afxXM_Scale.cpp index 4444ec537..5d4b7e528 100644 --- a/Engine/source/afx/xm/afxXM_Scale.cpp +++ b/Engine/source/afx/xm/afxXM_Scale.cpp @@ -57,7 +57,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_ScaleData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_Shockwave.cpp b/Engine/source/afx/xm/afxXM_Shockwave.cpp index 13e0c7c10..b4152c583 100644 --- a/Engine/source/afx/xm/afxXM_Shockwave.cpp +++ b/Engine/source/afx/xm/afxXM_Shockwave.cpp @@ -58,7 +58,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_ShockwaveData); - DECLARE_CATEGORY("AFX"); }; class afxConstraint; diff --git a/Engine/source/afx/xm/afxXM_Spin.cpp b/Engine/source/afx/xm/afxXM_Spin.cpp index a76de1e53..f87b9d970 100644 --- a/Engine/source/afx/xm/afxXM_Spin.cpp +++ b/Engine/source/afx/xm/afxXM_Spin.cpp @@ -62,7 +62,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_SpinData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_VelocityOffset.cpp b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp index 3f4f75b4f..ca2ea29df 100644 --- a/Engine/source/afx/xm/afxXM_VelocityOffset.cpp +++ b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp @@ -60,7 +60,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_VelocityOffsetData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_WaveBase.h b/Engine/source/afx/xm/afxXM_WaveBase.h index 2feb3b71a..0931b937b 100644 --- a/Engine/source/afx/xm/afxXM_WaveBase.h +++ b/Engine/source/afx/xm/afxXM_WaveBase.h @@ -172,7 +172,6 @@ public: static afxXM_Waveform* getWaveform(U32 waveform_type); DECLARE_CONOBJECT(afxXM_WaveBaseData); - DECLARE_CATEGORY("AFX"); }; typedef afxXM_WaveBaseData::WaveFormType afxXM_WaveFormType; @@ -210,7 +209,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxXM_WaveRiderBaseData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_WaveColor.cpp b/Engine/source/afx/xm/afxXM_WaveColor.cpp index bc2df445f..3584ca011 100644 --- a/Engine/source/afx/xm/afxXM_WaveColor.cpp +++ b/Engine/source/afx/xm/afxXM_WaveColor.cpp @@ -181,7 +181,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_WaveColorData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -297,7 +296,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_WaveRiderColorData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_WaveScalar.cpp b/Engine/source/afx/xm/afxXM_WaveScalar.cpp index 211382a76..8bebc8f1b 100644 --- a/Engine/source/afx/xm/afxXM_WaveScalar.cpp +++ b/Engine/source/afx/xm/afxXM_WaveScalar.cpp @@ -596,7 +596,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_WaveScalarData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -723,7 +722,6 @@ public: afxXM_Base* create(afxEffectWrapper* fx, bool on_server); DECLARE_CONOBJECT(afxXM_WaveRiderScalarData); - DECLARE_CATEGORY("AFX"); }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXfmMod.h b/Engine/source/afx/xm/afxXfmMod.h index 7c7eaa41d..4a5e2911f 100644 --- a/Engine/source/afx/xm/afxXfmMod.h +++ b/Engine/source/afx/xm/afxXfmMod.h @@ -91,7 +91,6 @@ public: virtual afxXM_Base* create(afxEffectWrapper* fx, bool on_server) { return 0; } DECLARE_CONOBJECT(afxXM_BaseData); - DECLARE_CATEGORY("AFX"); }; class afxXM_Base : public afxXM_Defs @@ -147,7 +146,6 @@ public: static void initPersistFields(); DECLARE_CONOBJECT(afxXM_WeightedBaseData); - DECLARE_CATEGORY("AFX"); }; class afxXM_WeightedBase : public afxXM_Base diff --git a/Engine/source/assets/assetBase.h b/Engine/source/assets/assetBase.h index bffc8d7ba..ad6d4e95b 100644 --- a/Engine/source/assets/assetBase.h +++ b/Engine/source/assets/assetBase.h @@ -91,7 +91,7 @@ public: return mErrCodeStrings[errCode]; }; U32 getStatus() { return mLoadedState; }; - + U32 load() { return NotLoaded; }; AssetBase(); virtual ~AssetBase(); diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index 9d925d873..30efc47db 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -210,7 +210,7 @@ bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition dSprintf(extensionBuffer, sizeof(extensionBuffer), "*.%s", pDeclaredAssets->getExtension()); // Scan declared assets at location. - if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) ) + if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) && mEchoInfo) { // Warn. Con::warnf( "AssetManager::addModuleDeclaredAssets() - No assets found at location '%s' with extension '%s'.", filePathBuffer, pDeclaredAssets->getExtension() ); diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index bd3893ab0..cfd25d6cb 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -450,7 +450,7 @@ void ArrayObject::append(ArrayObject* obj) void ArrayObject::setKey( const String &key, S32 index ) { - if ( index >= mArray.size() ) + if (index >= mArray.size() || index < 0) return; mArray[index].key = key; @@ -460,7 +460,7 @@ void ArrayObject::setKey( const String &key, S32 index ) void ArrayObject::setValue( const String &value, S32 index ) { - if ( index >= mArray.size() ) + if (index >= mArray.size() || index < 0) return; mArray[index].value = value; @@ -600,6 +600,22 @@ DefineEngineMethod( ArrayObject, getIndexFromKey, S32, ( const char* key ),, return object->getIndexFromKey( key ); } +DefineEngineMethod(ArrayObject, getValueFromKey, const char*, (const char* key), , + "Search the array from the current position for the Key " + "@param value Array key to search for\n" + "@return Value of the first element found, or -1 if none\n") +{ + return object->getValueFromIndex(object->getIndexFromKey(key)).c_str(); +} + +DefineEngineMethod(ArrayObject, getKeyFromValue, const char*, (const char* key), , + "Search the array from the current position for the Value " + "@param value Array key to search for\n" + "@return Key of the first element found, or -1 if none\n") +{ + return object->getKeyFromIndex(object->getIndexFromValue(key)).c_str(); +} + DefineEngineMethod( ArrayObject, getValue, const char*, ( S32 index ),, "Get the value of the array element at the submitted index.\n" "@param index 0-based index of the array element to get\n" diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index 65bcf3ae9..095649cac 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -1202,7 +1202,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject * break; } - return std::move(result); + return result; } //----------------------------------------------------------------------------- diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 96ea82c2f..75928b542 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -831,11 +831,19 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( className ); - if( rep ) - return rep->getCategory(); - Con::errorf( "getCategoryOfClass - no class called '%s'", className ); - return ""; + if (rep == NULL) + { + Con::errorf("getCategoryOfClass - no class called '%s'", className); + return ""; + } + while (rep && rep->getParentClass()) + { + if (dStrcmp(rep->getCategory(), "") != 0) + break; + rep = rep->getParentClass(); + } + return rep ? rep->getCategory() : ""; } DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ), diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index b7dfb97f5..630dad448 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -1358,7 +1358,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj const AbstractClassRep::Field* f = &list[i]; // Skip the special field types. - if ( f->type >= AbstractClassRep::ARCFirstCustomField ) + if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) continue; for(U32 j = 0; S32(j) < f->elementCount; j++) diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index d81704d89..663ed79e1 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -436,7 +436,7 @@ SimObject *spawnObject(String spawnClass, String spawnDataBlock, String spawnNam // If we have a spawn script go ahead and execute it last if (spawnScript.isNotEmpty()) - Con::evaluate(spawnScript.c_str(), true); + Con::evaluate(spawnScript.c_str()); return spawnObject; } diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 6c01e4f00..c3a45c3be 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -40,6 +40,7 @@ #include "core/fileObject.h" #include "persistence/taml/tamlCustom.h" #include "gui/editor/guiInspector.h" +#include "console/script.h" #include "sim/netObject.h" @@ -90,7 +91,7 @@ SimObject::SimObject() mNameSpace = NULL; mNotifyList = NULL; mFlags.set( ModStaticFields | ModDynamicFields ); - + mPrototype = true; mProgenitorFile = StringTable->EmptyString(); mFieldDictionary = NULL; @@ -159,7 +160,8 @@ void SimObject::initPersistFields() addProtectedField("inheritFrom", TypeString, Offset(mInheritFrom, SimObject), &setInheritFrom, &defaultProtectedGetFn, "Optional Name of object to inherit from as a parent."); - + + addProtectedField("Prototype", TypeBool, Offset(mPrototype, SimObject), &_doPrototype, &defaultProtectedGetFn, "Prototype Methods", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors); endGroup( "Ungrouped" ); addGroup( "Object" ); @@ -212,6 +214,15 @@ void SimObject::initPersistFields() } //----------------------------------------------------------------------------- +bool SimObject::_doPrototype(void* object, const char* index, const char* data) +{ + if (!Con::isFunction("PrototypeClass")) return false; + if (dAtoi(data) != 1) return false; + SimObject* obj = reinterpret_cast(object); + String command = String("PrototypeClass(") + (obj->getName()? String(obj->getName()) : String::ToString(obj->getId())) + ");"; + Con::evaluate(command.c_str()); + return false; +} String SimObject::describeSelf() const { @@ -317,7 +328,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop) const AbstractClassRep::Field* f = &list[i]; // Skip the special field types. - if ( f->type >= AbstractClassRep::ARCFirstCustomField ) + if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) continue; for(U32 j = 0; S32(j) < f->elementCount; j++) @@ -913,7 +924,7 @@ void SimObject::assignFieldsFrom(SimObject *parent) continue; // Skip the special field types. - if ( f->type >= AbstractClassRep::ARCFirstCustomField ) + if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) continue; // Skip certain fields that we don't want to see copied so we don't @@ -2707,6 +2718,59 @@ DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (bool commands), (fal return dictionary; } + +DefineEngineFunction(getMethodSigsNS, ArrayObject*, (StringTableEntry className, bool commands), (false), + "List the methods defined on this object.\n\n" + "Each description is a newline-separated vector with the following elements:\n" + "- method prototype string.\n" + "- Documentation string (not including prototype). This takes up the remainder of the vector.\n" + "@return An ArrayObject populated with (name,description) pairs of all methods defined on the object.") +{ + + Namespace* ns = Con::lookupNamespace(className); + if (!ns) + return 0; + + ArrayObject* dictionary = new ArrayObject(); + dictionary->registerObject(); + + VectorPtr vec(__FILE__, __LINE__); + ns->getEntryList(&vec); + for (Vector< Namespace::Entry* >::iterator j = vec.begin(); j != vec.end(); j++) + { + Namespace::Entry* e = *j; + + if (commands) + { + if ((e->mType < Namespace::Entry::ConsoleFunctionType)) + continue; + } + else + { + if ((e->mType > Namespace::Entry::ScriptCallbackType)) + continue; + } + StringBuilder str; + str.append("function "); + str.append(ns->getName()); + str.append("::"); + str.append(e->getPrototypeSig()); + str.append('\n'); + str.append("{"); + String docs = e->getDocString(); + if (!docs.isEmpty()) + { + str.append("\n/*"); + str.append(docs); + str.append("\n*/"); + } + str.append('\n'); + str.append("}"); + dictionary->push_back(e->mFunctionName, str.end()); + } + + return dictionary; +} //----------------------------------------------------------------------------- namespace { @@ -3255,7 +3319,34 @@ DefineEngineMethod( SimObject, getFieldCount, S32, (),, f = &list[i]; // The special field types do not need to be counted. - if ( f->type >= AbstractClassRep::ARCFirstCustomField ) + if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) + numDummyEntries++; + } + + return list.size() - numDummyEntries; +} + +DefineEngineFunction(getFieldCountNS, S32, (StringTableEntry className), , + "Get the number of static fields on the name space.\n" + "@return The number of static fields defined on the object.") +{ + Namespace* ns = Con::lookupNamespace(className); + if (!ns) + return 0; + AbstractClassRep* rep = ns->mClassRep; + if (!rep) + return 0; + + const AbstractClassRep::FieldList& list = rep->mFieldList; + const AbstractClassRep::Field* f; + U32 numDummyEntries = 0; + + for (S32 i = 0; i < list.size(); i++) + { + f = &list[i]; + + // The special field types do not need to be counted. + if (f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) numDummyEntries++; } @@ -3280,7 +3371,7 @@ DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),, f = &list[i]; // The special field types can be skipped. - if ( f->type >= AbstractClassRep::ARCFirstCustomField ) + if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) continue; if(currentField == index) @@ -3293,6 +3384,42 @@ DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),, return ""; } +DefineEngineFunction(getFieldNS, const char*, (StringTableEntry className,S32 index), , + "Retrieve the value of a static field by index.\n" + "@param index The index of the static field.\n" + "@return The value of the static field with the given index or \"\".") +{ + Namespace* ns = Con::lookupNamespace(className); + if (!ns) + return 0; + AbstractClassRep* rep = ns->mClassRep; + if (!rep) + return 0; + + const AbstractClassRep::FieldList& list = rep->mFieldList; + if ((index < 0) || (index >= list.size())) + return ""; + + const AbstractClassRep::Field* f; + S32 currentField = 0; + for (U32 i = 0; i < list.size() && currentField <= index; i++) + { + f = &list[i]; + + // The special field types can be skipped. + if (f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) + continue; + + if (currentField == index) + return f->pFieldname; + + currentField++; + } + + // if we found nada, return nada. + return ""; +} + DefineEngineFunction(getClassHierarchy, const char*, (const char* name), , "Returns the inheritance hierarchy for a given class.") { diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 912f1b086..947302f0e 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -300,7 +300,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks SimObject* nextIdObject; StringTableEntry mInheritFrom; - + bool mPrototype; /// SimGroup we're contained in, if any. SimGroup* mGroup; @@ -388,7 +388,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks public: inline void setProgenitorFile(const char* pFile) { mProgenitorFile = StringTable->insert(pFile); } inline StringTableEntry getProgenitorFile(void) const { return mProgenitorFile; } - + static bool _doPrototype(void* object, const char* index, const char* data); protected: /// Taml callbacks. virtual void onTamlPreWrite(void) {} diff --git a/Engine/source/console/simSerialize.cpp b/Engine/source/console/simSerialize.cpp index 6a7a84b17..c87033265 100644 --- a/Engine/source/console/simSerialize.cpp +++ b/Engine/source/console/simSerialize.cpp @@ -48,7 +48,7 @@ bool SimObject::writeObject(Stream *stream) for(itr = fieldList.begin();itr != fieldList.end();itr++) { - if( itr->type >= AbstractClassRep::ARCFirstCustomField ) + if( itr->type >= AbstractClassRep::ARCFirstCustomField || itr->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) { numFields--; continue; diff --git a/Engine/source/console/torquescript/compiledEval.cpp b/Engine/source/console/torquescript/compiledEval.cpp index 257f85d0b..c87d22672 100644 --- a/Engine/source/console/torquescript/compiledEval.cpp +++ b/Engine/source/console/torquescript/compiledEval.cpp @@ -666,7 +666,7 @@ Con::EvalResult CodeBlock::exec(U32 ip, const char* functionName, Namespace* thi StringTableEntry fnNamespace, fnPackage; static const U32 objectCreationStackSize = 32; - U32 objectCreationStackIndex = 0; + S32 objectCreationStackIndex = 0; struct { SimObject* newObject; U32 failJump; diff --git a/Engine/source/console/torquescript/runtime.cpp b/Engine/source/console/torquescript/runtime.cpp index 1e13b4989..64d83e93a 100644 --- a/Engine/source/console/torquescript/runtime.cpp +++ b/Engine/source/console/torquescript/runtime.cpp @@ -1,4 +1,4 @@ -#include "runtime.h" +#include "runtime.h" #include "codeBlock.h" #include "console/script.h" @@ -386,13 +386,12 @@ namespace TorqueScript // We're all compiled, so let's run it. #ifdef TORQUE_DEBUG - Con::printf("Loading compiled script %s.", scriptFileName); + Con::printf("Loading compiled script %s.", nameBuffer); #endif - CodeBlock* code = new CodeBlock; + CodeBlock* code = new CodeBlock(); code->read(scriptFileName, *compiledStream); delete compiledStream; code->exec(0, scriptFileName, NULL, 0, NULL, noCalls, NULL, 0); - delete code; ret = true; } else if (scriptFile) diff --git a/Engine/source/environment/VolumetricFog.h b/Engine/source/environment/VolumetricFog.h index 83df0c184..c9206a5dc 100644 --- a/Engine/source/environment/VolumetricFog.h +++ b/Engine/source/environment/VolumetricFog.h @@ -253,6 +253,7 @@ class VolumetricFog : public SceneObject void onShapeChanged() {} DECLARE_CONOBJECT(VolumetricFog); + DECLARE_CATEGORY("Environment \t Weather"); DECLARE_CALLBACK(void, onEnterFog, (SimObjectId obj)); DECLARE_CALLBACK(void, onLeaveFog, (SimObjectId obj)); diff --git a/Engine/source/environment/VolumetricFogRTManager.h b/Engine/source/environment/VolumetricFogRTManager.h index 725f3b5db..d4b2bcbd4 100644 --- a/Engine/source/environment/VolumetricFogRTManager.h +++ b/Engine/source/environment/VolumetricFogRTManager.h @@ -83,8 +83,9 @@ class VolumetricFogRTManager : public SceneObject U32 DecFogObjects(); DECLARE_CONOBJECT(VolumetricFogRTManager); + DECLARE_CATEGORY("UNLISTED"); }; extern VolumetricFogRTManager* gVolumetricFogRTManager; -#endif \ No newline at end of file +#endif diff --git a/Engine/source/environment/basicClouds.h b/Engine/source/environment/basicClouds.h index a9f6f874e..2e7468de8 100644 --- a/Engine/source/environment/basicClouds.h +++ b/Engine/source/environment/basicClouds.h @@ -65,6 +65,7 @@ public: virtual ~BasicClouds() {} DECLARE_CONOBJECT( BasicClouds ); + DECLARE_CATEGORY("Environment \t Weather"); // ConsoleObject virtual bool onAdd(); diff --git a/Engine/source/environment/cloudLayer.h b/Engine/source/environment/cloudLayer.h index 8f7ffc667..3634dbfa8 100644 --- a/Engine/source/environment/cloudLayer.h +++ b/Engine/source/environment/cloudLayer.h @@ -68,6 +68,7 @@ public: virtual ~CloudLayer() {} DECLARE_CONOBJECT( CloudLayer ); + DECLARE_CATEGORY("Environment \t Weather"); // ConsoleObject virtual bool onAdd(); diff --git a/Engine/source/environment/decalRoad.h b/Engine/source/environment/decalRoad.h index 180b92d08..f7759b447 100644 --- a/Engine/source/environment/decalRoad.h +++ b/Engine/source/environment/decalRoad.h @@ -154,6 +154,7 @@ public: ~DecalRoad(); DECLARE_CONOBJECT(DecalRoad); + DECLARE_CATEGORY("Environment \t BackGround"); // ConsoleObject static void initPersistFields(); diff --git a/Engine/source/environment/meshRoad.h b/Engine/source/environment/meshRoad.h index 9fe7505b9..abc3074b0 100644 --- a/Engine/source/environment/meshRoad.h +++ b/Engine/source/environment/meshRoad.h @@ -509,6 +509,7 @@ public: ~MeshRoad(); DECLARE_CONOBJECT(MeshRoad); + DECLARE_CATEGORY("Environment \t BackGround"); // ConObject. static void initPersistFields(); diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 9869bf4a7..0d7bb727b 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -921,6 +921,13 @@ void ScatterSky::_initMoon() features.removeFeature(MFT_ReflectionProbes); features.addFeature(MFT_isBackground); mMoonMatInst = MATMGR->createMatInstance(mMoonMatAsset->getMaterialDefinitionName(), features, getGFXVertexFormat()); + + GFXStateBlockDesc desc; + desc.setBlend(true); + desc.setAlphaTest(true); + desc.setZReadWrite(true, false); + mMoonMatInst->addStateBlockDesc(desc); + mMoonMatInst->init(features, getGFXVertexFormat()); } } diff --git a/Engine/source/environment/scatterSky.h b/Engine/source/environment/scatterSky.h index e544e64a5..7f71183bb 100644 --- a/Engine/source/environment/scatterSky.h +++ b/Engine/source/environment/scatterSky.h @@ -85,6 +85,7 @@ public: // ConsoleObject DECLARE_CONOBJECT(ScatterSky); + DECLARE_CATEGORY("Environment \t Background"); void inspectPostApply(); static void initPersistFields(); diff --git a/Engine/source/environment/skyBox.h b/Engine/source/environment/skyBox.h index 7f2ebe494..0daddb8a7 100644 --- a/Engine/source/environment/skyBox.h +++ b/Engine/source/environment/skyBox.h @@ -75,6 +75,7 @@ public: virtual ~SkyBox(); DECLARE_CONOBJECT( SkyBox ); + DECLARE_CATEGORY("Environment \t Background"); // SimObject void onStaticModified( const char *slotName, const char *newValue ); @@ -129,4 +130,4 @@ protected: BaseMatInstance* _getMaterialInstance(); }; -#endif // _SKYBOX_H_ \ No newline at end of file +#endif // _SKYBOX_H_ diff --git a/Engine/source/environment/skySphere.cpp b/Engine/source/environment/skySphere.cpp index 2b755722d..7f8cf6618 100644 --- a/Engine/source/environment/skySphere.cpp +++ b/Engine/source/environment/skySphere.cpp @@ -183,7 +183,7 @@ void SkySphere::prepRenderImage(SceneRenderState* state) ObjectRenderInst* ri = state->getRenderPass()->allocInst(); ri->renderDelegate.bind(this, &SkySphere::_renderObject); ri->type = RenderPassManager::RIT_Sky; - ri->defaultKey = 9; + ri->defaultKey = 10; ri->defaultKey2 = 0; state->getRenderPass()->addInst(ri); } @@ -196,10 +196,7 @@ void SkySphere::_renderObject(ObjectRenderInst* ri, SceneRenderState* state, Bas GFX->setVertexBuffer(mVB); MatrixF worldMat = MatrixF::Identity; - worldMat.setPosition(Point3F( - state->getCameraPosition().x, - state->getCameraPosition().y, - state->getCameraPosition().z)); + worldMat.setPosition(state->getCameraPosition()); SceneData sgData; sgData.init(state); @@ -602,7 +599,7 @@ void SkySphere::_initMaterial() desc.setCullMode(GFXCullNone); desc.setBlend(true); desc.setZReadWrite(true, false); - desc.zFunc = GFXCmpLessEqual; + desc.zFunc = GFXCmpGreaterEqual; mMatInstance->addStateBlockDesc(desc); // Also disable lighting on the skysphere material by default. diff --git a/Engine/source/environment/skySphere.h b/Engine/source/environment/skySphere.h index b68ef07ce..9c50b9bfc 100644 --- a/Engine/source/environment/skySphere.h +++ b/Engine/source/environment/skySphere.h @@ -66,6 +66,7 @@ public: virtual ~SkySphere(); DECLARE_CONOBJECT(SkySphere); + DECLARE_CATEGORY("Environment \t Background"); // SimObject void onStaticModified(const char* slotName, const char* newValue); diff --git a/Engine/source/environment/sun.cpp b/Engine/source/environment/sun.cpp index 4237a34f7..615337a1f 100644 --- a/Engine/source/environment/sun.cpp +++ b/Engine/source/environment/sun.cpp @@ -41,6 +41,7 @@ #include "materials/baseMatInstance.h" #include "materials/sceneData.h" #include "math/util/matrixSet.h" +#include "materials/materialFeatureTypes.h" IMPLEMENT_CO_NETOBJECT_V1(Sun); @@ -61,7 +62,7 @@ Sun::Sun() mTypeMask = EnvironmentObjectType | LightObjectType | StaticObjectType; mLightColor.set(0.7f, 0.7f, 0.7f); - mLightAmbient.set(0.3f, 0.3f, 0.3f); + mLightAmbient.set(1.0f, 1.0f, 1.0f); mBrightness = 1.0f; mSunAzimuth = 0.0f; mSunElevation = 35.0f; @@ -454,7 +455,21 @@ void Sun::_initCorona() if (mCoronaMaterialAsset.notNull()) { - mCoronaMatInst = MATMGR->createMatInstance(mCoronaMaterialAsset->getMaterialDefinitionName(), MATMGR->getDefaultFeatures(), getGFXVertexFormat()); + FeatureSet features = MATMGR->getDefaultFeatures(); + features.removeFeature(MFT_RTLighting); + features.removeFeature(MFT_Visibility); + features.removeFeature(MFT_ReflectionProbes); + features.addFeature(MFT_isBackground); + features.addFeature(MFT_VertLit); + + mCoronaMatInst = MATMGR->createMatInstance(mCoronaMaterialAsset->getMaterialDefinitionName(), features, getGFXVertexFormat()); + + GFXStateBlockDesc desc; + desc.setBlend(true); + desc.setAlphaTest(true); + desc.setZReadWrite(true, false); + mCoronaMatInst->addStateBlockDesc(desc); + mCoronaMatInst->init(features, getGFXVertexFormat()); } } diff --git a/Engine/source/environment/sun.h b/Engine/source/environment/sun.h index f9d1674f8..b87611a25 100644 --- a/Engine/source/environment/sun.h +++ b/Engine/source/environment/sun.h @@ -116,7 +116,8 @@ public: virtual void onRemove(); // ConsoleObject - DECLARE_CONOBJECT(Sun); + DECLARE_CONOBJECT(Sun); + DECLARE_CATEGORY("Lighting \t Lights"); static void initPersistFields(); void inspectPostApply(); diff --git a/Engine/source/environment/timeOfDay.h b/Engine/source/environment/timeOfDay.h index 53aa9563d..94a48f14a 100644 --- a/Engine/source/environment/timeOfDay.h +++ b/Engine/source/environment/timeOfDay.h @@ -76,6 +76,7 @@ public: static void initPersistFields(); static void consoleInit(); DECLARE_CONOBJECT( TimeOfDay ); + DECLARE_CATEGORY("Environment \t Weather"); void inspectPostApply(); // SimObject @@ -209,4 +210,4 @@ protected: }; -#endif // _TIMEOFDAY_H_ \ No newline at end of file +#endif // _TIMEOFDAY_H_ diff --git a/Engine/source/environment/waterObject.h b/Engine/source/environment/waterObject.h index 7c6bb7df2..4bdfbe021 100644 --- a/Engine/source/environment/waterObject.h +++ b/Engine/source/environment/waterObject.h @@ -149,6 +149,7 @@ public: virtual ~WaterObject(); DECLARE_CONOBJECT( WaterObject ); + DECLARE_CATEGORY("Environment \t Water"); // ConsoleObject static void consoleInit(); diff --git a/Engine/source/forest/forest.h b/Engine/source/forest/forest.h index 42f026976..7fed73f4d 100644 --- a/Engine/source/forest/forest.h +++ b/Engine/source/forest/forest.h @@ -147,6 +147,7 @@ public: virtual ~Forest(); DECLARE_CONOBJECT(Forest); + DECLARE_CATEGORY("Environment \t BackGround"); static void consoleInit(); static void initPersistFields(); diff --git a/Engine/source/forest/forestWindEmitter.h b/Engine/source/forest/forestWindEmitter.h index baf30d07f..9c3c51859 100644 --- a/Engine/source/forest/forestWindEmitter.h +++ b/Engine/source/forest/forestWindEmitter.h @@ -214,6 +214,7 @@ public: // ConObject. static void initPersistFields(); DECLARE_CONOBJECT(ForestWindEmitter); + DECLARE_CATEGORY("Environment \t Weather"); }; -#endif // _FORESTWINDEMITTER_H_ \ No newline at end of file +#endif // _FORESTWINDEMITTER_H_ diff --git a/Engine/source/gfx/gl/gfxGLShader.cpp b/Engine/source/gfx/gl/gfxGLShader.cpp index 8595a96d4..c8366ed56 100644 --- a/Engine/source/gfx/gl/gfxGLShader.cpp +++ b/Engine/source/gfx/gl/gfxGLShader.cpp @@ -1109,9 +1109,12 @@ bool GFXGLShader::initShader( const Torque::Path &file, return false; } - if ( !_loadShaderFromStream( activeShader, file, &stream, macros ) ) + if (!_loadShaderFromStream(activeShader, file, &stream, macros)) + { + if (smLogErrors) + Con::errorf("GFXGLShader::initShader - unable to load shader from stream: '%s'.", file.getFullPath().c_str()); return false; - + } GLint compile; glGetShaderiv(activeShader, GL_COMPILE_STATUS, &compile); @@ -1119,17 +1122,13 @@ bool GFXGLShader::initShader( const Torque::Path &file, U32 logLength = 0; glGetShaderiv(activeShader, GL_INFO_LOG_LENGTH, (GLint*)&logLength); - GLint compileStatus = GL_TRUE; if ( logLength ) { FrameAllocatorMarker fam; char* log = (char*)fam.alloc(logLength); glGetShaderInfoLog(activeShader, logLength, NULL, log); - // Always print errors - glGetShaderiv( activeShader, GL_COMPILE_STATUS, &compileStatus ); - - if ( compileStatus == GL_FALSE ) + if (compile == GL_FALSE ) { if ( smLogErrors ) { @@ -1141,7 +1140,7 @@ bool GFXGLShader::initShader( const Torque::Path &file, Con::warnf( "Program %s: %s", file.getFullPath().c_str(), log ); } - return compileStatus != GL_FALSE; + return compile != GL_FALSE; } /// Returns our list of shader constants, the material can get this and just set the constants it knows about diff --git a/Engine/source/gfx/video/theoraTexture.cpp b/Engine/source/gfx/video/theoraTexture.cpp index 1b85837b7..e69958d80 100644 --- a/Engine/source/gfx/video/theoraTexture.cpp +++ b/Engine/source/gfx/video/theoraTexture.cpp @@ -59,7 +59,7 @@ /// Profile for the video texture. GFX_ImplementTextureProfile( GFXTheoraTextureProfile, GFXTextureProfile::DiffuseMap, - GFXTextureProfile::NoMipmap | GFXTextureProfile::Dynamic, + GFXTextureProfile::NoMipmap | GFXTextureProfile::Dynamic | GFXTextureProfile::PreserveSize, GFXTextureProfile::NONE ); diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp index ca51045ad..e2ef9d344 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp @@ -318,10 +318,14 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) mTextures[i].mTextureNormalAsset = mTextures[i].mTextureNormalAssetId; } - if (mTextures[i].mTextureNormalAsset.notNull() && mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok) + if (mTextures[i].mTextureNormalAsset.notNull()) { - mTextures[i].mTextureNormal = GFXTexHandle(mTextures[i].mTextureNormalAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); - break; + mTextures[i].mTextureNormalAsset->load(); + if (mTextures[i].mTextureNormalAsset->getStatus() == AssetBase::Ok) + { + mTextures[i].mTextureNormal = GFXTexHandle(mTextures[i].mTextureNormalAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); + break; + } } } } @@ -336,10 +340,14 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) mTextures[i].mTextureHilightAsset = mTextures[i].mTextureHilightAssetId; } - if (mTextures[i].mTextureHilightAsset.notNull() && mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok) + if (mTextures[i].mTextureHilightAsset.notNull()) { - mTextures[i].mTextureHilight = GFXTexHandle(mTextures[i].mTextureHilightAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__)); - break; + mTextures[i].mTextureHilightAsset->load(); + if (mTextures[i].mTextureHilightAsset->getStatus() == AssetBase::Ok) + { + mTextures[i].mTextureHilight = GFXTexHandle(mTextures[i].mTextureHilightAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); + break; + } } } @@ -356,10 +364,14 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) mTextures[i].mTextureDepressedAsset = mTextures[i].mTextureDepressedAssetId; } - if (mTextures[i].mTextureDepressedAsset.notNull() && mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok) + if (mTextures[i].mTextureDepressedAsset.notNull()) { - mTextures[i].mTextureDepressed = GFXTexHandle(mTextures[i].mTextureDepressedAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); - break; + mTextures[i].mTextureDepressedAsset->load(); + if (mTextures[i].mTextureDepressedAsset->getStatus() == AssetBase::Ok) + { + mTextures[i].mTextureDepressed = GFXTexHandle(mTextures[i].mTextureDepressedAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); + break; + } } } @@ -376,10 +388,14 @@ void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) mTextures[i].mTextureInactiveAsset = mTextures[i].mTextureInactiveAssetId; } - if (mTextures[i].mTextureInactiveAsset.notNull() && mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok) + if (mTextures[i].mTextureInactiveAsset.notNull()) { - mTextures[i].mTextureInactive = GFXTexHandle(mTextures[i].mTextureInactiveAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__)); - break; + mTextures[i].mTextureInactiveAsset->load(); + if (mTextures[i].mTextureInactiveAsset->getStatus() == AssetBase::Ok) + { + mTextures[i].mTextureInactive = GFXTexHandle(mTextures[i].mTextureInactiveAsset->getImagePath(), &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); + break; + } } } diff --git a/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp b/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp index e5efe0279..2a545ffe1 100644 --- a/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp +++ b/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp @@ -31,14 +31,14 @@ #include "sfx/sfxTrack.h" -IMPLEMENT_CONOBJECT( GuiButtonBaseCtrl ); +IMPLEMENT_CONOBJECT(GuiButtonBaseCtrl); -ConsoleDocClass( GuiButtonBaseCtrl, +ConsoleDocClass(GuiButtonBaseCtrl, "@brief The base class for the various button controls.\n\n" - + "This is the base class for the various types of button controls. If no more specific functionality is required than " "offered by this class, then it can be instantiated and used directly. Otherwise, its subclasses should be used:\n" - + "- GuiRadioCtrl (radio buttons)\n" "- GuiCheckBoxCtrl (checkboxes)\n" "- GuiButtonCtrl (push buttons with text labels)\n" @@ -47,49 +47,54 @@ ConsoleDocClass( GuiButtonBaseCtrl, "- GuiToggleButtonCtrl (toggle buttons, i.e. push buttons with \"sticky\" behavior)\n" "- GuiSwatchButtonCtrl (color swatch buttons)\n" "- GuiBorderButtonCtrl (push buttons for surrounding child controls)\n\n" - + "@ingroup GuiButtons" ); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseDown, void, (), (), +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onMouseDown, void, (), (), "If #useMouseEvents is true, this is called when the left mouse button is pressed on an (active) " - "button." ); + "button."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseUp, void, (), (), +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onMouseUp, void, (), (), "If #useMouseEvents is true, this is called when the left mouse button is release over an (active) " "button.\n\n" "@note To trigger actions, better use onClick() since onMouseUp() will also be called when the mouse was " - "not originally pressed on the button." ); + "not originally pressed on the button."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onClick, void, (), (), - "Called when the primary action of the button is triggered (e.g. by a left mouse click)." ); +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onClick, void, (), (), + "Called when the primary action of the button is triggered (e.g. by a left mouse click)."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onDoubleClick, void, (), (), - "Called when the left mouse button is double-clicked on the button." ); +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onDoubleClick, void, (), (), + "Called when the left mouse button is double-clicked on the button."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onRightClick, void, (), (), - "Called when the right mouse button is clicked on the button." ); +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onRightClick, void, (), (), + "Called when the right mouse button is clicked on the button."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseEnter, void, (), (), +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onMouseEnter, void, (), (), "If #useMouseEvents is true, this is called when the mouse cursor moves over the button (only if the button " - "is the front-most visible control, though)." ); + "is the front-most visible control, though)."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseLeave, void, (), (), +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onMouseLeave, void, (), (), "If #useMouseEvents is true, this is called when the mouse cursor moves off the button (only if the button " - "had previously received an onMouseEvent() event)." ); + "had previously received an onMouseEvent() event)."); -IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseDragged, void, (), (), +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onMouseDragged, void, (), (), "If #useMouseEvents is true, this is called when a left mouse button drag is detected, i.e. when the user " "pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with " - "the mouse button still pressed." ); + "the mouse button still pressed."); + +IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onHighlighted, void, (bool highlighted), (highlighted), + "This is called when the highlighted state of the button is changed."); -ImplementEnumType( GuiButtonType, +ImplementEnumType(GuiButtonType, "Type of button control.\n\n" - "@ingroup GuiButtons" ) - { GuiButtonBaseCtrl::ButtonTypePush, "PushButton", "A button that triggers an action when clicked." }, - { GuiButtonBaseCtrl::ButtonTypeCheck, "ToggleButton", "A button that is toggled between on and off state." }, - { GuiButtonBaseCtrl::ButtonTypeRadio, "RadioButton", "A button placed in groups for presenting choices." }, + "@ingroup GuiButtons") +{ + GuiButtonBaseCtrl::ButtonTypePush, "PushButton", "A button that triggers an action when clicked." +}, +{ GuiButtonBaseCtrl::ButtonTypeCheck, "ToggleButton", "A button that is toggled between on and off state." }, +{ GuiButtonBaseCtrl::ButtonTypeRadio, "RadioButton", "A button placed in groups for presenting choices." }, EndImplementEnumType; @@ -100,7 +105,7 @@ GuiButtonBaseCtrl::GuiButtonBaseCtrl() mDepressed = false; mHighlighted = false; mActive = true; - static StringTableEntry sButton = StringTable->insert( "Button" ); + static StringTableEntry sButton = StringTable->insert("Button"); mButtonText = sButton; mButtonTextID = StringTable->EmptyString(); mStateOn = false; @@ -115,27 +120,27 @@ GuiButtonBaseCtrl::GuiButtonBaseCtrl() void GuiButtonBaseCtrl::initPersistFields() { docsURL; - addGroup( "Button" ); - - addField( "text", TypeCaseString, Offset(mButtonText, GuiButtonBaseCtrl), - "Text label to display on button (if button class supports text labels)." ); - addField( "textID", TypeString, Offset(mButtonTextID, GuiButtonBaseCtrl), - "ID of string in string table to use for text label on button.\n\n" - "@see setTextID\n" - "@see GuiControl::langTableMod\n" - "@see LangTable\n\n" ); - addField( "groupNum", TypeS32, Offset(mRadioGroup, GuiButtonBaseCtrl), - "Radio button toggle group number. All radio buttons that are assigned the same #groupNum and that " - "are parented to the same control will synchronize their toggle state, i.e. if one radio button is toggled on " - "all other radio buttons in its group will be toggled off.\n\n" - "The default group is -1." ); - addField( "buttonType", TYPEID< ButtonType >(), Offset(mButtonType, GuiButtonBaseCtrl), - "Button behavior type.\n" ); - addField( "useMouseEvents", TypeBool, Offset(mUseMouseEvents, GuiButtonBaseCtrl), - "If true, mouse events will be passed on to script. Default is false.\n" ); - - endGroup( "Button" ); - + addGroup("Button"); + + addField("text", TypeCaseString, Offset(mButtonText, GuiButtonBaseCtrl), + "Text label to display on button (if button class supports text labels)."); + addField("textID", TypeString, Offset(mButtonTextID, GuiButtonBaseCtrl), + "ID of string in string table to use for text label on button.\n\n" + "@see setTextID\n" + "@see GuiControl::langTableMod\n" + "@see LangTable\n\n"); + addField("groupNum", TypeS32, Offset(mRadioGroup, GuiButtonBaseCtrl), + "Radio button toggle group number. All radio buttons that are assigned the same #groupNum and that " + "are parented to the same control will synchronize their toggle state, i.e. if one radio button is toggled on " + "all other radio buttons in its group will be toggled off.\n\n" + "The default group is -1."); + addField("buttonType", TYPEID< ButtonType >(), Offset(mButtonType, GuiButtonBaseCtrl), + "Button behavior type.\n"); + addField("useMouseEvents", TypeBool, Offset(mUseMouseEvents, GuiButtonBaseCtrl), + "If true, mouse events will be passed on to script. Default is false.\n"); + + endGroup("Button"); + Parent::initPersistFields(); } @@ -143,70 +148,70 @@ void GuiButtonBaseCtrl::initPersistFields() bool GuiButtonBaseCtrl::onWake() { - if(!Parent::onWake()) + if (!Parent::onWake()) return false; // is we have a script variable, make sure we're in sync - if ( mConsoleVariable[0] ) - mStateOn = Con::getBoolVariable( mConsoleVariable ); - if(mButtonTextID && *mButtonTextID != 0) - setTextID(mButtonTextID); + if (mConsoleVariable[0]) + mStateOn = Con::getBoolVariable(mConsoleVariable); + if (mButtonTextID && *mButtonTextID != 0) + setTextID(mButtonTextID); return true; } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::setText( const char* text ) +void GuiButtonBaseCtrl::setText(const char* text) { mButtonText = StringTable->insert(text, true); } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::setTextID(const char *id) +void GuiButtonBaseCtrl::setTextID(const char* id) { - S32 n = Con::getIntVariable(id, -1); - if(n != -1) - { - mButtonTextID = StringTable->insert(id); - setTextID(n); - } + S32 n = Con::getIntVariable(id, -1); + if (n != -1) + { + mButtonTextID = StringTable->insert(id); + setTextID(n); + } } //----------------------------------------------------------------------------- void GuiButtonBaseCtrl::setTextID(S32 id) { - const UTF8 *str = getGUIString(id); - if(str) - setText((const char*)str); - //mButtonTextID = id; + const UTF8* str = getGUIString(id); + if (str) + setText((const char*)str); + //mButtonTextID = id; } //----------------------------------------------------------------------------- -const char *GuiButtonBaseCtrl::getText() +const char* GuiButtonBaseCtrl::getText() { return mButtonText; } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::setStateOn( bool bStateOn ) +void GuiButtonBaseCtrl::setStateOn(bool bStateOn) { - if(!mActive) + if (!mActive) return; - if(mButtonType == ButtonTypeCheck) + if (mButtonType == ButtonTypeCheck) { mStateOn = bStateOn; } - else if(mButtonType == ButtonTypeRadio) + else if (mButtonType == ButtonTypeRadio) { messageSiblings(mRadioGroup); mStateOn = bStateOn; - } + } setUpdate(); } @@ -214,7 +219,7 @@ void GuiButtonBaseCtrl::setStateOn( bool bStateOn ) void GuiButtonBaseCtrl::acceleratorKeyPress(U32) { - if( !mActive ) + if (!mActive) return; //set the bool @@ -228,7 +233,7 @@ void GuiButtonBaseCtrl::acceleratorKeyPress(U32) void GuiButtonBaseCtrl::acceleratorKeyRelease(U32) { - if (! mActive) + if (!mActive) return; if (mDepressed) @@ -245,9 +250,9 @@ void GuiButtonBaseCtrl::acceleratorKeyRelease(U32) //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMouseDown(const GuiEvent &event) +void GuiButtonBaseCtrl::onMouseDown(const GuiEvent& event) { - if (! mActive) + if (!mActive) return; if (mProfile->mCanKeyFocus) @@ -255,19 +260,19 @@ void GuiButtonBaseCtrl::onMouseDown(const GuiEvent &event) if (mProfile->isSoundButtonDownValid()) SFX->playOnce(mProfile->getSoundButtonDownProfile()); - + mMouseDownPoint = event.mousePoint; mMouseDragged = false; - if( mUseMouseEvents ) - onMouseDown_callback(); + if (mUseMouseEvents) + onMouseDown_callback(); //lock the mouse mouseLock(); mDepressed = true; // If we have a double click then execute the alt command. - if ( event.mouseClickCount == 2 ) + if (event.mouseClickCount == 2) { onDoubleClick_callback(); execAltConsoleCallback(); @@ -279,17 +284,18 @@ void GuiButtonBaseCtrl::onMouseDown(const GuiEvent &event) //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event) +void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent& event) { setUpdate(); - if( mUseMouseEvents ) + if (mUseMouseEvents) onMouseEnter_callback(); - if(isMouseLocked()) + if (isMouseLocked()) { mDepressed = true; mHighlighted = true; + onHighlighted_callback(mHighlighted); } else { @@ -297,38 +303,42 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event) SFX->playOnce(mProfile->getSoundButtonOverProfile()); mHighlighted = true; + messageSiblings(mRadioGroup); + onHighlighted_callback(mHighlighted); } } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &) +void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent&) { setUpdate(); - if( mUseMouseEvents ) + if (mUseMouseEvents) onMouseLeave_callback(); - if( isMouseLocked() ) + if (isMouseLocked()) mDepressed = false; mHighlighted = false; + onHighlighted_callback(mHighlighted); + messageSiblings(mRadioGroup); } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMouseUp(const GuiEvent &event) +void GuiButtonBaseCtrl::onMouseUp(const GuiEvent& event) { mouseUnlock(); - if( !mActive ) + if (!mActive) return; - + setUpdate(); - if( mUseMouseEvents ) + if (mUseMouseEvents) onMouseUp_callback(); //if we released the mouse within this control, perform the action - if( mDepressed ) + if (mDepressed) onAction(); mDepressed = false; @@ -337,38 +347,38 @@ void GuiButtonBaseCtrl::onMouseUp(const GuiEvent &event) //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onRightMouseUp(const GuiEvent &event) +void GuiButtonBaseCtrl::onRightMouseUp(const GuiEvent& event) { onRightClick_callback(); - Parent::onRightMouseUp( event ); + Parent::onRightMouseUp(event); } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMouseDragged( const GuiEvent& event ) +void GuiButtonBaseCtrl::onMouseDragged(const GuiEvent& event) { - if( mUseMouseEvents ) + if (mUseMouseEvents) { // If we haven't started a drag yet, find whether we have moved past // the tolerance value. - - if( !mMouseDragged ) + + if (!mMouseDragged) { Point2I delta = mMouseDownPoint - event.mousePoint; - if( mAbs( delta.x ) > 2 || mAbs( delta.y ) > 2 ) + if (mAbs(delta.x) > 2 || mAbs(delta.y) > 2) mMouseDragged = true; } - - if( mMouseDragged ) + + if (mMouseDragged) onMouseDragged_callback(); } - - Parent::onMouseDragged( event ); + + Parent::onMouseDragged(event); } //----------------------------------------------------------------------------- -bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent &event) +bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent& event) { //if the control is a dead end, kill the event if (!mActive) @@ -376,7 +386,7 @@ bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent &event) //see if the key down is a return or space or not if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE) - && event.modifier == 0) + && event.modifier == 0) { if (mProfile->isSoundButtonDownValid()) SFX->playOnce(mProfile->getSoundButtonDownProfile()); @@ -389,7 +399,7 @@ bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent &event) //----------------------------------------------------------------------------- -bool GuiButtonBaseCtrl::onKeyUp(const GuiEvent &event) +bool GuiButtonBaseCtrl::onKeyUp(const GuiEvent& event) { //if the control is a dead end, kill the event if (!mActive) @@ -410,64 +420,83 @@ bool GuiButtonBaseCtrl::onKeyUp(const GuiEvent &event) //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::setScriptValue(const char *value) +void GuiButtonBaseCtrl::setScriptValue(const char* value) { - mStateOn = dAtob(value); + mStateOn = dAtob(value); - // Update the console variable: - if ( mConsoleVariable[0] ) - Con::setBoolVariable( mConsoleVariable, mStateOn ); + // Update the console variable: + if (mConsoleVariable[0]) + Con::setBoolVariable(mConsoleVariable, mStateOn); setUpdate(); } //----------------------------------------------------------------------------- -const char *GuiButtonBaseCtrl::getScriptValue() +const char* GuiButtonBaseCtrl::getScriptValue() { - return mStateOn ? "1" : "0"; + return mStateOn ? "1" : "0"; } //----------------------------------------------------------------------------- void GuiButtonBaseCtrl::onAction() { - if(!mActive) - return; + if (!mActive) + return; - if(mButtonType == ButtonTypeCheck) - { - mStateOn = mStateOn ? false : true; + if (mButtonType == ButtonTypeCheck) + { + mStateOn = mStateOn ? false : true; } - else if(mButtonType == ButtonTypeRadio) - { - mStateOn = true; - messageSiblings(mRadioGroup); - } - setUpdate(); + else if (mButtonType == ButtonTypeRadio) + { + mStateOn = true; + messageSiblings(mRadioGroup); + } + setUpdate(); // Update the console variable: - if ( mConsoleVariable[0] ) - Con::setBoolVariable( mConsoleVariable, mStateOn ); + if (mConsoleVariable[0]) + Con::setBoolVariable(mConsoleVariable, mStateOn); - onClick_callback(); - Parent::onAction(); + onClick_callback(); + Parent::onAction(); } //----------------------------------------------------------------------------- -void GuiButtonBaseCtrl::onMessage( GuiControl *sender, S32 msg ) +void GuiButtonBaseCtrl::onMessage(GuiControl* sender, S32 msg) { - Parent::onMessage(sender, msg); - if( mRadioGroup == msg && mButtonType == ButtonTypeRadio ) - { - setUpdate(); - mStateOn = ( sender == this ); + Parent::onMessage(sender, msg); + if (mRadioGroup == msg) + { + if (mButtonType == ButtonTypeRadio) + { + setUpdate(); + mStateOn = (sender == this); - // Update the console variable: - if ( mConsoleVariable[0] ) - Con::setBoolVariable( mConsoleVariable, mStateOn ); - } + // Update the console variable: + if (mConsoleVariable[0]) + Con::setBoolVariable(mConsoleVariable, mStateOn); + } + else if (mButtonType == ButtonTypePush) + { + mHighlighted = (sender == this); + onHighlighted_callback(mHighlighted); + } + } +} + +void GuiButtonBaseCtrl::setHighlighted(bool highlighted) +{ + mHighlighted = highlighted; + onHighlighted_callback(mHighlighted); + + if (mRadioGroup != -1) + { + messageSiblings(mRadioGroup); + } } //============================================================================= @@ -477,69 +506,69 @@ void GuiButtonBaseCtrl::onMessage( GuiControl *sender, S32 msg ) //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, performClick, void, (),, +DefineEngineMethod(GuiButtonBaseCtrl, performClick, void, (), , "Simulate a click on the button.\n" "This method will trigger the button's action just as if the button had been pressed by the " - "user.\n\n" ) + "user.\n\n") { object->onAction(); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, setText, void, ( const char* text ),, +DefineEngineMethod(GuiButtonBaseCtrl, setText, void, (const char* text), , "Set the text displayed on the button's label.\n" "@param text The text to display as the button's text label.\n" "@note Not all buttons render text labels.\n\n" "@see getText\n" - "@see setTextID\n" ) + "@see setTextID\n") { - object->setText( text ); + object->setText(text); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, setTextID, void, ( const char* id ),, +DefineEngineMethod(GuiButtonBaseCtrl, setTextID, void, (const char* id), , "Set the text displayed on the button's label using a string from the string table " "assigned to the control.\n\n" "@param id Name of the variable that contains the integer string ID. Used to look up " - "string in table.\n\n" + "string in table.\n\n" "@note Not all buttons render text labels.\n\n" "@see setText\n" "@see getText\n" "@see GuiControl::langTableMod\n" "@see LangTable\n\n" - "@ref Gui_i18n" ) + "@ref Gui_i18n") { - object->setTextID( id ); + object->setTextID(id); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, getText, const char*, (),, +DefineEngineMethod(GuiButtonBaseCtrl, getText, const char*, (), , "Get the text display on the button's label (if any).\n\n" - "@return The button's label." ) + "@return The button's label.") { - return object->getText( ); + return object->getText(); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, setStateOn, void, ( bool isOn ), ( true ), +DefineEngineMethod(GuiButtonBaseCtrl, setStateOn, void, (bool isOn), (true), "For toggle or radio buttons, set whether the button is currently activated or not. For radio buttons, " "toggling a button on will toggle all other radio buttons in its group to off.\n\n" "@param isOn If true, the button will be toggled on (if not already); if false, it will be toggled off.\n\n" "@note Toggling the state of a button with this method will not not trigger the action associated with the " - "button. To do that, use performClick()." ) + "button. To do that, use performClick().") { - object->setStateOn( isOn ); + object->setStateOn(isOn); } //----------------------------------------------------------------------------- -DefineEngineMethod( GuiButtonBaseCtrl, resetState, void, (),, +DefineEngineMethod(GuiButtonBaseCtrl, resetState, void, (), , "Reset the mousing state of the button.\n\n" - "This method should not generally be called." ) + "This method should not generally be called.") { object->resetState(); } @@ -551,7 +580,7 @@ DefineEngineMethod(GuiButtonBaseCtrl, setHighlighted, void, (bool highlighted), object->setHighlighted(highlighted); } -DefineEngineMethod(GuiButtonBaseCtrl, isHighlighted, bool, (),, +DefineEngineMethod(GuiButtonBaseCtrl, isHighlighted, bool, (), , "Reset the mousing state of the button.\n\n" "This method should not generally be called.") { diff --git a/Engine/source/gui/buttons/guiButtonBaseCtrl.h b/Engine/source/gui/buttons/guiButtonBaseCtrl.h index 60f76ea4a..f6f5dddc7 100644 --- a/Engine/source/gui/buttons/guiButtonBaseCtrl.h +++ b/Engine/source/gui/buttons/guiButtonBaseCtrl.h @@ -24,7 +24,7 @@ #define _GUIBUTTONBASECTRL_H_ #ifndef _GUICONTROL_H_ - #include "gui/core/guiControl.h" +#include "gui/core/guiControl.h" #endif @@ -33,98 +33,99 @@ /// class GuiButtonBaseCtrl : public GuiControl { - public: - - typedef GuiControl Parent; +public: - enum ButtonType - { - ButtonTypePush, - ButtonTypeCheck, - ButtonTypeRadio, - }; + typedef GuiControl Parent; - protected: - - StringTableEntry mButtonText; - StringTableEntry mButtonTextID; - bool mDepressed; - bool mHighlighted; - bool mStateOn; - S32 mButtonType; - S32 mRadioGroup; - bool mUseMouseEvents; - - /// Point where left mouse button was pressed down. Used to find when to start - /// a mouse drag. - Point2I mMouseDownPoint; - - /// - bool mMouseDragged; - - /// @name Callbacks - /// @{ + enum ButtonType + { + ButtonTypePush, + ButtonTypeCheck, + ButtonTypeRadio, + }; - DECLARE_CALLBACK( void, onMouseDown, () ); - DECLARE_CALLBACK( void, onMouseUp, () ); - DECLARE_CALLBACK( void, onClick, () ); - DECLARE_CALLBACK( void, onRightClick, () ); - DECLARE_CALLBACK( void, onDoubleClick, () ); - DECLARE_CALLBACK( void, onMouseEnter, () ); - DECLARE_CALLBACK( void, onMouseLeave, () ); - DECLARE_CALLBACK( void, onMouseDragged, () ); +protected: - /// @} + StringTableEntry mButtonText; + StringTableEntry mButtonTextID; + bool mDepressed; + bool mHighlighted; + bool mStateOn; + S32 mButtonType; + S32 mRadioGroup; + bool mUseMouseEvents; - public: + /// Point where left mouse button was pressed down. Used to find when to start + /// a mouse drag. + Point2I mMouseDownPoint; - GuiButtonBaseCtrl(); - bool onWake(); + /// + bool mMouseDragged; - DECLARE_CONOBJECT( GuiButtonBaseCtrl ); - DECLARE_CATEGORY( "Gui Buttons" ); - DECLARE_DESCRIPTION( "A basic button control." ); - - static void initPersistFields(); + /// @name Callbacks + /// @{ - void setText(const char *text); - void setTextID(S32 id); - void setTextID(const char *id); - const char *getText(); - void setStateOn( bool bStateOn ); - bool getStateOn() const { return mStateOn; } + DECLARE_CALLBACK(void, onMouseDown, ()); + DECLARE_CALLBACK(void, onMouseUp, ()); + DECLARE_CALLBACK(void, onClick, ()); + DECLARE_CALLBACK(void, onRightClick, ()); + DECLARE_CALLBACK(void, onDoubleClick, ()); + DECLARE_CALLBACK(void, onMouseEnter, ()); + DECLARE_CALLBACK(void, onMouseLeave, ()); + DECLARE_CALLBACK(void, onMouseDragged, ()); + DECLARE_CALLBACK(void, onHighlighted, (bool)); - void setDepressed( bool depressed ) { mDepressed = depressed; } - void resetState() {mDepressed = false; mHighlighted = false;} + /// @} - void setHighlighted(bool highlighted) { mHighlighted = highlighted; } - bool isHighlighted() { return mHighlighted; } +public: - void acceleratorKeyPress(U32 index); - void acceleratorKeyRelease(U32 index); + GuiButtonBaseCtrl(); + bool onWake(); - void onMouseDown(const GuiEvent &); - void onMouseUp(const GuiEvent &); - void onMouseDragged( const GuiEvent& event ); - void onRightMouseUp(const GuiEvent &); + DECLARE_CONOBJECT(GuiButtonBaseCtrl); + DECLARE_CATEGORY("Gui Buttons"); + DECLARE_DESCRIPTION("A basic button control."); - void onMouseEnter(const GuiEvent &); - void onMouseLeave(const GuiEvent &); + static void initPersistFields(); - bool onKeyDown(const GuiEvent &event); - bool onKeyUp(const GuiEvent &event); + void setText(const char* text); + void setTextID(S32 id); + void setTextID(const char* id); + const char* getText(); + void setStateOn(bool bStateOn); + bool getStateOn() const { return mStateOn; } - void setScriptValue(const char *value); - const char *getScriptValue(); + void setDepressed(bool depressed) { mDepressed = depressed; } + void resetState() { mDepressed = false; mHighlighted = false; } - void onMessage(GuiControl *,S32 msg); - void onAction(); - - bool usesMouseEvents() const { return mUseMouseEvents; } - void setUseMouseEvents( bool val ) { mUseMouseEvents = val; } + void setHighlighted(bool highlighted); + bool isHighlighted() { return mHighlighted; } + + void acceleratorKeyPress(U32 index); + void acceleratorKeyRelease(U32 index); + + void onMouseDown(const GuiEvent&); + void onMouseUp(const GuiEvent&); + void onMouseDragged(const GuiEvent& event); + void onRightMouseUp(const GuiEvent&); + + void onMouseEnter(const GuiEvent&); + void onMouseLeave(const GuiEvent&); + + bool onKeyDown(const GuiEvent& event); + bool onKeyUp(const GuiEvent& event); + + void setScriptValue(const char* value); + const char* getScriptValue(); + + void onMessage(GuiControl*, S32 msg); + void onAction(); + + bool usesMouseEvents() const { return mUseMouseEvents; } + void setUseMouseEvents(bool val) { mUseMouseEvents = val; } }; typedef GuiButtonBaseCtrl::ButtonType GuiButtonType; -DefineEnumType( GuiButtonType ); +DefineEnumType(GuiButtonType); #endif diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index 8196d59b0..b9288ec7e 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -253,7 +253,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) if (mProfile->mBorder != 0) renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness); else - GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor); + GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor); } } else if(mHighlighted && mActive) @@ -269,7 +269,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) if (mProfile->mBorder != 0) renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness); else - GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor); + GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor); } } else @@ -388,6 +388,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin; } + drawer->setBitmapModulation(fontColor); drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors ); } @@ -395,6 +396,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) { Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 ); + drawer->setBitmapModulation(fontColor); drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors ); } @@ -408,6 +410,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) } else start.set( ( getWidth() - textWidth ) / 2, ( getHeight() - mProfile->mFont->getHeight() ) / 2 ); + drawer->setBitmapModulation( fontColor ); drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors ); } diff --git a/Engine/source/gui/containers/guiTabBookCtrl.cpp b/Engine/source/gui/containers/guiTabBookCtrl.cpp index 3a9c9c608..a9810654e 100644 --- a/Engine/source/gui/containers/guiTabBookCtrl.cpp +++ b/Engine/source/gui/containers/guiTabBookCtrl.cpp @@ -58,6 +58,10 @@ IMPLEMENT_CALLBACK( GuiTabBookCtrl, onTabSelected, void, ( const String& text, U "Called when a new tab page is selected.\n\n" "@param text Text of the page header for the tab that is being selected.\n" "@param index Index of the tab page being selected." ); +IMPLEMENT_CALLBACK(GuiTabBookCtrl, onTabUnSelected, void, (const String& text, U32 index), (text, index), + "Called when a new tab page is unselected.\n\n" + "@param text Text of the page header for the tab that is being unselected.\n" + "@param index Index of the tab page being unselected."); IMPLEMENT_CALLBACK( GuiTabBookCtrl, onTabRightClick, void, ( const String& text, U32 index ), ( text, index ), "Called when the user right-clicks on a tab page header.\n\n" "@param text Text of the page header for the tab that is being selected.\n" @@ -849,7 +853,10 @@ void GuiTabBookCtrl::selectPage( GuiTabPageCtrl *page ) onTabSelected_callback( tab->getText(), index ); } else - tab->setVisible( false ); + { + tab->setVisible(false); + onTabUnSelected_callback(tab->getText(), index); + } } setUpdateLayout( updateSelf ); } diff --git a/Engine/source/gui/containers/guiTabBookCtrl.h b/Engine/source/gui/containers/guiTabBookCtrl.h index 21b8c05da..38ae2c69d 100644 --- a/Engine/source/gui/containers/guiTabBookCtrl.h +++ b/Engine/source/gui/containers/guiTabBookCtrl.h @@ -116,6 +116,7 @@ class GuiTabBookCtrl : public GuiContainer /// @{ DECLARE_CALLBACK( void, onTabSelected, ( const String& text, U32 index ) ); + DECLARE_CALLBACK(void, onTabUnSelected, (const String& text, U32 index)); DECLARE_CALLBACK( void, onTabRightClick, ( const String& text, U32 index ) ); /// @} diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 2da707a60..875557a85 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -79,7 +79,7 @@ GuiWindowCtrl::GuiWindowCtrl() mResizeEdge(edgeNone), mResizeHeight(true), mCanMove(true), - mResizeMargin(2.f), + mResizeMargin(5.f), mCanClose(true), mCanMinimize(true), mCanMaximize(true), @@ -143,6 +143,8 @@ void GuiWindowCtrl::initPersistFields() "Whether the window can be resized horizontally." ); addField( "resizeHeight", TypeBool, Offset( mResizeHeight, GuiWindowCtrl ), "Whether the window can be resized vertically." ); + addField("resizeMargin", TypeF32, Offset(mResizeMargin, GuiWindowCtrl), + "Margin along the window edge to allow grabbing."); addField( "canMove", TypeBool, Offset( mCanMove, GuiWindowCtrl ), "Whether the window can be moved by dragging its titlebar." ); addField( "canClose", TypeBool, Offset( mCanClose, GuiWindowCtrl ), @@ -1490,7 +1492,7 @@ const RectI GuiWindowCtrl::getClientRect() // Finally, inset it by padding // Inset by padding. margin is specified for all t/b/l/r but // uses only pointx pointy uniformly on both ends. This should be fixed. - JDD - // winRect.inset( mSizingOptions.mPadding.point.x, mSizingOptions.mPadding.point.y ); + winRect.inset(mResizeMargin, mResizeMargin); return winRect; } diff --git a/Engine/source/gui/controls/guiBitmapCtrl.cpp b/Engine/source/gui/controls/guiBitmapCtrl.cpp index 0c34280e0..18be526f1 100644 --- a/Engine/source/gui/controls/guiBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiBitmapCtrl.cpp @@ -81,7 +81,9 @@ void GuiBitmapCtrl::initPersistFields() docsURL; addGroup( "Bitmap" ); - INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiBitmapCtrl, The bitmap file to display in the control); + addField("Bitmap", TypeImageFilename, Offset(mBitmapName, GuiBitmapCtrl), assetDoc(Bitmap, docs), AbstractClassRep::FIELD_HideInInspectors); + addField("BitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiBitmapCtrl), assetDoc(Bitmap, asset docs.)); + addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl),"color mul"); addField( "wrap", TypeBool, Offset( mWrap, GuiBitmapCtrl ), "If true, the bitmap is tiled inside the control rather than stretched to fit." ); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index cacbc21c6..ddfcb4d5b 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -157,7 +157,7 @@ bool GuiPopupTextListCtrlEx::hasCategories() { for( S32 i = 0; i < mList.size(); i++) { - if( mList[i].id == -1) + if( mList[i].id < 0) return true; } @@ -202,7 +202,7 @@ void GuiPopupTextListCtrlEx::onMouseUp(const GuiEvent &event) if (cell.x >= 0 && cell.x < mSize.x && cell.y >= 0 && cell.y < mSize.y) { - if (mList[cell.y].id == -1) + if (mList[cell.y].id < 0) return; } @@ -266,7 +266,7 @@ void GuiPopupTextListCtrlEx::onRenderCell(Point2I offset, Point2I cell, bool sel } // Render 'Group' background - if ( mList[cell.y].id == -1) + if ( mList[cell.y].id == -2) { RectI cellR( offset.x, offset.y, size.x, size.y ); GFX->getDrawUtil()->drawRectFill( cellR, mProfile->mFillColorHL ); @@ -298,7 +298,7 @@ void GuiPopupTextListCtrlEx::onRenderCell(Point2I offset, Point2I cell, bool sel } else { - if ((mList[cell.y].id == -1) || (!hasCategories())) + if ((mList[cell.y].id == -2) || (!hasCategories())) GFX->getDrawUtil()->drawText( mFont, Point2I( textXOffset, offset.y ), mList[cell.y].text ); // Used mTextOffset as a margin for the text list rather than the hard coded value of '4'. else GFX->getDrawUtil()->drawText( mFont, Point2I( textXOffset + 8, offset.y ), mList[cell.y].text ); // Used mTextOffset as a margin for the text list rather than the hard coded value of '4'. @@ -339,6 +339,8 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void) mTl = NULL; mSc = NULL; mReplaceText = false; + mTextSearchItems = false; + mSearchEdit = nullptr; } //------------------------------------------------------------------------------ @@ -361,6 +363,8 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void) addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx), "Whether to provide a 'onHotTrackItem' callback when a list item is hovered over"); + addField("allowTextSearch", TypeBool, Offset(mTextSearchItems, GuiPopUpMenuCtrlEx), "If true, will enable a text edit field so you can search filter the dropdown list"); + Parent::initPersistFields(); } @@ -395,7 +399,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addCategory, void, (const char* text),, "@param text Name of the new category\n\n") { - object->addEntry(text, -1, 0); + object->addEntry(text, -2, 0); } DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL),, @@ -671,6 +675,14 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), , object->replaceText(boolVal); } +//------------------------------------------------------------------------------ +DefineEngineMethod(GuiPopUpMenuCtrlEx, setSearchText, void, (const char* searchText), (""), + "@brief Flag that causes each new text addition to replace the current entry\n\n" + "@param True to turn on replacing, false to disable it") +{ + object->setSearchText(searchText); +} + //------------------------------------------------------------------------------ // Added bool GuiPopUpMenuCtrlEx::onWake() @@ -690,6 +702,12 @@ bool GuiPopUpMenuCtrlEx::onWake() return true; } +void GuiPopUpMenuCtrlEx::onRemove() +{ + removeChildren(); + + Parent::onRemove(); +} //------------------------------------------------------------------------------ bool GuiPopUpMenuCtrlEx::onAdd() { @@ -697,6 +715,9 @@ bool GuiPopUpMenuCtrlEx::onAdd() return false; mSelIndex = -1; mReplaceText = true; + + addChildren(); + return true; } @@ -921,7 +942,7 @@ void GuiPopUpMenuCtrlEx::addScheme( U32 id, ColorI fontColor, ColorI fontColorHL //------------------------------------------------------------------------------ S32 GuiPopUpMenuCtrlEx::getSelected() { - if (mSelIndex == -1) + if (mSelIndex < 0) return 0; return mEntries[mSelIndex].id; } @@ -982,7 +1003,7 @@ void GuiPopUpMenuCtrlEx::setSelected(S32 id, bool bNotifyScript ) if ( isMethod( "onCancel" ) && bNotifyScript ) Con::executef( this, "onCancel" ); - if ( id == -1 ) + if ( id < 0 ) return; // Execute the popup console command: @@ -1306,8 +1327,16 @@ void GuiPopUpMenuCtrlEx::closePopUp() if ( mSelIndex != -1 ) { if ( mReplaceText ) - setText( mEntries[mSelIndex].buf ); - setIntVariable( mEntries[mSelIndex].id ); + setText(mTl->mList[mSelIndex].text); + + for(U32 i=0; i < mEntries.size(); i++) + { + if(dStrcmp(mEntries[i].buf,mTl->mList[mSelIndex].text) == 0) + { + setIntVariable(mEntries[i].id); + break; + } + } } // Release the mouse: @@ -1357,10 +1386,12 @@ void GuiPopUpMenuCtrlEx::closePopUp() root->popDialogControl(mBackground); // Kill the popup: - mBackground->removeObject( mSc ); - mTl->deleteObject(); - mSc->deleteObject(); - mBackground->deleteObject(); + //mBackground->removeObject( mSc ); + //mTl->deleteObject(); + //mSc->deleteObject(); + //mBackground->deleteObject(); + + //mSearchEdit->deleteObject(); // Set this as the first responder: setFirstResponder(); @@ -1392,8 +1423,6 @@ void GuiPopUpMenuCtrlEx::onAction() GuiControl *canCtrl = getParent(); - addChildren(); - GuiCanvas *root = getRoot(); Point2I windowExt = root->getExtent(); @@ -1424,9 +1453,21 @@ void GuiPopUpMenuCtrlEx::onAction() //mTl->setCellSize(Point2I(width, mFont->getHeight()+3)); mTl->setCellSize(Point2I(width, mProfile->mFont->getHeight() + textSpace)); // Modified the above line to use textSpace rather than the '3' as this is what is used below. + mTl->clear(); - for ( U32 j = 0; j < mEntries.size(); ++j ) - mTl->addEntry( mEntries[j].id, mEntries[j].buf ); + for (U32 j = 0; j < mEntries.size(); ++j) + { + if(mSearchText != String::EmptyString) + { + String entryText = String::ToLower(mEntries[j].buf); + if (entryText.find(mSearchText) != -1 && mEntries[j].id != -2) + mTl->addEntry(mEntries[j].id, mEntries[j].buf); + } + else + { + mTl->addEntry(mEntries[j].id, mEntries[j].buf); + } + } if ( mSelIndex >= 0 ) mTl->setSelectedCell( Point2I( 0, mSelIndex ) ); @@ -1507,13 +1548,6 @@ void GuiPopUpMenuCtrlEx::onAction() newBounds.extent.set( width, maxYdis ); mSc->setBounds( newBounds ); // Not sure why the '-1' above. - mSc->registerObject(); - mTl->registerObject(); - mBackground->registerObject(); - - mSc->addObject( mTl ); - mBackground->addObject( mSc ); - mBackgroundCancel = false; // Setup check if user clicked on the background instead of the text list (ie: didn't want to change their current selection). root->pushDialogControl( mBackground, 99 ); @@ -1536,6 +1570,22 @@ void GuiPopUpMenuCtrlEx::onAction() mTl->setFirstResponder(); mInAction = true; + + if(mTextSearchItems) + { + mSearchEdit->resize(pointInGC, Point2I(getExtent().x - 20, getExtent().y)); + + mSearchEdit->setFirstResponder(); + + mSearchEdit->setText(mSearchText.c_str()); + + // + char searchCommandBuffer[512]; + dSprintf(searchCommandBuffer, sizeof(searchCommandBuffer), "%s.setSearchText(%s.getText());", + getIdString(), mSearchEdit->getIdString()); + + mSearchEdit->setConsoleCommand(searchCommandBuffer); + } } //------------------------------------------------------------------------------ @@ -1566,6 +1616,31 @@ void GuiPopUpMenuCtrlEx::addChildren() mBackground = new GuiPopUpBackgroundCtrlEx( this, mTl ); AssertFatal( mBackground, "Failed to create the GuiBackgroundCtrlEx for the PopUpMenu" ); + + mSearchEdit = new GuiTextEditCtrl; + AssertFatal(mSearchEdit, "Failed to create the GuiTextEditCtrl for the PopUpMenu"); + GuiControlProfile* searchEditProf; + if (Sim::findObject("ToolsGuiTextEditCtrl", searchEditProf)) + { + mSearchEdit->setControlProfile(prof); + } + + mSc->registerObject(); + mTl->registerObject(); + mBackground->registerObject(); + mSearchEdit->registerObject(); + + mSc->addObject(mTl); + mBackground->addObject(mSc); + mBackground->addObject(mSearchEdit); +} + +void GuiPopUpMenuCtrlEx::removeChildren() +{ + mTl->deleteObject(); + mSc->deleteObject(); + mSearchEdit->deleteObject(); + mBackground->deleteObject(); } //------------------------------------------------------------------------------ @@ -1621,7 +1696,7 @@ bool GuiPopUpMenuCtrlEx::getFontColor( ColorI &fontColor, S32 id, bool selected, } } - if(id == -1) + if(id < 0) fontColor = mProfile->mFontColorHL; else // Default color scheme... diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.h b/Engine/source/gui/controls/guiPopUpCtrlEx.h index d3018819e..503d91690 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.h +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.h @@ -35,6 +35,7 @@ #ifndef _GUISCROLLCTRL_H_ #include "gui/containers/guiScrollCtrl.h" #endif +#include "guiTextEditCtrl.h" class GuiPopUpMenuCtrlEx; class GuiPopupTextListCtrlEx; @@ -118,6 +119,8 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl bool mRenderScrollInNA; // Added bool mReverseTextList; // Added - Should we reverse the text list if we display up? bool mHotTrackItems; + bool mTextSearchItems; + String mSearchText; enum BitmapModes { @@ -134,7 +137,10 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl S32 mIdMax; + GuiTextEditCtrl* mSearchEdit; // Added + virtual void addChildren(); + virtual void removeChildren(); virtual void repositionPopup(); static bool _setBitmaps(void* obj, const char* index, const char* data); @@ -143,9 +149,10 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl GuiPopUpMenuCtrlEx(void); ~GuiPopUpMenuCtrlEx(); GuiScrollCtrl::Region mScrollDir; - bool onWake(); // Added - bool onAdd(); - void onSleep(); + virtual bool onWake(); // Added + virtual void onRemove(); + virtual bool onAdd(); + virtual void onSleep(); void setBitmap(const char *name); // Added void sort(); void sortID(); // Added @@ -176,6 +183,8 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl S32 findText( const char* text ); S32 getNumEntries() { return( mEntries.size() ); } void replaceText(S32); + + void setSearchText(String searchTxt) { mSearchText = String::ToLower(searchTxt); onAction(); } DECLARE_CONOBJECT(GuiPopUpMenuCtrlEx); DECLARE_CATEGORY( "Gui Lists" ); diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index 37102adf2..6a888485d 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -218,7 +218,8 @@ GuiControl::GuiControl() : mAddGroup( NULL ), mLangTable(NULL), mFirstResponder(NULL), mHorizSizing(horizResizeRight), - mVertSizing(vertResizeBottom) + mVertSizing(vertResizeBottom), + mCategory(StringTable->EmptyString()) { mConsoleVariable = StringTable->EmptyString(); mAcceleratorKey = StringTable->EmptyString(); @@ -294,6 +295,10 @@ void GuiControl::initPersistFields() addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl), "Key combination that triggers the control's primary action when the control is on the canvas." ); + addField("category", TypeString, Offset(mCategory, GuiControl), + "Name of the category this gui control should be grouped into for organizational purposes. Primarily for tooling."); + + endGroup( "Control" ); addGroup( "ToolTip" ); @@ -2942,3 +2947,19 @@ DefineEngineMethod( GuiControl, getAspect, F32, (),, const Point2I &ext = object->getExtent(); return (F32)ext.x / (F32)ext.y; } + +//----------------------------------------------------------------------------- + +DefineEngineMethod(GuiControl, execCommand, const char*, (), , + "Forcefully executes the command field value(if any) on this guiControl.\n" + "@return The results of the evaluation of the command.") +{ + return object->execConsoleCallback(); +} + +DefineEngineMethod(GuiControl, execAltCommand, const char*, (), , + "Forcefully executes the altCommand field value(if any) on this guiControl.\n" + "@return The results of the evaluation of the altCommand.") +{ + return object->execAltConsoleCallback(); +} diff --git a/Engine/source/gui/core/guiControl.h b/Engine/source/gui/core/guiControl.h index e0b3c0a76..fdd987468 100644 --- a/Engine/source/gui/core/guiControl.h +++ b/Engine/source/gui/core/guiControl.h @@ -218,6 +218,8 @@ class GuiControl : public SimGroup String mAltConsoleCommand; String mTooltip; + + StringTableEntry mCategory; /// @} diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 8da27c273..49d693523 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -40,6 +40,7 @@ #include "gui/editor/editorFunctions.h" #include "math/mEase.h" #include "math/mathTypes.h" +#include "sim/actionMap.h" //----------------------------------------------------------------------------- @@ -60,7 +61,7 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl() GuiPopUpMenuCtrl *menu = dynamic_cast(retCtrl); // Let's make it look pretty. - retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" ); + retCtrl->setDataField( StringTable->insert("profile"), NULL, "ToolsGuiPopupMenuProfile" ); _registerEditControl( retCtrl ); // Configure it to update our value when the popup is closed @@ -387,6 +388,44 @@ void GuiInspectorTypeGuiProfile::consoleInit() ConsoleBaseType::getType( TYPEID< GuiControlProfile >() )->setInspectorFieldType("GuiInspectorTypeGuiProfile"); } +//----------------------------------------------------------------------------- +// GuiInspectorTypeActionMap +//----------------------------------------------------------------------------- +IMPLEMENT_CONOBJECT(GuiInspectorTypeActionMap); + +ConsoleDocClass(GuiInspectorTypeActionMap, + "@brief Inspector field type for ActionMap\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeActionMap::_populateMenu(GuiPopUpMenuCtrl* menu) +{ + // Add the action maps to the menu. + //First add a blank entry so you can clear the action map + menu->addEntry("", 0); + + SimGroup* grp = Sim::getRootGroup(); + SimSetIterator iter(grp); + for (; *iter; ++iter) + { + ActionMap* actionMap = dynamic_cast(*iter); + if (!actionMap) + continue; + + menu->addEntry(actionMap->getName(), actionMap->getId()); + } + + menu->sort(); +} + +void GuiInspectorTypeActionMap::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TYPEID< ActionMap >())->setInspectorFieldType("GuiInspectorTypeActionMap"); +} + //----------------------------------------------------------------------------- // GuiInspectorTypeCheckBox //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/editor/guiInspectorTypes.h b/Engine/source/gui/editor/guiInspectorTypes.h index 31b21a186..d5cb90f93 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.h +++ b/Engine/source/gui/editor/guiInspectorTypes.h @@ -186,6 +186,20 @@ public: virtual void _populateMenu( GuiPopUpMenuCtrl *menu ); }; +//----------------------------------------------------------------------------- +// GuiInspectorTypeActionMap Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeActionMap : public GuiInspectorTypeMenuBase +{ +private: + typedef GuiInspectorTypeMenuBase Parent; +public: + DECLARE_CONOBJECT(GuiInspectorTypeActionMap); + static void consoleInit(); + + virtual void _populateMenu(GuiPopUpMenuCtrl* menu); +}; + //----------------------------------------------------------------------------- // GuiInspectorTypeCheckBox Class //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index 2c7367cd1..0be2ed9a2 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -143,945 +143,6 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char "@see GuiTickCtrl\n\n" ); -//------------------------------------------------------------------------------ -// console methods -//------------------------------------------------------------------------------ - -/*DefineEngineMethod( GuiMenuBar, clearMenus, void, (),, - "@brief Clears all the menus from the menu bar.\n\n" - "@tsexample\n" - "// Inform the GuiMenuBar control to clear all menus from itself.\n" - "%thisGuiMenuBar.clearMenus();\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - object->clearMenus(); -} - -DefineEngineMethod( GuiMenuBar, setMenuMargins, void, (S32 horizontalMargin, S32 verticalMargin, S32 bitmapToTextSpacing),, - "@brief Sets the menu rendering margins: horizontal, vertical, bitmap spacing.\n\n" - "Detailed description\n\n" - "@param horizontalMargin Number of pixels on the left and right side of a menu's text.\n" - "@param verticalMargin Number of pixels on the top and bottom of a menu's text.\n" - "@param bitmapToTextSpacing Number of pixels between a menu's bitmap and text.\n" - "@tsexample\n" - "// Define the horizontalMargin\n" - "%horizontalMargin = \"5\";\n\n" - "// Define the verticalMargin\n" - "%verticalMargin = \"5\";\n\n" - "// Define the bitmapToTextSpacing\n" - "%bitmapToTextSpacing = \"12\";\n\n" - "// Inform the GuiMenuBar control to set its margins based on the defined values.\n" - "%thisGuiMenuBar.setMenuMargins(%horizontalMargin,%verticalMargin,%bitmapToTextSpacing);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - object->mHorizontalMargin = horizontalMargin; - object->mVerticalMargin = verticalMargin; - object->mBitmapMargin = bitmapToTextSpacing; -} - -DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId),, - "@brief Adds a new menu to the menu bar.\n\n" - "@param menuText Text to display for the new menu item.\n" - "@param menuId ID for the new menu item.\n" - "@tsexample\n" - "// Define the menu text\n" - "%menuText = \"New Menu\";\n\n" - "// Define the menu ID.\n" - "%menuId = \"2\";\n\n" - "// Inform the GuiMenuBar control to add the new menu\n" - "%thisGuiMenuBar.addMenu(%menuText,%menuId);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - if(dIsdigit(menuText[0])) - { - Con::errorf("Cannot add menu %s (id = %s). First character of a menu's text cannot be a digit.", menuText, menuId); - return; - } - object->addMenu(menuText, menuId); -} - -DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd), - ("","",0,nullAsType(),-1,""), - "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" - "@param menu Menu name or menu Id to add the new item to.\n" - "@param menuItemText Text for the new menu item.\n" - "@param menuItemId Id for the new menu item.\n" - "@param accelerator Accelerator key for the new menu item.\n" - "@param checkGroup Check group to include this menu item in.\n" - "@tsexample\n" - "// Define the menu we wish to add the item to\n" - "%targetMenu = \"New Menu\"; or %menu = \"4\";\n\n" - "// Define the text for the new menu item\n" - "%menuItemText = \"Menu Item\";\n\n" - "// Define the id for the new menu item\n" - "%menuItemId = \"3\";\n\n" - "// Set the accelerator key to toggle this menu item with\n" - "%accelerator = \"n\";\n\n" - "// Define the Check Group that this menu item will be in, if we want it to be in a check group. -1 sets it in no check group.\n" - "%checkGroup = \"4\";\n\n" - "// Inform the GuiMenuBar control to add the new menu item with the defined fields\n" - "%thisGuiMenuBar.addMenuItem(%menu,%menuItemText,%menuItemId,%accelerator,%checkGroup);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - if(dIsdigit(menuItemText[0])) - { - Con::errorf("Cannot add menu item %s (id = %s). First character of a menu item's text cannot be a digit.", menuItemText, menuItemId); - return; - } - GuiMenuBar::Menu *menu = object->findMenu(targetMenu); - if(!menu) - { - Con::errorf("Cannot find menu %s for addMenuItem.", targetMenu); - return; - } - object->addMenuItem(menu, menuItemText, menuItemId, accelerator != NULL ? accelerator : "", checkGroup == -1 ? -1 : checkGroup, cmd); -} - -DefineEngineMethod(GuiMenuBar, setMenuItemEnable, void, (const char* menuTarget, const char* menuItemTarget, bool enabled),, - "@brief sets the menu item to enabled or disabled based on the enable parameter.\n" - "The specified menu and menu item can either be text or ids.\n\n" - "Detailed description\n\n" - "@param menuTarget Menu to work in\n" - "@param menuItemTarget The menu item inside of the menu to enable or disable\n" - "@param enabled Boolean enable / disable value.\n" - "@tsexample\n" - "// Define the menu\n" - "%menu = \"New Menu\"; or %menu = \"4\";\n\n" - "// Define the menu item\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"2\";\n\n" - "// Define the enabled state\n" - "%enabled = \"true\";\n\n" - "// Inform the GuiMenuBar control to set the enabled state of the requested menu item\n" - "%thisGuiMenuBar.setMenuItemEnable(%menu,%menuItme,%enabled);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemEnable.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setMenuItemEnable.", menuItemTarget); - return; - } - menuItem->enabled = enabled; -} - -DefineEngineMethod(GuiMenuBar, setCheckmarkBitmapIndex, void, (S32 bitmapindex),, - "@brief Sets the menu bitmap index for the check mark image.\n\n" - "@param bitmapIndex Bitmap index for the check mark image.\n" - "@tsexample\n" - "// Define the bitmap index\n" - "%bitmapIndex = \"2\";\n\n" - "// Inform the GuiMenuBar control of the proper bitmap index for the check mark image\n" - "%thisGuiMenuBar.setCheckmarkBitmapIndex(%bitmapIndex);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - object->mCheckmarkBitmapIndex = bitmapindex; -} - -DefineEngineMethod(GuiMenuBar, setMenuItemChecked, void, (const char* menuTarget, const char* menuItemTarget, bool checked),, - "@brief Sets the menu item bitmap to a check mark, which by default is the first element in\n" - "the bitmap array (although this may be changed with setCheckmarkBitmapIndex()).\n" - "Any other menu items in the menu with the same check group become unchecked if they are checked.\n\n" - "@param menuTarget Menu to work in\n" - "@param menuItem Menu item to affect\n" - "@param checked Whether we are setting it to checked or not\n" - "@tsexample\n" - "" - "@endtsexample\n\n" - "@return If not void, return value and description\n\n" - "@see References") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemChecked.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setMenuItemChecked.", menuItemTarget); - return; - } - if(checked && menuItem->checkGroup != -1) - { - // first, uncheck everything in the group: - for(GuiMenuBar::MenuItem *itemWalk = menu->firstMenuItem; itemWalk; itemWalk = itemWalk->nextMenuItem) - if(itemWalk->checkGroup == menuItem->checkGroup && itemWalk->bitmapIndex == object->mCheckmarkBitmapIndex) - itemWalk->bitmapIndex = -1; - } - menuItem->bitmapIndex = checked ? object->mCheckmarkBitmapIndex : -1; -} - -DefineEngineMethod(GuiMenuBar, setMenuText, void, (const char* menuTarget, const char* newMenuText),, - "@brief Sets the text of the specified menu to the new string.\n\n" - "@param menuTarget Menu to affect\n" - "@param newMenuText New menu text\n" - "@tsexample\n" - "// Define the menu to affect" - "%menu = \"New Menu\"; or %menu = \"3\";\n\n" - "// Define the text to change the menu to\n" - "%newMenuText = \"Still a New Menu\";\n\n" - "// Inform the GuiMenuBar control to change the defined menu to the defined text\n" - "%thisGuiMenuBar.setMenuText(%menu,%newMenuText);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - if(dIsdigit(menuTarget[0])) - { - Con::errorf("Cannot name menu %s to %s. First character of a menu's text cannot be a digit.", menuTarget, newMenuText); - return; - } - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuText.", menuTarget); - return; - } - dFree(menu->text); - menu->text = dStrdup(newMenuText); - object->menuBarDirty = true; -} - -DefineEngineMethod(GuiMenuBar, setMenuBitmapIndex, void, (const char* menuTarget, S32 bitmapindex, bool bitmaponly, bool drawborder),, - "@brief Sets the bitmap index for the menu and toggles rendering only the bitmap.\n\n" - "@param menuTarget Menu to affect\n" - "@param bitmapindex Bitmap index to set for the menu\n" - "@param bitmaponly If true, only the bitmap will be rendered\n" - "@param drawborder If true, a border will be drawn around the menu.\n" - "@tsexample\n" - "// Define the menuTarget to affect\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Set the bitmap index\n" - "%bitmapIndex = \"5\";\n\n" - "// Set if we are only to render the bitmap or not\n" - "%bitmaponly = \"true\";\n\n" - "// Set if we are rendering a border or not\n" - "%drawborder = \"true\";\n\n" - "// Inform the GuiMenuBar of the bitmap and rendering changes\n" - "%thisGuiMenuBar.setMenuBitmapIndex(%menuTarget,%bitmapIndex,%bitmapOnly,%drawBorder);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuBitmapIndex.", menuTarget); - return; - } - - menu->bitmapIndex = bitmapindex; - menu->drawBitmapOnly = bitmaponly; - menu->drawBorder = drawborder; - - object->menuBarDirty = true; -} - -DefineEngineMethod(GuiMenuBar, setMenuVisible, void, (const char* menuTarget, bool visible),, - "@brief Sets the whether or not to display the specified menu.\n\n" - "@param menuTarget Menu item to affect\n" - "@param visible Whether the menu item will be visible or not\n" - "@tsexample\n" - "// Define the menu to work with\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"4\";\n\n" - "// Define if the menu should be visible or not\n" - "%visible = \"true\";\n\n" - "// Inform the GuiMenuBar control of the new visibility state for the defined menu\n" - "%thisGuiMenuBar.setMenuVisible(%menuTarget,%visible);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuVisible.", menuTarget); - return; - } - menu->visible = visible; - object->menuBarDirty = true; - object->setUpdate(); -} - -DefineEngineMethod(GuiMenuBar, setMenuItemText, void, (const char* menuTarget, const char* menuItemTarget, const char* newMenuItemText),, - "@brief Sets the text of the specified menu item to the new string.\n\n" - "@param menuTarget Menu to affect\n" - "@param menuItem Menu item in the menu to change the text at\n" - "@param newMenuItemText New menu text\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"4\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"2\";\n\n" - "// Define the new text for the menu item\n" - "%newMenuItemText = \"Very New Menu Item\";\n\n" - "// Inform the GuiMenuBar control to change the defined menu item with the new text\n" - "%thisGuiMenuBar.setMenuItemText(%menuTarget,%menuItem,%newMenuItemText);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - if(dIsdigit(newMenuItemText[0])) - { - Con::errorf("Cannot name menu item %s to %s. First character of a menu item's text cannot be a digit.", menuItemTarget, newMenuItemText); - return; - } - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemText.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setMenuItemText.", menuItemTarget); - return; - } - dFree(menuItem->text); - menuItem->text = dStrdup(newMenuItemText); -} - -DefineEngineMethod(GuiMenuBar, setMenuItemVisible, void, (const char* menuTarget, const char* menuItemTarget, bool isVisible),, - "@brief Brief Description.\n\n" - "Detailed description\n\n" - "@param menuTarget Menu to affect the menu item in\n" - "@param menuItem Menu item to affect\n" - "@param isVisible Visible state to set the menu item to.\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"2\";\n\n" - "// Define the visibility state\n" - "%isVisible = \"true\";\n\n" - "// Inform the GuiMenuBarControl of the visibility state of the defined menu item\n" - "%thisGuiMenuBar.setMenuItemVisible(%menuTarget,%menuItem,%isVisible);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemVisible.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setMenuItemVisible.", menuItemTarget); - return; - } - menuItem->visible = isVisible; -} - -DefineEngineMethod(GuiMenuBar, setMenuItemBitmap, void, (const char* menuTarget, const char* menuItemTarget, S32 bitmapIndex),, - "@brief Sets the specified menu item bitmap index in the bitmap array. Setting the item's index to -1 will remove any bitmap.\n\n" - "@param menuTarget Menu to affect the menuItem in\n" - "@param menuItem Menu item to affect\n" - "@param bitmapIndex Bitmap index to set the menu item to\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\"\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"2\";\n\n" - "// Define the bitmapIndex\n" - "%bitmapIndex = \"6\";\n\n" - "// Inform the GuiMenuBar control to set the menu item to the defined bitmap\n" - "%thisGuiMenuBar.setMenuItemBitmap(%menuTarget,%menuItem,%bitmapIndex);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemBitmap.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setMenuItemBitmap.", menuItemTarget); - return; - } - menuItem->bitmapIndex = bitmapIndex; -} - -DefineEngineMethod(GuiMenuBar, removeMenuItem, void, (const char* menuTarget, const char* menuItemTarget),, - "@brief Removes the specified menu item from the menu.\n\n" - "@param menuTarget Menu to affect the menu item in\n" - "@param menuItem Menu item to affect\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"5\";\n\n" - "// Request the GuiMenuBar control to remove the define menu item\n" - "%thisGuiMenuBar.removeMenuItem(%menuTarget,%menuItem);\n\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for removeMenuItem.", menuTarget); - return; - } - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for removeMenuItem.", menuItemTarget); - return; - } - object->removeMenuItem(menu, menuItem); -} - -DefineEngineMethod(GuiMenuBar, clearMenuItems, void, (const char* menuTarget),, - "@brief Removes all the menu items from the specified menu.\n\n" - "@param menuTarget Menu to remove all items from\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Inform the GuiMenuBar control to clear all menu items from the defined menu\n" - "%thisGuiMenuBar.clearMenuItems(%menuTarget);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - //Con::errorf("Cannot find menu %s for clearMenuItems.", menuTarget); - return; - } - object->clearMenuItems(menu); -} - -DefineEngineMethod( GuiMenuBar, removeMenu, void, (const char* menuTarget),, - "@brief Removes the specified menu from the menu bar.\n\n" - "@param menuTarget Menu to remove from the menu bar\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Inform the GuiMenuBar to remove the defined menu from the menu bar\n" - "%thisGuiMenuBar.removeMenu(%menuTarget);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - //Con::errorf("Cannot find menu %s for removeMenu.", menuTarget); - return; - } - object->clearMenuItems(menu); - object->menuBarDirty = true; -} - -//------------------------------------------------------------------------------ -// Submenu console methods -//------------------------------------------------------------------------------ - -DefineEngineMethod(GuiMenuBar, setMenuItemSubmenuState, void, (const char* menuTarget, const char* menuItem, bool isSubmenu),, - "@brief Sets the given menu item to be a submenu.\n\n" - "@param menuTarget Menu to affect a submenu in\n" - "@param menuItem Menu item to affect\n" - "@param isSubmenu Whether or not the menuItem will become a subMenu or not\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"5\";\n\n" - "// Define whether or not the Menu Item is a sub menu or not\n" - "%isSubmenu = \"true\";\n\n" - "// Inform the GuiMenuBar control to set the defined menu item to be a submenu or not.\n" - "%thisGuiMenuBar.setMenuItemSubmenuState(%menuTarget,%menuItem,%isSubmenu);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setMenuItemSubmenuState.", menuTarget); - return; - } - - GuiMenuBar::MenuItem *menuitem = object->findMenuItem(menu, menuItem); - if(!menuitem) - { - Con::errorf("Cannot find menuitem %s for setMenuItemSubmenuState.", menuItem); - return; - } - - menuitem->isSubmenu = isSubmenu; -} - -DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText, - int submenuItemId, const char* accelerator, int checkGroup),, - "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" - "@param menuTarget Menu to affect a submenu in\n" - "@param menuItem Menu item to affect\n" - "@param submenuItemText Text to show for the new submenu\n" - "@param submenuItemId Id for the new submenu\n" - "@param accelerator Accelerator key for the new submenu\n" - "@param checkGroup Which check group the new submenu should be in, or -1 for none.\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"5\";\n\n" - "// Define the text for the new submenu\n" - "%submenuItemText = \"New Submenu Item\";\n\n" - "// Define the id for the new submenu\n" - "%submenuItemId = \"4\";\n\n" - "// Define the accelerator key for the new submenu\n" - "%accelerator = \"n\";\n\n" - "// Define the checkgroup for the new submenu\n" - "%checkgroup = \"7\";\n\n" - "// Request the GuiMenuBar control to add the new submenu with the defined information\n" - "%thisGuiMenuBar.addSubmenuItem(%menuTarget,%menuItem,%submenuItemText,%submenuItemId,%accelerator,%checkgroup);\n" - "@endtsexample\n\n" - "@see GuiTickCtrl\n") -{ - if(dIsdigit(submenuItemText[0])) - { - Con::errorf("Cannot add submenu item %s (id = %s). First character of a menu item's text cannot be a digit.", submenuItemText, submenuItemId); - return; - } - - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for addMenuItem.", menuTarget); - return; - } - - GuiMenuBar::MenuItem *menuitem = object->findMenuItem(menu, menuItem); - if(!menuitem) - { - Con::errorf("Cannot find menuitem %s for addSubmenuItem.", menuItem); - return; - } - - object->addSubmenuItem(menu, menuitem, submenuItemText, submenuItemId, !accelerator ? "" : accelerator, checkGroup == -1 ? -1 : checkGroup); -} - -DefineEngineMethod(GuiMenuBar, clearSubmenuItems, void, (const char* menuTarget, const char* menuItem),, - "@brief Removes all the menu items from the specified submenu.\n\n" - "@param menuTarget Menu to affect a submenu in\n" - "@param menuItem Menu item to affect\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"5\";\n\n" - "// Inform the GuiMenuBar to remove all submenu items from the defined menu item\n" - "%thisGuiMenuBar.clearSubmenuItems(%menuTarget,%menuItem);\n\n" - "@endtsexample\n\n" - "@see GuiControl") -{ - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for clearSubmenuItems.", menuTarget); - return; - } - - GuiMenuBar::MenuItem *menuitem = object->findMenuItem(menu, menuItem); - if(!menuitem) - { - Con::errorf("Cannot find menuitem %s for clearSubmenuItems.", menuItem); - return; - } - - object->clearSubmenuItems(menuitem); -} - -DefineEngineMethod(GuiMenuBar, setSubmenuItemChecked, void, (const char* menuTarget, const char* menuItemTarget, const char* submenuItemText, bool checked),, - "@brief Sets the menu item bitmap to a check mark, which by default is the first element in the\n" - "bitmap array (although this may be changed with setCheckmarkBitmapIndex()).\n" - "Any other menu items in the menu with the same check group become unchecked if they are checked.\n\n" - "@param menuTarget Menu to affect a submenu in\n" - "@param menuItem Menu item to affect\n" - "@param submenuItemText Text to show for submenu\n" - "@param checked Whether or not this submenu item will be checked.\n" - "@tsexample\n" - "// Define the menuTarget\n" - "%menuTarget = \"New Menu\"; or %menuTarget = \"3\";\n\n" - "// Define the menuItem\n" - "%menuItem = \"New Menu Item\"; or %menuItem = \"5\";\n\n" - "// Define the text for the new submenu\n" - "%submenuItemText = \"Submenu Item\";\n\n" - "// Define if this submenu item should be checked or not\n" - "%checked = \"true\";\n\n" - "// Inform the GuiMenuBar control to set the checked state of the defined submenu item\n" - "%thisGuiMenuBar.setSubmenuItemChecked(%menuTarget,%menuItem,%submenuItemText,%checked);\n" - "@endtsexample\n\n" - "@return If not void, return value and description\n\n" - "@see References") -{ - // Find the parent menu - GuiMenuBar::Menu *menu = object->findMenu(menuTarget); - if(!menu) - { - Con::errorf("Cannot find menu %s for setSubmenuItemChecked.", menuTarget); - return; - } - - // Find the parent menu item - GuiMenuBar::MenuItem *menuItem = object->findMenuItem(menu, menuItemTarget); - if(!menuItem) - { - Con::errorf("Cannot find menu item %s for setSubmenuItemChecked.", menuItemTarget); - return; - } - - // Find the submenu item - GuiMenuBar::MenuItem *submenuItem = object->findSubmenuItem(menu, menuItemTarget, submenuItemText); - if(!submenuItem) - { - Con::errorf("Cannot find submenu item %s for setSubmenuItemChecked.", submenuItemText); - return; - } - - if(checked && submenuItem->checkGroup != -1) - { - // first, uncheck everything in the group: - for(GuiMenuBar::MenuItem *itemWalk = menuItem->submenu->firstMenuItem; itemWalk; itemWalk = itemWalk->nextMenuItem) - if(itemWalk->checkGroup == submenuItem->checkGroup && itemWalk->bitmapIndex == object->mCheckmarkBitmapIndex) - itemWalk->bitmapIndex = -1; - } - submenuItem->bitmapIndex = checked ? object->mCheckmarkBitmapIndex : -1; -} - -//------------------------------------------------------------------------------ -// menu management methods -//------------------------------------------------------------------------------ -GuiMenuBar::Menu* GuiMenuBar::sCreateMenu(const char *menuText, U32 menuId) -{ - // allocate the menu - Menu *newMenu = new Menu; - newMenu->text = dStrdup(menuText); - newMenu->id = menuId; - newMenu->nextMenu = NULL; - newMenu->firstMenuItem = NULL; - newMenu->visible = true; - - // Menu bitmap variables - newMenu->bitmapIndex = -1; - newMenu->drawBitmapOnly = false; - newMenu->drawBorder = true; - - return newMenu; -} - -void GuiMenuBar::addMenu(GuiMenuBar::Menu *newMenu, S32 pos) -{ - // add it to the menu list - menuBarDirty = true; - if (pos == -1) - mMenuList.push_back(newMenu); - else - mMenuList.insert(pos, newMenu); -} - -void GuiMenuBar::addMenu(const char *menuText, U32 menuId) -{ - Menu *newMenu = sCreateMenu(menuText, menuId); - - addMenu(newMenu); -} - -GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu) -{ - if(dIsdigit(menu[0])) - { - U32 id = dAtoi(menu); - for (U32 i = 0; i < mMenuList.size(); ++i) - if (id == mMenuList[i].id) - return mMenuList[i]; - return NULL; - } - else - { - for (U32 i = 0; i < mMenuList.size(); ++i) - if (!dStricmp(menu, mMenuList[i].text)) - return mMenuList[i]; - return NULL; - } -} - -GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem) -{ - if(dIsdigit(menuItem[0])) - { - U32 id = dAtoi(menuItem); - for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) - if(id == walk->id) - return walk; - return NULL; - } - else - { - for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) - if(!dStricmp(menuItem, walk->text)) - return walk; - return NULL; - } -} - -void GuiMenuBar::removeMenu(Menu *menu) -{ - menuBarDirty = true; - clearMenuItems(menu); - - for (U32 i = 0; i < mMenuList.size(); ++i) - { - if (mMenuList[i] == menu) - { - mMenuList.erase(i); - break; - } - } -} - -void GuiMenuBar::removeMenuItem(Menu *menu, MenuItem *menuItem) -{ - for(MenuItem **walk = &menu->firstMenuItem; *walk; walk = &(*walk)->nextMenuItem) - { - if(*walk == menuItem) - { - *walk = menuItem->nextMenuItem; - break; - } - } - - // If this is a submenu, then be sure to clear the submenu's items - if(menuItem->isSubmenu) - { - clearSubmenuItems(menuItem); - } - - dFree(menuItem->text); - dFree(menuItem->accelerator); - delete menuItem; -} - -GuiMenuBar::MenuItem* GuiMenuBar::addMenuItem(Menu *menu, const char *text, U32 id, const char *accelerator, S32 checkGroup, const char *cmd ) -{ - // allocate the new menu item - MenuItem *newMenuItem = new MenuItem; - newMenuItem->text = dStrdup(text); - if(accelerator[0]) - newMenuItem->accelerator = dStrdup(accelerator); - else - newMenuItem->accelerator = NULL; - newMenuItem->cmd = cmd; - newMenuItem->id = id; - newMenuItem->checkGroup = checkGroup; - newMenuItem->nextMenuItem = NULL; - newMenuItem->acceleratorIndex = 0; - newMenuItem->enabled = text[0] != '-'; - newMenuItem->visible = true; - newMenuItem->bitmapIndex = -1; - - // Default to not having a submenu - newMenuItem->isSubmenu = false; - newMenuItem->submenu = NULL; - newMenuItem->submenuParentMenu = NULL; - - // link it into the menu's menu item list - if(menu) - { - MenuItem **walk = &menu->firstMenuItem; - while(*walk) - walk = &(*walk)->nextMenuItem; - *walk = newMenuItem; - } - - return newMenuItem; -} - -GuiMenuBar::MenuItem* GuiMenuBar::addMenuItem(Menu *menu, MenuItem* newMenuItem) -{ - // link it into the menu's menu item list - if(menu) - { - MenuItem **walk = &menu->firstMenuItem; - while(*walk) - walk = &(*walk)->nextMenuItem; - *walk = newMenuItem; - } - - return newMenuItem; -} - -void GuiMenuBar::clearMenuItems(Menu *menu) -{ - while(menu->firstMenuItem) - removeMenuItem(menu, menu->firstMenuItem); -} - -void GuiMenuBar::clearMenus() -{ - mMenuList.clear(); -} - -void GuiMenuBar::attachToMenuBar(Menu* menu, S32 pos) -{ - addMenu(menu, pos); -} - -void GuiMenuBar::removeFromMenuBar(Menu* menu) -{ - menuBarDirty = true; - - for (U32 i = 0; i < mMenuList.size(); ++i) - { - if (mMenuList[i] == menu) - { - mMenuList.erase(i); - break; - } - } -} - -//------------------------------------------------------------------------------ -// Submenu methods -//------------------------------------------------------------------------------ - -// This method will return the MenuItem class of of a submenu's menu item given -// its parent menu and parent menuitem. If the menuitem ID is used, then the submenu -// ID must also be used. -GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuItem, const char *submenuItem) -{ - if(dIsdigit(menuItem[0])) - { - // Search by ID - U32 id = dAtoi(menuItem); - for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) - if(id == walk->id) - { - if(walk->isSubmenu && walk->submenu) - { - return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } - return NULL; - } - else - { - // Search by name - for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) - if(!dStricmp(menuItem, walk->text)) - { - if(walk->isSubmenu && walk->submenu) - { - return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } - return NULL; - } -} - -GuiMenuBar::MenuItem* GuiMenuBar::findSubmenuItem(MenuItem *menuItem, const char *submenuItem) -{ - if( !menuItem->isSubmenu ) - return NULL; - - return GuiMenuBar::findMenuItem( menuItem->submenu, submenuItem ); -} - -// Add a menuitem to the given submenu -void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, U32 id, const char *accelerator, S32 checkGroup) -{ - // Check that the given menu item supports a submenu - if(submenu && !submenu->isSubmenu) - { - Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text); - return; - } - - // allocate the new menu item - MenuItem *newMenuItem = new MenuItem; - newMenuItem->text = dStrdup(text); - if(accelerator[0]) - newMenuItem->accelerator = dStrdup(accelerator); - else - newMenuItem->accelerator = NULL; - newMenuItem->id = id; - newMenuItem->checkGroup = checkGroup; - newMenuItem->nextMenuItem = NULL; - newMenuItem->acceleratorIndex = 0; - newMenuItem->enabled = (dStrlen(text) > 1 || text[0] != '-'); - newMenuItem->visible = true; - newMenuItem->bitmapIndex = -1; - - // Default to not having a submenu - newMenuItem->isSubmenu = false; - newMenuItem->submenu = NULL; - - // Point back to the submenu's menu - newMenuItem->submenuParentMenu = menu; - - // link it into the menu's menu item list - MenuItem **walk = &submenu->submenu->firstMenuItem; - while(*walk) - walk = &(*walk)->nextMenuItem; - *walk = newMenuItem; -} - -void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem ) -{ - AssertFatal( submenu && newMenuItem, ""); - - // Point back to the submenu's menu - newMenuItem->submenuParentMenu = menu; - - // link it into the menu's menu item list - MenuItem **walk = &submenu->submenu->firstMenuItem; - while(*walk) - walk = &(*walk)->nextMenuItem; - *walk = newMenuItem; -} - -// Remove a submenu item -void GuiMenuBar::removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem) -{ - // Check that the given menu item supports a submenu - if(menuItem && !menuItem->isSubmenu) - { - Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text); - return; - } - - GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem); -} - -// Clear all menuitems from a submenu -void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem) -{ - // Check that the given menu item supports a submenu - if(menuitem && !menuitem->isSubmenu) - { - Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu"); - return; - } - - while(menuitem->submenu->firstMenuItem) - removeSubmenuItem(menuitem, menuitem->submenu->firstMenuItem); -} -*/ //------------------------------------------------------------------------------ // initialization, input and render methods //------------------------------------------------------------------------------ @@ -1456,7 +517,10 @@ void GuiMenuBar::insert(SimObject* pObject, S32 pos) { PopupMenu* menu = dynamic_cast(pObject); if (menu == nullptr) + { + Con::errorf("GuiMenuBar::insert() - attempted to insert non-popupMenu object: %d", pObject->getId()); return; + } MenuEntry newMenu; newMenu.pos = pos >= mMenuList.size() || pos == -1 ? pos = mMenuList.size() : pos; @@ -1471,6 +535,28 @@ void GuiMenuBar::insert(SimObject* pObject, S32 pos) mMenuList.push_back(newMenu); else mMenuList.insert(pos, newMenu); + + menuBarDirty = true; //ensure we refresh +} + +void GuiMenuBar::remove(SimObject* pObject) +{ + PopupMenu* menu = dynamic_cast(pObject); + if (menu == nullptr) + { + Con::errorf("GuiMenuBar::remove() - attempted to remove non-popupMenu object: %d", pObject->getId()); + return; + } + + for(U32 i=0; i < mMenuList.size(); i++) + { + if(mMenuList[i].popupMenu == menu) + { + mMenuList.erase(i); + menuBarDirty = true; //ensure we refresh + return; + } + } } PopupMenu* GuiMenuBar::getMenu(U32 index) @@ -1525,9 +611,25 @@ DefineEngineMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") //----------------------------------------------------------------------------- DefineEngineMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") { + if(pObject == nullptr) + { + Con::errorf("GuiMenuBar::insert() - null object"); + return; + } object->insert(pObject, pos); } +DefineEngineMethod(GuiMenuBar, remove, void, (SimObject* pObject), (nullAsType()), "(object, pos) remove object") +{ + if (pObject == nullptr) + { + Con::errorf("GuiMenuBar::remove() - null object"); + return; + } + object->remove(pObject); +} + + DefineEngineMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)") { PopupMenu* menu = object->findMenu(barTitle); diff --git a/Engine/source/gui/editor/guiMenuBar.h b/Engine/source/gui/editor/guiMenuBar.h index 985df8de6..d52672392 100644 --- a/Engine/source/gui/editor/guiMenuBar.h +++ b/Engine/source/gui/editor/guiMenuBar.h @@ -110,6 +110,7 @@ public: void processTick(); void insert(SimObject* pObject, S32 pos); + void remove(SimObject* pObject); static void initPersistFields(); diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 2835eb521..2a72c09b0 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -210,11 +210,31 @@ bool GuiPopupMenuTextListCtrl::onKeyDown(const GuiEvent &event) void GuiPopupMenuTextListCtrl::onMouseDown(const GuiEvent &event) { + if(mLastHighlightedMenuIdx != -1) + { + //See if we're trying to click on a submenu + if(mList[mLastHighlightedMenuIdx].text[1] != 1) + { + //yep, so abort + return; + } + } + Parent::onMouseDown(event); } void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) { + if (mLastHighlightedMenuIdx != -1) + { + //See if we're trying to click on a submenu + if (mList[mLastHighlightedMenuIdx].text[1] != 1) + { + //yep, so abort + return; + } + } + Parent::onMouseUp(event); S32 selectionIndex = getSelectedCell().y; diff --git a/Engine/source/gui/editor/inspector/dynamicField.cpp b/Engine/source/gui/editor/inspector/dynamicField.cpp index cebaa890a..477768c5a 100644 --- a/Engine/source/gui/editor/inspector/dynamicField.cpp +++ b/Engine/source/gui/editor/inspector/dynamicField.cpp @@ -74,7 +74,7 @@ void GuiInspectorDynamicField::setData( const char* data, bool callbacks ) { target->inspectPreApply(); - if( callbacks ) + if( callbacks && !mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors)) { if( isRemoval ) Con::executef( mInspector, "onFieldRemoved", target->getIdString(), mDynField->slotName ); diff --git a/Engine/source/gui/editor/inspector/field.cpp b/Engine/source/gui/editor/inspector/field.cpp index 34fe76c80..35f85f405 100644 --- a/Engine/source/gui/editor/inspector/field.cpp +++ b/Engine/source/gui/editor/inspector/field.cpp @@ -378,7 +378,7 @@ void GuiInspectorField::setData( const char* data, bool callbacks ) // Fire callback single-object undo. - if( callbacks ) + if( callbacks && !mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) ) Con::executef( mInspector, "onInspectorFieldModified", target->getIdString(), mField->pFieldname, diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 35bb8130c..b5dc3cb69 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -303,7 +303,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) Sim::findObject("PopUpMenuControl", backgroundCtrl); GuiControlProfile* profile; - Sim::findObject("ToolsGuiMenuBarProfile", profile); + Sim::findObject("ToolsGuiPopupMenuProfile", profile); if (!profile) return; diff --git a/Engine/source/gui/utility/guiInputCtrl.cpp b/Engine/source/gui/utility/guiInputCtrl.cpp index f5f41b486..31d2a2e86 100644 --- a/Engine/source/gui/utility/guiInputCtrl.cpp +++ b/Engine/source/gui/utility/guiInputCtrl.cpp @@ -64,6 +64,7 @@ GuiInputCtrl::GuiInputCtrl() mSendModifierEvents(false), mIgnoreMouseEvents(false) { + mActionmap = nullptr; } //------------------------------------------------------------------------------ @@ -80,6 +81,7 @@ void GuiInputCtrl::initPersistFields() "If true, Make events will be sent for modifier keys (Default false)."); addField("ignoreMouseEvents", TypeBool, Offset(mIgnoreMouseEvents, GuiInputCtrl), "If true, any events from mouse devices will be passed through."); + addField("actionMap", TYPEID(), Offset(mActionmap, GuiInputCtrl), "The name of an action map to push/pop on the input stack alongside the wake/sleep of this control."); endGroup("GuiInputCtrl"); Parent::initPersistFields(); @@ -103,6 +105,12 @@ bool GuiInputCtrl::onWake() if( !smDesignTime && !mIgnoreMouseEvents) mouseLock(); + + if(mActionmap != nullptr) + { + SimSet* actionMapSet = Sim::getActiveActionMapSet(); + actionMapSet->pushObject(mActionmap); + } setFirstResponder(); @@ -115,6 +123,13 @@ void GuiInputCtrl::onSleep() { Parent::onSleep(); mouseUnlock(); + + if (mActionmap != nullptr) + { + SimSet* actionMapSet = Sim::getActiveActionMapSet(); + actionMapSet->removeObject(mActionmap); + } + clearFirstResponder(); } @@ -158,6 +173,9 @@ bool GuiInputCtrl::onInputEvent( const InputEventInfo &event ) if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType) return false; + if (mActionmap != nullptr) + return false; + char deviceString[32]; if ( event.action == SI_MAKE ) { diff --git a/Engine/source/gui/utility/guiInputCtrl.h b/Engine/source/gui/utility/guiInputCtrl.h index 269569693..5b87cc53f 100644 --- a/Engine/source/gui/utility/guiInputCtrl.h +++ b/Engine/source/gui/utility/guiInputCtrl.h @@ -26,6 +26,7 @@ #ifndef _GUIMOUSEEVENTCTRL_H_ #include "gui/utility/guiMouseEventCtrl.h" #endif +#include "sim/actionMap.h" /// A control that locks the mouse and reports all keyboard input events @@ -38,6 +39,8 @@ protected: bool mSendModifierEvents; bool mIgnoreMouseEvents; + ActionMap* mActionmap; + public: typedef GuiMouseEventCtrl Parent; diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp index 8acd5ef16..c37aff66b 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp @@ -1768,10 +1768,10 @@ void GuiConvexEditorCtrl::submitUndo( UndoType type, const Vector mIsDirty = true; } -bool GuiConvexEditorCtrl::_cursorCastCallback( RayInfo* ri ) +bool GuiConvexEditorCtrl::_cursorCastCallback( SceneObject* object ) { // Reject anything that's not a ConvexShape. - return dynamic_cast< ConvexShape* >( ri->object ); + return dynamic_cast< ConvexShape* >( object ); } bool GuiConvexEditorCtrl::_cursorCast( const Gui3DMouseEvent &event, ConvexShape **hitShape, S32 *hitFace ) diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h index 1600a4e50..1c64e964a 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h @@ -169,7 +169,7 @@ protected: void _renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *matInst ); bool _cursorCast( const Gui3DMouseEvent &event, ConvexShape **hitShape, S32 *hitFace ); - static bool _cursorCastCallback( RayInfo* ri ); + static bool _cursorCastCallback( SceneObject* object ); protected: diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.cpp b/Engine/source/lighting/advanced/advancedLightBinManager.cpp index fd8cd6dc4..c857933dd 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightBinManager.cpp @@ -790,7 +790,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light MaterialParameters *matParams = matInstance->getMaterialParameters(); matParams->setSafe( lightColor, lightInfo->getColor() ); - matParams->setSafe(lightBrightness, lightInfo->getBrightness() * lightInfo->getFadeAmount()); + F32 luxTargMultiplier = 1; switch( lightInfo->getType() ) { @@ -804,10 +804,10 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light case LightInfo::Spot: { const F32 outerCone = lightInfo->getOuterConeAngle(); - const F32 innerCone = getMin(lightInfo->getInnerConeAngle(), outerCone); + const F32 innerCone = getMin(lightInfo->getInnerConeAngle(), outerCone-0.0001f); const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f)); const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f)); - Point2F spotParams(outerCos,innerCos - outerCos); + Point2F spotParams(outerCos,mMax(innerCos - outerCos,0.001f)); matParams->setSafe( lightSpotParams, spotParams ); matParams->setSafe( lightDirection, lightInfo->getDirection()); @@ -817,6 +817,9 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light const F32 invSqrRadius = 1.0f / mSquared(radius); matParams->setSafe(lightRange, radius); matParams->setSafe(lightInvSqrRange, invSqrRadius); + + F32 concentration = 360.0f/ outerCone; + luxTargMultiplier = radius * concentration; } break; @@ -828,6 +831,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light const F32 invSqrRadius = 1.0f / (radius * radius); matParams->setSafe( lightRange, radius); matParams->setSafe( lightInvSqrRange, invSqrRadius); + luxTargMultiplier =radius; } break; @@ -835,6 +839,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light AssertFatal( false, "Bad light type!" ); break; } + matParams->setSafe(lightBrightness, lightInfo->getBrightness()* lightInfo->getFadeAmount() * luxTargMultiplier); } bool LightMatInstance::setupPass( SceneRenderState *state, const SceneData &sgData ) diff --git a/Engine/source/lighting/advanced/advancedLightManager.cpp b/Engine/source/lighting/advanced/advancedLightManager.cpp index 2fc213015..47c8d3d36 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightManager.cpp @@ -607,7 +607,7 @@ GFXVertexBufferHandle AdvancedLightManager::g for (S32 i=1; igetControlObject()) + if (conn && conn->getControlObject()) { GameBase *conObject = conn->getControlObject(); activeLights.push_back_unique(conObject); @@ -333,7 +333,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, static AlignedArray lightSpotDirs(MAX_FORWARD_LIGHTS, sizeof(Point4F)); static AlignedArray lightColors(MAX_FORWARD_LIGHTS, sizeof(Point4F)); static AlignedArray lightConfigData(MAX_FORWARD_LIGHTS, sizeof(Point4F)); //type, brightness, range, invSqrRange : rgba - static AlignedArray lightSpotParams(MAX_FORWARD_LIGHTS, sizeof(Point2F)); + static AlignedArray lightSpotParams(MAX_FORWARD_LIGHTS, sizeof(Point4F)); dMemset(lightPositions.getBuffer(), 0, lightPositions.getBufferSize()); dMemset(lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize()); @@ -352,11 +352,12 @@ void LightManager::_update4LightConsts( const SceneData &sgData, vectorLightDirection = Point4F::Zero; vectorLightColor = Point4F::Zero; vectorLightAmbientColor = Point4F::Zero; - + F32 luxTargMultiplier[MAX_FORWARD_LIGHTS]; // Gather the data for the first 4 lights. const LightInfo* light; for (U32 i = 0; i < MAX_FORWARD_LIGHTS; i++) { + luxTargMultiplier[i] = 1.0; light = sgData.lights[i]; if (!light) break; @@ -371,48 +372,52 @@ void LightManager::_update4LightConsts( const SceneData &sgData, vectorLightColor = Point4F(light->getColor()); vectorLightAmbientColor = Point4F(light->getAmbient()); hasVectorLight = 1; - continue; } - - // The light positions and spot directions are - // in SoA order to make optimal use of the GPU. - const Point3F& lightPos = light->getPosition(); - lightPositions[i].x = lightPos.x; - lightPositions[i].y = lightPos.y; - lightPositions[i].z = lightPos.z; - lightPositions[i].w = 0; - - const VectorF& lightDir = light->getDirection(); - lightSpotDirs[i].x = lightDir.x; - lightSpotDirs[i].y = lightDir.y; - lightSpotDirs[i].z = lightDir.z; - lightSpotDirs[i].w = 0; - - lightColors[i] = Point4F(light->getColor()); - - if (light->getType() == LightInfo::Point) + else { - lightConfigData[i].x = 0; + // The light positions and spot directions are + // in SoA order to make optimal use of the GPU. + const Point3F& lightPos = light->getPosition(); + lightPositions[i].x = lightPos.x; + lightPositions[i].y = lightPos.y; + lightPositions[i].z = lightPos.z; + lightPositions[i].w = 0; + + lightColors[i] = Point4F(light->getColor()); + + F32 range = light->getRange().x; + lightConfigData[i].z = range; + + if (light->getType() == LightInfo::Point) + { + lightConfigData[i].x = 0; + luxTargMultiplier[i] = range; + } + else if (light->getType() == LightInfo::Spot) + { + const VectorF& lightDir = light->getDirection(); + lightSpotDirs[i].x = lightDir.x; + lightSpotDirs[i].y = lightDir.y; + lightSpotDirs[i].z = lightDir.z; + lightSpotDirs[i].w = 0; + + lightConfigData[i].x = 1; + + const F32 outerCone = light->getOuterConeAngle(); + const F32 innerCone = getMin(light->getInnerConeAngle(), outerCone - 0.0001f); + const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f)); + const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f)); + Point2F spotParams(outerCos, mMax(innerCos - outerCos, 0.001f)); + + lightSpotParams[i].x = spotParams.x; + lightSpotParams[i].y = spotParams.y; + F32 concentration = 360.0f / outerCone; + luxTargMultiplier[i] = range * concentration; + } + + lightConfigData[i].y = light->getBrightness() * luxTargMultiplier[i]; + lightConfigData[i].w = 1.0f / (range * range); } - else if (light->getType() == LightInfo::Spot) - { - lightConfigData[i].x = 1; - - const F32 outerCone = light->getOuterConeAngle(); - const F32 innerCone = getMin(light->getInnerConeAngle(), outerCone); - const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f)); - const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f)); - Point2F spotParams(outerCos, innerCos - outerCos); - - lightSpotParams[i].x = spotParams.x; - lightSpotParams[i].y = spotParams.y; - } - - lightConfigData[i].y = light->getBrightness(); - - F32 range = light->getRange().x; - lightConfigData[i].z = range; - lightConfigData[i].w = 1.0f / (range * range); } shaderConsts->setSafe(lightPositionSC, lightPositions); diff --git a/Engine/source/lighting/shadowMap/singleLightShadowMap.cpp b/Engine/source/lighting/shadowMap/singleLightShadowMap.cpp index cd4724838..4f246bec8 100644 --- a/Engine/source/lighting/shadowMap/singleLightShadowMap.cpp +++ b/Engine/source/lighting/shadowMap/singleLightShadowMap.cpp @@ -71,7 +71,8 @@ void SingleLightShadowMap::_render( RenderPassManager* renderPass, lightMatrix.inverse(); GFX->setWorldMatrix(lightMatrix); - const MatrixF& lightProj = GFX->getProjectionMatrix(); + MatrixF lightProj = GFX->getProjectionMatrix(); + lightProj.reverseProjection(); mWorldToLightProj = lightProj * lightMatrix; // Render the shadowmap! diff --git a/Engine/source/materials/materialManager.cpp b/Engine/source/materials/materialManager.cpp index 0a9d470c2..d2979d8eb 100644 --- a/Engine/source/materials/materialManager.cpp +++ b/Engine/source/materials/materialManager.cpp @@ -297,10 +297,19 @@ BaseMatInstance *MaterialManager::getMeshDebugMatInstance(const LinearColorF &me void MaterialManager::mapMaterial(const String & textureName, const String & materialName) { - if (getMapEntry(textureName).isNotEmpty()) + String currentMapEntry = getMapEntry(textureName); + if (currentMapEntry.isNotEmpty()) { if (!textureName.equal("unmapped_mat", String::NoCase)) - Con::warnf(ConsoleLogEntry::General, "Warning, overwriting material for: %s", textureName.c_str()); + { + SimObject* originalMat; + SimObject* newMat; + + if (Sim::findObject(currentMapEntry, originalMat) && Sim::findObject(materialName, newMat)) + Con::warnf(ConsoleLogEntry::General, "Warning, overwriting material for: \"%s\" in %s by %s", textureName.c_str(), originalMat->getFilename(), newMat->getFilename()); + else + Con::warnf(ConsoleLogEntry::General, "Warning, overwriting material for: %s", textureName.c_str()); + } } mMaterialMap[String::ToLower(textureName)] = materialName; diff --git a/Engine/source/navigation/coverPoint.h b/Engine/source/navigation/coverPoint.h index 4950767a9..6f2e317c9 100644 --- a/Engine/source/navigation/coverPoint.h +++ b/Engine/source/navigation/coverPoint.h @@ -54,6 +54,7 @@ public: virtual ~CoverPoint(); DECLARE_CONOBJECT(CoverPoint); + DECLARE_CATEGORY("Navigation"); /// Amount of cover provided at this point. enum Size { diff --git a/Engine/source/navigation/navMesh.h b/Engine/source/navigation/navMesh.h index a4096cdfc..5ae227f83 100644 --- a/Engine/source/navigation/navMesh.h +++ b/Engine/source/navigation/navMesh.h @@ -239,6 +239,7 @@ public: NavMesh(); ~NavMesh(); DECLARE_CONOBJECT(NavMesh); + DECLARE_CATEGORY("Navigation"); /// Return the server-side NavMesh SimSet. static SimSet *getServerSet(); diff --git a/Engine/source/navigation/navPath.h b/Engine/source/navigation/navPath.h index ccc16386d..93ac0c4e7 100644 --- a/Engine/source/navigation/navPath.h +++ b/Engine/source/navigation/navPath.h @@ -115,6 +115,7 @@ public: void renderSimple(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat); DECLARE_CONOBJECT(NavPath); + DECLARE_CATEGORY("Navigation"); /// @} diff --git a/Engine/source/persistence/taml/binary/tamlBinaryReader.cpp b/Engine/source/persistence/taml/binary/tamlBinaryReader.cpp index f703bbb7f..cd128175d 100644 --- a/Engine/source/persistence/taml/binary/tamlBinaryReader.cpp +++ b/Engine/source/persistence/taml/binary/tamlBinaryReader.cpp @@ -147,6 +147,8 @@ SimObject* TamlBinaryReader::parseElement( Stream& stream, const U32 versionId ) if ( pSimObject == NULL ) return NULL; + pSimObject->setFilename(mpTaml->getFilePathBuffer()); + // Find Taml callbacks. TamlCallbacks* pCallbacks = dynamic_cast( pSimObject ); diff --git a/Engine/source/persistence/taml/xml/tamlXmlReader.cpp b/Engine/source/persistence/taml/xml/tamlXmlReader.cpp index fb8814260..7fe2637c9 100644 --- a/Engine/source/persistence/taml/xml/tamlXmlReader.cpp +++ b/Engine/source/persistence/taml/xml/tamlXmlReader.cpp @@ -119,6 +119,8 @@ SimObject* TamlXmlReader::parseElement( tinyxml2::XMLElement* pXmlElement ) if ( pSimObject == NULL ) return NULL; + pSimObject->setFilename(mpTaml->getFilePathBuffer()); + // Find Taml callbacks. TamlCallbacks* pCallbacks = dynamic_cast( pSimObject ); diff --git a/Engine/source/platformMac/macFileIO.mm b/Engine/source/platformMac/macFileIO.mm index dae844163..d0eb99c10 100644 --- a/Engine/source/platformMac/macFileIO.mm +++ b/Engine/source/platformMac/macFileIO.mm @@ -646,7 +646,7 @@ StringTableEntry Platform::getExecutablePath() return cwd; } - NSString* string = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"cs"]; + NSString* string = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"tscript"]; if(!string) string = [[NSBundle mainBundle] bundlePath]; diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index 0f1ce87f6..954d199e2 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -59,6 +59,8 @@ RenderProbeMgr *RenderProbeMgr::smProbeManager = NULL; // This variable is a global toggle on if reflection probes should be rendered or not bool RenderProbeMgr::smRenderReflectionProbes = true; +bool RenderProbeMgr::smBakeReflectionProbes = false; + // This variable defines the maximum draw distance of a probe. F32 RenderProbeMgr::smMaxProbeDrawDistance = 100; @@ -500,19 +502,50 @@ void RenderProbeMgr::reloadTextures() void RenderProbeMgr::preBake() { - Con::setVariable("$Probes::Capturing", "1"); + RenderProbeMgr::smBakeReflectionProbes = true; + GFXShader::addGlobalMacro("CAPTURING", String("1")); + + //Con::setVariable("$Probes::Capturing", "1"); mRenderMaximumNumOfLights = AdvancedLightBinManager::smMaximumNumOfLights; mRenderUseLightFade = AdvancedLightBinManager::smUseLightFade; AdvancedLightBinManager::smMaximumNumOfLights = -1; AdvancedLightBinManager::smUseLightFade = false; + + //kickstart rendering + LightManager* lm = LIGHTMGR; + if (lm) + { + SceneManager* sm = lm->getSceneManager(); + if (sm && sm->getContainer() == &gClientContainer) + { + lm->deactivate(); + lm->activate(sm); + } + } } + void RenderProbeMgr::postBake() { - Con::setVariable("$Probes::Capturing", "0"); + RenderProbeMgr::smBakeReflectionProbes = false; + GFXShader::addGlobalMacro("CAPTURING", String("0")); + //Con::setVariable("$Probes::Capturing", "0"); AdvancedLightBinManager::smMaximumNumOfLights = mRenderMaximumNumOfLights; AdvancedLightBinManager::smUseLightFade = mRenderUseLightFade; + + //kickstart rendering + LightManager* lm = LIGHTMGR; + if (lm) + { + SceneManager* sm = lm->getSceneManager(); + if (sm && sm->getContainer() == &gClientContainer) + { + lm->deactivate(); + lm->activate(sm); + } + } } + void RenderProbeMgr::bakeProbe(ReflectionProbe* probe) { GFXDEBUGEVENT_SCOPE(RenderProbeMgr_Bake, ColorI::WHITE); @@ -520,8 +553,6 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe) Con::warnf("RenderProbeMgr::bakeProbe() - Beginning bake!"); U32 startMSTime = Platform::getRealMilliseconds(); - preBake(); - String path = Con::getVariable("$pref::ReflectionProbes::CurrentLevelPath", "levels/"); U32 resolution = Con::getIntVariable("$pref::ReflectionProbes::BakeResolution", 64); U32 prefilterMipLevels = mLog2(F32(resolution)) + 1; @@ -641,7 +672,6 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe) if (!renderWithProbes) RenderProbeMgr::smRenderReflectionProbes = probeRenderState; - postBake(); cubeRefl.unregisterReflector(); @@ -845,7 +875,7 @@ void RenderProbeMgr::render( SceneRenderState *state ) _setupPerFrameParameters(state); // Early out if nothing to draw. - if ((!RenderProbeMgr::smRenderReflectionProbes && !dStrcmp(Con::getVariable("$Probes::Capturing", "0"), "1")) || (!mHasSkylight && mProbeData.effectiveProbeCount == 0)) + if (!RenderProbeMgr::smRenderReflectionProbes || (!mHasSkylight && mProbeData.effectiveProbeCount == 0)) { getProbeArrayEffect()->setSkip(true); mActiveProbes.clear(); @@ -875,9 +905,6 @@ void RenderProbeMgr::render( SceneRenderState *state ) String probePerFrame = Con::getVariable("$pref::MaxProbesPerFrame", "8"); mProbeArrayEffect->setShaderMacro("MAX_PROBES", probePerFrame); - String probeCapturing = Con::getVariable("$Probes::Capturing", "0"); - mProbeArrayEffect->setShaderMacro("CAPTURING", probeCapturing); - mProbeArrayEffect->setTexture(3, mBRDFTexture); mProbeArrayEffect->setCubemapArrayTexture(4, mPrefilterArray); mProbeArrayEffect->setCubemapArrayTexture(5, mIrradianceArray); @@ -953,11 +980,15 @@ void RenderProbeMgr::render( SceneRenderState *state ) DefineEngineMethod(RenderProbeMgr, bakeProbe, void, (ReflectionProbe* probe), (nullAsType< ReflectionProbe*>()), "@brief Bakes the cubemaps for a reflection probe\n\n.") { + object->preBake(); if(probe != nullptr) object->bakeProbe(probe); + object->postBake(); } DefineEngineMethod(RenderProbeMgr, bakeProbes, void, (),, "@brief Iterates over all reflection probes in the scene and bakes their cubemaps\n\n.") { + object->preBake(); object->bakeProbes(); + object->postBake(); } diff --git a/Engine/source/renderInstance/renderProbeMgr.h b/Engine/source/renderInstance/renderProbeMgr.h index 4f64eaf95..94b8f7167 100644 --- a/Engine/source/renderInstance/renderProbeMgr.h +++ b/Engine/source/renderInstance/renderProbeMgr.h @@ -357,6 +357,7 @@ public: /// static bool smRenderReflectionProbes; + static bool smBakeReflectionProbes; //============================================================================= // Utility functions for processing and setting up the probes for rendering //============================================================================= diff --git a/Engine/source/scene/reflector.cpp b/Engine/source/scene/reflector.cpp index 09c03e426..7117bc8ff 100644 --- a/Engine/source/scene/reflector.cpp +++ b/Engine/source/scene/reflector.cpp @@ -355,6 +355,9 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx, Point3 // store current matrices GFXTransformSaver saver; + F32 detailAdjustBackup = TSShapeInstance::smDetailAdjust; + TSShapeInstance::smDetailAdjust *= mDesc->detailAdjust; + // set projection to 90 degrees vertical and horizontal F32 left, right, top, bottom; MathUtils::makeFrustum( &left, &right, &top, &bottom, M_HALFPI_F, 1.0f, mDesc->nearDist ); @@ -437,6 +440,7 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx, Point3 // Clean up. mRenderTarget->resolve(); + TSShapeInstance::smDetailAdjust = detailAdjustBackup; } F32 CubeReflector::calcFaceScore( const ReflectParams ¶ms, U32 faceidx ) diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 2b9610d5d..57bb9760b 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -320,7 +320,7 @@ struct SceneRayHelper RayInfo ri; ri.generateTexCoord = info->generateTexCoord; - if (mFunc && !mFunc(&ri)) + if (mFunc && !mFunc(ptr)) return false; bool result = false; diff --git a/Engine/source/scene/sceneContainer.h b/Engine/source/scene/sceneContainer.h index ce6f6a023..57fc211de 100644 --- a/Engine/source/scene/sceneContainer.h +++ b/Engine/source/scene/sceneContainer.h @@ -668,7 +668,8 @@ class SceneContainer /// @name Line intersection /// @{ - typedef bool ( *CastRayCallback )( RayInfo* ri ); + + typedef bool ( *CastRayCallback )( SceneObject* object ); /// Test against collision geometry -- fast. bool castRay( const Point3F &start, const Point3F &end, U32 mask, RayInfo* info, CastRayCallback callback = NULL ); diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index 56dc76b2d..7b48addec 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -754,6 +754,7 @@ class SceneObject : public NetObject, public ProcessObject static bool _setGameObject(void* object, const char* index, const char* data); DECLARE_CONOBJECT( SceneObject ); + DECLARE_CATEGORY("MISC"); private: SceneObject( const SceneObject& ); ///< @deprecated disallowed diff --git a/Engine/source/scene/simPath.h b/Engine/source/scene/simPath.h index 153acf7b5..b4a6395d7 100644 --- a/Engine/source/scene/simPath.h +++ b/Engine/source/scene/simPath.h @@ -84,6 +84,7 @@ class Path : public GameBase U32 getPathIndex() const; DECLARE_CONOBJECT(Path); + DECLARE_CATEGORY("Cinematic"); static void initPersistFields(); DECLARE_CALLBACK(void, onAdd, (SimObjectId ID)); }; @@ -151,6 +152,7 @@ class Marker : public SceneObject ~Marker(); DECLARE_CONOBJECT(Marker); + DECLARE_CATEGORY("Cinematic"); static void initPersistFields(); void inspectPostApply(); diff --git a/Engine/source/sfx/sfxController.cpp b/Engine/source/sfx/sfxController.cpp index 0de38ad39..2e1c71b7f 100644 --- a/Engine/source/sfx/sfxController.cpp +++ b/Engine/source/sfx/sfxController.cpp @@ -167,7 +167,7 @@ void SFXController::_compileList( SFXPlayList* playList ) // If there's no track in this slot, ignore it. - if( !playList->getTrackProfile(slotIndex)) + if( !playList->getSlots().mTrack[slotIndex]) continue; // If this is a looped slot and the list is not set to loop @@ -394,7 +394,13 @@ bool SFXController::_execInsn() case OP_Play: { SFXPlayList* playList = getPlayList(); - SFXTrack* track = playList->getTrackProfile(insn.mSlotIndex); + if (playList == NULL) + { + endUpdate = true; + break; + } + + SFXTrack* track = playList->getSlots().mTrack[insn.mSlotIndex]; // Handle existing sources playing on this slot and find // whether we need to start a new source. @@ -817,6 +823,9 @@ void SFXController::_update() SFXPlayList* playList = getPlayList(); + if (!playList) + Parent::stop(); + // Check all sources against the current state setup and // take appropriate actions. diff --git a/Engine/source/sfx/sfxMemoryStream.cpp b/Engine/source/sfx/sfxMemoryStream.cpp index 6dcdbc60c..e2cd2feff 100644 --- a/Engine/source/sfx/sfxMemoryStream.cpp +++ b/Engine/source/sfx/sfxMemoryStream.cpp @@ -39,9 +39,10 @@ SFXMemoryStream::SFXMemoryStream( const SFXFormat& format, void SFXMemoryStream::reset() { - if( dynamic_cast< IResettable* >( getSourceStream() ) ) + IResettable* rStream = dynamic_cast(getSourceStream()); + if(rStream ) { - reinterpret_cast< IResettable* >( getSourceStream() )->reset(); + rStream->reset(); if( mCurrentPacket ) destructSingle( mCurrentPacket ); diff --git a/Engine/source/sfx/sfxPlayList.cpp b/Engine/source/sfx/sfxPlayList.cpp index 4cc6a56e3..b763e4a14 100644 --- a/Engine/source/sfx/sfxPlayList.cpp +++ b/Engine/source/sfx/sfxPlayList.cpp @@ -23,6 +23,7 @@ #include "sfx/sfxPlayList.h" #include "sfx/sfxState.h" #include "sfx/sfxTypes.h" +#include "sfx/sfxDescription.h" #include "core/stream/bitStream.h" #include "math/mRandom.h" #include "math/mathTypes.h" @@ -218,10 +219,23 @@ SFXPlayList::SFXPlayList() : mRandomMode( RANDOM_NotRandom ), mLoopMode( LOOP_All ), mTrace( false ), - mNumSlotsToPlay( NUM_SLOTS ) + mNumSlotsToPlay( NUM_SLOTS ), + mActiveSlots(12) { - for (U32 i=0;iisTempClone()) + { + delete mDescription; + mDescription = 0; + } } //----------------------------------------------------------------------------- @@ -250,10 +264,10 @@ void SFXPlayList::initPersistFields() addArray( "slots", NUM_SLOTS ); - INITPERSISTFIELD_SOUNDASSET_ARRAY( Track, NUM_SLOTS, SFXPlayList, + addField("track", TypeSFXTrackName, Offset(mSlots.mTrack, SFXPlayList), NUM_SLOTS, "Track to play in this slot.\n" "This must be set for the slot to be considered for playback. Other settings for a slot " - "will not take effect except this field is set." ); + "will not take effect except this field is set."); addField( "replay", TYPEID< EReplayMode >(), Offset( mSlots.mReplayMode, SFXPlayList ), NUM_SLOTS, "Behavior when an already playing sound is encountered on this slot from a previous cycle.\n" "Each slot can have an arbitrary number of sounds playing on it from previous cycles. This field determines " @@ -340,32 +354,64 @@ void SFXPlayList::initPersistFields() //----------------------------------------------------------------------------- +U32 SFXPlayList::getNumSlots() +{ + U32 trackCount = 0; + for (U32 i = 0; i < NUM_SLOTS; i++) + { + if (mSlots.mTrack[i] == NULL) + { + return i; + } + trackCount++; + } + + return trackCount; +} + +bool SFXPlayList::isLooping() const +{ + // pretty useless in playlist, looping handled differently. + return false; +} + +bool SFXPlayList::onAdd() +{ + if (!Parent::onAdd()) + return false; + + mActiveSlots = getNumSlots(); + + validate(); + + return true; +} + +void SFXPlayList::onRemove() +{ + Parent::onRemove(); +} + bool SFXPlayList::preload( bool server, String& errorStr ) { if( !Parent::preload( server, errorStr ) ) return false; + + mActiveSlots = getNumSlots(); validate(); // Resolve SFXTracks and SFXStates on client. - + if( !server ) { - for( U32 i = 0; i < NUM_SLOTS; ++ i ) + for( U32 i = 0; i < mActiveSlots; ++ i ) { - StringTableEntry track = getTrack(i); - if (track != StringTable->EmptyString()) - { - _setTrack(getTrack(i), i); - if (!getTrackProfile(i)) - { - Con::errorf("SFXPlayList::Preload() - unable to find sfxProfile for asset %s", mTrackAssetId[i]); + if (!sfxResolve(&mSlots.mTrack[i], errorStr)) return false; - } - if (!sfxResolve(&mSlots.mState[i], errorStr)) + if (!sfxResolve(&mSlots.mState[i], errorStr)) return false; - } } } @@ -382,55 +428,57 @@ void SFXPlayList::packData( BitStream* stream ) stream->writeInt( mLoopMode, NUM_LOOP_MODE_BITS ); stream->writeInt( mNumSlotsToPlay, NUM_SLOTS_TO_PLAY_BITS ); - #define FOR_EACH_SLOT \ - for( U32 i = 0; i < NUM_SLOTS; ++ i ) - - FOR_EACH_SLOT stream->writeInt( mSlots.mReplayMode[ i ], NUM_REPLAY_MODE_BITS ); - FOR_EACH_SLOT stream->writeInt( mSlots.mTransitionIn[ i ], NUM_TRANSITION_MODE_BITS ); - FOR_EACH_SLOT stream->writeInt( mSlots.mTransitionOut[ i ], NUM_TRANSITION_MODE_BITS ); - FOR_EACH_SLOT stream->writeInt( mSlots.mStateMode[ i ], NUM_STATE_MODE_BITS ); - - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeIn.mValue[ i ] != -1 )) - stream->write( mSlots.mFadeTimeIn.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] > 0)) - stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] ); - FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] > 0)) - stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mValue[ i ] != -1 )) - stream->write( mSlots.mFadeTimeOut.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][0] > 0)) - stream->write(mSlots.mFadeTimeOut.mVariance[i][0]); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][1] > 0)) - stream->write(mSlots.mFadeTimeOut.mVariance[i][1]); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mValue[ i ] > 0)) - stream->write(mSlots.mDelayTimeIn.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] > 0)) - stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] > 0)) - stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mValue[ i ] > 0)) - stream->write(mSlots.mDelayTimeOut.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] > 0)) - stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] > 0)) - stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mValue[ i ] != 1)) - stream->write(mSlots.mVolumeScale.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 0 ] > 0)) - stream->write(mSlots.mVolumeScale.mVariance[ i ][ 0 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 1 ] > 0)) - stream->write(mSlots.mVolumeScale.mVariance[ i ][ 1 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mValue[ i ] != 1)) - stream->write(mSlots.mPitchScale.mValue[ i ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 0 ] > 0)) - stream->write(mSlots.mPitchScale.mVariance[ i ][ 0 ] ); - FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 1 ] > 0)) - stream->write(mSlots.mPitchScale.mVariance[ i ][ 1 ] ); - FOR_EACH_SLOT if (stream->writeFlag( mSlots.mRepeatCount[ i ] > 0)) - stream->write( mSlots.mRepeatCount[ i ] ); - - FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] ); - FOR_EACH_SLOT PACKDATA_SOUNDASSET_ARRAY(Track, i); + stream->writeInt(mActiveSlots, 8); + + for (U32 i = 0; i < mActiveSlots; ++i) + { + stream->writeInt(mSlots.mReplayMode[i], NUM_REPLAY_MODE_BITS); + stream->writeInt(mSlots.mTransitionIn[i], NUM_TRANSITION_MODE_BITS); + stream->writeInt(mSlots.mTransitionOut[i], NUM_TRANSITION_MODE_BITS); + stream->writeInt(mSlots.mStateMode[i], NUM_STATE_MODE_BITS); + + if (stream->writeFlag(mSlots.mFadeTimeIn.mValue[i] != -1)) + stream->write(mSlots.mFadeTimeIn.mValue[i]); + if (stream->writeFlag(mSlots.mFadeTimeIn.mVariance[i][0] > 0)) + stream->write(mSlots.mFadeTimeIn.mVariance[i][0]); + if (stream->writeFlag(mSlots.mFadeTimeIn.mVariance[i][1] > 0)) + stream->write(mSlots.mFadeTimeIn.mVariance[i][1]); + if (stream->writeFlag(mSlots.mFadeTimeOut.mValue[i] != -1)) + stream->write(mSlots.mFadeTimeOut.mValue[i]); + if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][0] > 0)) + stream->write(mSlots.mFadeTimeOut.mVariance[i][0]); + if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][1] > 0)) + stream->write(mSlots.mFadeTimeOut.mVariance[i][1]); + if (stream->writeFlag(mSlots.mDelayTimeIn.mValue[i] > 0)) + stream->write(mSlots.mDelayTimeIn.mValue[i]); + if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[i][0] > 0)) + stream->write(mSlots.mDelayTimeIn.mVariance[i][0]); + if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[i][1] > 0)) + stream->write(mSlots.mDelayTimeIn.mVariance[i][1]); + if (stream->writeFlag(mSlots.mDelayTimeOut.mValue[i] > 0)) + stream->write(mSlots.mDelayTimeOut.mValue[i]); + if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[i][0] > 0)) + stream->write(mSlots.mDelayTimeOut.mVariance[i][0]); + if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[i][1] > 0)) + stream->write(mSlots.mDelayTimeOut.mVariance[i][1]); + if (stream->writeFlag(mSlots.mVolumeScale.mValue[i] != 1)) + stream->write(mSlots.mVolumeScale.mValue[i]); + if (stream->writeFlag(mSlots.mVolumeScale.mVariance[i][0] > 0)) + stream->write(mSlots.mVolumeScale.mVariance[i][0]); + if (stream->writeFlag(mSlots.mVolumeScale.mVariance[i][1] > 0)) + stream->write(mSlots.mVolumeScale.mVariance[i][1]); + if (stream->writeFlag(mSlots.mPitchScale.mValue[i] != 1)) + stream->write(mSlots.mPitchScale.mValue[i]); + if (stream->writeFlag(mSlots.mPitchScale.mVariance[i][0] > 0)) + stream->write(mSlots.mPitchScale.mVariance[i][0]); + if (stream->writeFlag(mSlots.mPitchScale.mVariance[i][1] > 0)) + stream->write(mSlots.mPitchScale.mVariance[i][1]); + if (stream->writeFlag(mSlots.mRepeatCount[i] > 0)) + stream->write(mSlots.mRepeatCount[i]); + + sfxWrite(stream, mSlots.mState[i]); + sfxWrite(stream, mSlots.mTrack[i]); + } } //----------------------------------------------------------------------------- @@ -442,36 +490,39 @@ void SFXPlayList::unpackData( BitStream* stream ) mRandomMode = ( ERandomMode ) stream->readInt( NUM_RANDOM_MODE_BITS ); mLoopMode = ( ELoopMode ) stream->readInt( NUM_LOOP_MODE_BITS ); mNumSlotsToPlay = stream->readInt( NUM_SLOTS_TO_PLAY_BITS ); - - FOR_EACH_SLOT mSlots.mReplayMode[ i ] = ( EReplayMode ) stream->readInt( NUM_REPLAY_MODE_BITS ); - FOR_EACH_SLOT mSlots.mTransitionIn[ i ] = ( ETransitionMode ) stream->readInt( NUM_TRANSITION_MODE_BITS ); - FOR_EACH_SLOT mSlots.mTransitionOut[ i ] = ( ETransitionMode ) stream->readInt( NUM_TRANSITION_MODE_BITS ); - FOR_EACH_SLOT mSlots.mStateMode[ i ] = ( EStateMode ) stream->readInt( NUM_STATE_MODE_BITS ); - - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mValue[ i ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 0 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 1 ] );} - FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );} - - FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] ); - FOR_EACH_SLOT UNPACKDATA_SOUNDASSET_ARRAY(Track, i); - - #undef FOR_EACH_SLOT + + mActiveSlots = stream->readInt(8); + + for (U32 i = 0; i < mActiveSlots; ++i) + { + mSlots.mReplayMode[i] = (EReplayMode)stream->readInt(NUM_REPLAY_MODE_BITS); + mSlots.mTransitionIn[i] = (ETransitionMode)stream->readInt(NUM_TRANSITION_MODE_BITS); + mSlots.mTransitionOut[i] = (ETransitionMode)stream->readInt(NUM_TRANSITION_MODE_BITS); + mSlots.mStateMode[i] = (EStateMode)stream->readInt(NUM_STATE_MODE_BITS); + + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeIn.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeIn.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeIn.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeOut.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeOut.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mFadeTimeOut.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeIn.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeIn.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeIn.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeOut.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeOut.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mDelayTimeOut.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mVolumeScale.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mVolumeScale.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mVolumeScale.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mPitchScale.mValue[i]); } + if (stream->readFlag()) { stream->read(&mSlots.mPitchScale.mVariance[i][0]); } + if (stream->readFlag()) { stream->read(&mSlots.mPitchScale.mVariance[i][1]); } + if (stream->readFlag()) { stream->read(&mSlots.mRepeatCount[i]); } + + sfxRead(stream, &mSlots.mState[i]); + sfxRead(stream, &mSlots.mTrack[i]); + } } //----------------------------------------------------------------------------- @@ -486,8 +537,8 @@ void SFXPlayList::inspectPostApply() void SFXPlayList::validate() { - if( mNumSlotsToPlay > NUM_SLOTS ) - mNumSlotsToPlay = NUM_SLOTS; + if( mNumSlotsToPlay > mActiveSlots ) + mNumSlotsToPlay = mActiveSlots; mSlots.mFadeTimeIn.validate(); mSlots.mFadeTimeOut.validate(); diff --git a/Engine/source/sfx/sfxPlayList.h b/Engine/source/sfx/sfxPlayList.h index 1043bf988..8fa0df89c 100644 --- a/Engine/source/sfx/sfxPlayList.h +++ b/Engine/source/sfx/sfxPlayList.h @@ -30,13 +30,8 @@ #include "sfx/sfxTrack.h" #endif -#ifndef SOUND_ASSET_H -#include "T3D/assets/SoundAsset.h" -#endif - - class SFXState; - +class SFXDescription; /// A playback list of SFXTracks. /// @@ -79,7 +74,7 @@ class SFXPlayList : public SFXTrack typedef SFXTrack Parent; - enum + enum SFXPlaylistSettings { /// Number of slots in a playlist. /// @@ -261,6 +256,9 @@ class SFXPlayList : public SFXTrack /// is playing. EStateMode mStateMode[ NUM_SLOTS ]; + /// Track to play in this slot. + SFXTrack* mTrack[NUM_SLOTS]; + SlotData() { dMemset( mReplayMode, 0, sizeof( mReplayMode ) ); @@ -268,6 +266,7 @@ class SFXPlayList : public SFXTrack dMemset( mTransitionOut, 0, sizeof( mTransitionOut ) ); dMemset( mRepeatCount, 0, sizeof( mRepeatCount ) ); dMemset( mState, 0, sizeof( mState ) ); + dMemset( mTrack, 0, sizeof( mTrack ) ); dMemset( mStateMode, 0, sizeof( mStateMode ) ); for( U32 i = 0; i < NUM_SLOTS; ++ i ) @@ -282,31 +281,33 @@ class SFXPlayList : public SFXTrack } } }; - DECLARE_SOUNDASSET_ARRAY(SFXPlayList, Track, NUM_SLOTS); - DECLARE_ASSET_ARRAY_SETGET(SFXPlayList, Track); - protected: - + public: + // moved to public for soundasset + /// Trace interpreter execution. This field is not networked. bool mTrace; - + /// Select slots at random. ERandomMode mRandomMode; - + /// Loop over slots in this list. ELoopMode mLoopMode; - + /// Number of slots to play from list. This can be used, for example, /// to create a list of tracks where only a single track is selected and /// played for each cycle. U32 mNumSlotsToPlay; - + /// Data for each of the playlist slots. SlotData mSlots; - - public: - + + U32 mActiveSlots; + SFXPlayList(); + + /// The destructor. + virtual ~SFXPlayList(); /// Make all settings conform to constraints. void validate(); @@ -324,7 +325,7 @@ class SFXPlayList : public SFXTrack ELoopMode getLoopMode() const { return mLoopMode; } /// Return the total number of slots in the list. - U32 getNumSlots() const { return NUM_SLOTS; } + U32 getNumSlots(); /// Return the slot data for this list. const SlotData& getSlots() const { return mSlots; } @@ -332,8 +333,13 @@ class SFXPlayList : public SFXTrack DECLARE_CONOBJECT( SFXPlayList ); DECLARE_CATEGORY( "SFX" ); DECLARE_DESCRIPTION( "A playback list of SFXProfiles or nested SFXPlayLists." ); - + + // SFXTrack. + virtual bool isLooping() const; + // SimDataBlock. + bool onAdd(); + void onRemove(); virtual bool preload( bool server, String& errorStr ); virtual void packData( BitStream* stream ); virtual void unpackData( BitStream* stream ); diff --git a/Engine/source/sfx/sfxSound.h b/Engine/source/sfx/sfxSound.h index 364f2ed59..7494e3846 100644 --- a/Engine/source/sfx/sfxSound.h +++ b/Engine/source/sfx/sfxSound.h @@ -143,7 +143,7 @@ class SFXSound : public SFXSource, bool isBlocked() const { return ( mVoice && mVoice->getStatus() == SFXStatusBlocked ); } /// Returns true if this is a continuously streaming source. - bool isStreaming() const { return mDescription->mIsStreaming; } + bool isStreaming() const { return mDescription ? mDescription->mIsStreaming : false; } /// Returns true if the source's associated data is ready for playback. bool isReady() const; diff --git a/Engine/source/sfx/sfxSource.cpp b/Engine/source/sfx/sfxSource.cpp index 51e09d795..4a1765c53 100644 --- a/Engine/source/sfx/sfxSource.cpp +++ b/Engine/source/sfx/sfxSource.cpp @@ -192,18 +192,18 @@ SFXSource::SFXSource() mSavedStatus( SFXStatusNull ), mStatusCallback( NULL ), mDescription( NULL ), - mVolume( 1.f ), - mPreFadeVolume( 1.f ), - mFadedVolume( 1.f ), - mModulativeVolume( 1.f ), - mPreAttenuatedVolume( 1.f ), - mAttenuatedVolume( 1.f ), + mVolume( 1.0f ), + mPreFadeVolume( 1.0f ), + mFadedVolume( 1.0f ), + mModulativeVolume( 1.0f ), + mPreAttenuatedVolume( 1.0f ), + mAttenuatedVolume( 1.0f ), mPriority( 0 ), - mModulativePriority( 1.f ), + mModulativePriority( 1.0f ), mEffectivePriority( 0 ), mPitch( 1.f ), - mModulativePitch( 1.f ), - mEffectivePitch( 1.f ), + mModulativePitch( 1.0f ), + mEffectivePitch( 1.0f ), mTransform( true ), mVelocity( 0, 0, 0 ), mMinDistance( 1 ), @@ -213,14 +213,14 @@ SFXSource::SFXSource() mConeOutsideVolume( 1 ), mDistToListener( 0.f ), mTransformScattered( false ), - mFadeInTime( 0.f ), - mFadeOutTime( 0.f ), - mFadeInPoint( -1.f ), - mFadeOutPoint( -1.f ), + mFadeInTime( 0.0f ), + mFadeOutTime( 0.0f ), + mFadeInPoint( -1.0f ), + mFadeOutPoint( -1.0f ), mFadeSegmentType( FadeSegmentNone ), mFadeSegmentEase( NULL ), - mFadeSegmentStartPoint( 0.f ), - mFadeSegmentEndPoint( 0.f ), + mFadeSegmentStartPoint( 0.0f ), + mFadeSegmentEndPoint( 0.0f ), mSavedFadeTime( -1.f ), mPlayStartTick( 0 ) { @@ -236,17 +236,17 @@ SFXSource::SFXSource( SFXTrack* track, SFXDescription* description ) mTrack( track ), mDescription( description ), mVolume( 1.f ), - mPreFadeVolume( 1.f ), - mFadedVolume( 1.f ), - mModulativeVolume( 1.f ), - mPreAttenuatedVolume( 1.f ), - mAttenuatedVolume( 1.f ), + mPreFadeVolume( 1.0f ), + mFadedVolume( 1.0f ), + mModulativeVolume( 1.0f ), + mPreAttenuatedVolume( 1.0f ), + mAttenuatedVolume( 1.0f ), mPriority( 0 ), - mModulativePriority( 1.f ), + mModulativePriority( 1.0f ), mEffectivePriority( 0 ), - mPitch( 1.f ), - mModulativePitch( 1.f ), - mEffectivePitch( 1.f ), + mPitch( 1.0f ), + mModulativePitch( 1.0f ), + mEffectivePitch( 1.0f ), mTransform( true ), mVelocity( 0, 0, 0 ), mMinDistance( 1 ), @@ -256,15 +256,15 @@ SFXSource::SFXSource( SFXTrack* track, SFXDescription* description ) mConeOutsideVolume( 1 ), mDistToListener( 0.f ), mTransformScattered( false ), - mFadeInTime( 0.f ), - mFadeOutTime( 0.f ), - mFadeInPoint( -1.f ), - mFadeOutPoint( -1.f ), + mFadeInTime( 0.0f ), + mFadeOutTime( 0.0f ), + mFadeInPoint( -1.0f ), + mFadeOutPoint( -1.0f ), mFadeSegmentType( FadeSegmentNone ), mFadeSegmentEase( NULL ), - mFadeSegmentStartPoint( 0.f ), - mFadeSegmentEndPoint( 0.f ), - mSavedFadeTime( -1.f ), + mFadeSegmentStartPoint( 0.0f ), + mFadeSegmentEndPoint( 0.0f ), + mSavedFadeTime( -1.0f ), mPlayStartTick( 0 ) { VECTOR_SET_ASSOCIATION( mParameters ); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 19e56315d..2e9c3b0e7 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -729,7 +729,8 @@ bool ActionMap::nextBoundNode( const char* function, U32 &devMapIndex, U32 &node for ( U32 j = nodeIndex; j < dvcMap->nodeMap.size(); j++ ) { const Node* node = &dvcMap->nodeMap[j]; - if ( !( node->flags & Node::BindCmd ) && ( dStricmp( function, node->consoleFunction ) == 0 ) ) + if ( ( (node->flags & Node::BindCmd) && (dStricmp(function, node->makeConsoleCommand) == 0 || dStricmp(function, node->breakConsoleCommand) == 0) ) + || (!(node->flags & Node::BindCmd) && dStricmp( function, node->consoleFunction ) == 0 ) ) { devMapIndex = i; nodeIndex = j; @@ -1805,6 +1806,7 @@ bool ActionMap::handleEvent(const InputEventInfo* pEvent) for (SimSet::iterator itr = pActionMapSet->end() - 1; itr > pActionMapSet->begin(); itr--) { ActionMap* pMap = static_cast(*itr); + if (pMap->processAction(pEvent) == true) return true; } diff --git a/Engine/source/terrain/terrData.h b/Engine/source/terrain/terrData.h index de6f90488..8eeb79d12 100644 --- a/Engine/source/terrain/terrData.h +++ b/Engine/source/terrain/terrData.h @@ -488,6 +488,7 @@ public: DECLARE_CONOBJECT(TerrainBlock); + DECLARE_CATEGORY("Environment \t BackGround"); static void initPersistFields(); U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream); diff --git a/README.md b/README.md index 93aeeed6c..275f4e61f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ MIT Licensed Open Source version of [Torque3D](https://torque3d.org) from [Garag * [Community forum](https://torque3d.org/forums) * [Roadmap](https://github.com/orgs/TorqueGameEngines/projects/1) * [Binaries](https://github.com/TorqueGameEngines/Torque3D-Binaries) -* [Guide Docs](https://torque3d.org/docs/t3d/) +* [Guide Docs](https://docs.torque3d.org/) * [Reference Docs](https://reference.torque3d.org/) * [Work Blog](https://torque3d.org/blogs/blog/1-work-blog/) diff --git a/Templates/BaseGame/CMakeLists.txt b/Templates/BaseGame/CMakeLists.txt index fb5fea3e1..95bb0a42d 100644 --- a/Templates/BaseGame/CMakeLists.txt +++ b/Templates/BaseGame/CMakeLists.txt @@ -4,8 +4,15 @@ foreach(TEMPLATE_FILE ${TEMPLATE_FILES}) endforeach() # Perform installation minus scripts -file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE PATTERN - PATTERN "*.in" EXCLUDE PATTERN) +if(WIN32) + file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE + PATTERN "*.in" EXCLUDE) +else() + file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE + PATTERN "*.in" EXCLUDE + PATTERN "*.dll" EXCLUDE) +endif(WIN32) + # Enumerate scripts and install with extension file(GLOB_RECURSE SCRIPT_FILES "game/*.tscript") foreach(ITEM ${SCRIPT_FILES}) diff --git a/Templates/BaseGame/game/D3DCompiler_47.dll b/Templates/BaseGame/game/D3DCompiler_47.dll new file mode 100644 index 000000000..e61c5aea8 Binary files /dev/null and b/Templates/BaseGame/game/D3DCompiler_47.dll differ diff --git a/Templates/BaseGame/game/core/console/scripts/profiles.tscript b/Templates/BaseGame/game/core/console/scripts/profiles.tscript index 097ae7da6..98a407643 100644 --- a/Templates/BaseGame/game/core/console/scripts/profiles.tscript +++ b/Templates/BaseGame/game/core/console/scripts/profiles.tscript @@ -52,7 +52,7 @@ new GuiControlProfile(GuiConsoleTextProfile) category = "Core"; }; -$ConsoleDefaultFillColor = "12 14 19 175"; +$ConsoleDefaultFillColor = "0 0 0 175"; if(!isObject(ConsoleScrollProfile)) new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile) diff --git a/Templates/BaseGame/game/core/gui/scripts/canvas.tscript b/Templates/BaseGame/game/core/gui/scripts/canvas.tscript index 79988556d..8d6a0d98b 100644 --- a/Templates/BaseGame/game/core/gui/scripts/canvas.tscript +++ b/Templates/BaseGame/game/core/gui/scripts/canvas.tscript @@ -94,7 +94,7 @@ function configureCanvas() if ($pref::Video::deviceMode != $Video::ModeFullscreen) $pref::Video::FullScreen = false; %modeStr = Canvas.prefsToModeStr(); - + echo("--------------"); echo("Attempting to set resolution to \"" @ %modeStr @ "\""); diff --git a/Templates/BaseGame/game/core/gui/scripts/profiles.tscript b/Templates/BaseGame/game/core/gui/scripts/profiles.tscript index 199d943eb..fe02febfa 100644 --- a/Templates/BaseGame/game/core/gui/scripts/profiles.tscript +++ b/Templates/BaseGame/game/core/gui/scripts/profiles.tscript @@ -147,25 +147,31 @@ new GuiControlProfile(GuiTextEditProfile) category = "Core"; }; -if(!isObject(GuiMenuScrollProfile)) -new GuiControlProfile(GuiMenuScrollProfile) +if(!isObject(GuiScrollProfile)) +new GuiControlProfile(GuiScrollProfile) { - opaque = true; - fontColor = $TextMediumEmphasisColor; - fontColorHL = $TextMediumEmphasisColor; - fontColorNA = $TextDisabledColor; - fontColorSEL = $TextMediumEmphasisColor; - fillColor = "40 40 40"; + opaque = "0"; + fontColor = "200 200 200 255"; + fontColorHL = "200 200 200 255"; + fontColorNA = "108 108 108 255"; + fontColorSEL = "200 200 200 255"; + fillColor = "0 0 0 0"; fillColorHL = "56 56 56"; fillColorNA = "40 40 40"; borderColor = "87 87 87"; borderColorNA = "0 0 0"; borderColorHL = "255 255 255"; - border = true; + border = "0"; bitmapAsset = "Core_GUI:scrollBar_image"; hasBitmapArray = true; category = "Core"; fontSize = 15; + fontColors[0] = "200 200 200 255"; + fontColors[1] = "200 200 200 255"; + fontColors[2] = "108 108 108 255"; + fontColors[3] = "200 200 200 255"; + fontColors[8] = "Fuchsia"; + fontColors[9] = "255 0 255 255"; }; if(!isObject(GuiOverlayProfile)) @@ -261,3 +267,24 @@ new GuiControlProfile(GuiScrollProfile) bitmapAsset = "Core_GUI:scrollBar_image"; category = "Core"; }; + +// --------------------------------------------------------------------------- +singleton GuiControlProfile( GuiInputCtrlProfile ) +{ + tab = true; + canKeyFocus = true; + category = "Core"; +}; + +singleton GuiControlProfile (GuiTextProfile) +{ + justify = "left"; + fontColor = "20 20 20"; + category = "Core"; +}; + +singleton GuiControlProfile (GuiTextRightProfile : GuiTextProfile) +{ + justify = "right"; + category = "Core"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript b/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript index a3c459e6f..b15f48d61 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/HDR/HDRPostFX.tscript @@ -26,11 +26,7 @@ $PostFX::HDRPostFX::enableToneMapping = 0.5; /// The tone mapping middle grey or exposure value used /// to adjust the overall "balance" of the image. -/// -/// 0.18 is fairly common value. -/// - -$PostFX::HDRPostFX::keyValue = 0.115; +$PostFX::HDRPostFX::keyValue = 0.5; //Explicit HDR Params diff --git a/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript b/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript index 19b7f50cd..450be2512 100644 --- a/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript +++ b/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript @@ -1,4 +1,4 @@ -function GraphicsQualityLevel::isCurrent( %this ) +function OptionsQualityLevel::isCurrent( %this ) { // Test each pref to see if the current value // equals our stored value. @@ -9,13 +9,14 @@ function GraphicsQualityLevel::isCurrent( %this ) %value = %this.getValue( %i ); if ( getVariable( %pref ) !$= %value ) + { return false; + } } - return true; } -function GraphicsQualityLevel::apply( %this ) +function OptionsQualityLevel::apply( %this ) { for ( %i=0; %i < %this.count(); %i++ ) { @@ -36,7 +37,7 @@ function GraphicsQualityLevel::apply( %this ) } } -function GraphicsOptionsMenuGroup::applySetting(%this, %settingName) +function OptionsSettings::applySetting(%this, %settingName) { for(%i=0; %i < %this.getCount(); %i++) { @@ -54,573 +55,1119 @@ function GraphicsOptionsMenuGroup::applySetting(%this, %settingName) } } -new SimGroup( MeshQualityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; +//Primary Group(Video, Audio, Controls) +//Sub Grouping(Basic, Advanced, or Display, Graphics) + +new SimGroup(VideoSettingsGroup) +{ + class = "PrimaryOptionsGroup"; + displayName = "Video"; - new ArrayObject() + new SimGroup(VideoDisplaySettingsGroup) { - class = "GraphicsQualityLevel"; - caseSensitive = true; + class = "SubOptionsGroup"; + displayName = "Display Settings"; - displayName = "High"; - - key["$pref::TS::detailAdjust"] = 1.5; - key["$pref::TS::skipRenderDLs"] = 0; - }; - new ArrayObject( ) - { - class = "GraphicsQualityLevel"; - caseSensitive = true; + new SimGroup( VideoAPISettingsGroup ) + { + class = "OptionsSettings"; + OptionName = "Display API"; + requiresRestart = true; + }; - displayName = "Medium"; + new SimGroup( DisplayDevicesGroup ) + { + class = "OptionsSettings"; + OptionName = "Display Devices"; + }; + + new SimGroup( DisplayModeGroup ) + { + class = "OptionsSettings"; + OptionName = "Display Mode"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Windowed"; - key["$pref::TS::detailAdjust"] = 1.0; - key["$pref::TS::skipRenderDLs"] = 0; + key["$pref::Video::deviceMode"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Borderless"; + + key["$pref::Video::deviceMode"] = 1; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Fullscreen"; + + key["$pref::Video::deviceMode"] = 2; + }; + }; + + new SimGroup ( DisplayResSettingsGroup ) + { + class = "OptionsSettings"; + OptionName = "Display Resolution"; + }; + + new SimGroup ( VSyncSettingsGroup ) + { + class = "OptionsSettings"; + OptionName = "VSync"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::Video::enableVerticalSync"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::Video::enableVerticalSync"] = 1; + }; + }; + + new SimGroup ( DisplayRefreshSettingsGroup ) + { + class = "OptionsSettings"; + OptionName = "Refresh Rate"; + }; }; - new ArrayObject() + + //General quality settings + new SimGroup() { - class = "GraphicsQualityLevel"; - caseSensitive = true; + class = "SubOptionsGroup"; + displayName = "Object Quality"; - displayName = "Low"; + new SimGroup( MeshDetailSettingsGroup ) + { + class = "OptionsSettings"; + + OptionName = "Mesh Detail"; + Description = "Controls the max quality of mesh objects"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; - key["$pref::TS::detailAdjust"] = 0.75; - key["$pref::TS::skipRenderDLs"] = 0; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::TS::detailAdjust"] = 0.5; - key["$pref::TS::skipRenderDLs"] = 1; - }; -}; - -new SimGroup( MeshDrawDistQualityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::useStaticObjectFade"] = false; - key["$pref::staticObjectFadeStart"] = 75; - key["$pref::staticObjectFadeEnd"] = 100; - key["$pref::staticObjectUnfadeableSize"] = 75; - - }; - new ArrayObject( ) - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::useStaticObjectFade"] = true; - key["$pref::staticObjectFadeStart"] = 75; - key["$pref::staticObjectFadeEnd"] = 100; - key["$pref::staticObjectUnfadeableSize"] = 75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + displayName = "Lowest"; - key["$pref::useStaticObjectFade"] = true; - key["$pref::staticObjectFadeStart"] = 50; - key["$pref::staticObjectFadeEnd"] = 75; - key["$pref::staticObjectUnfadeableSize"] = 100; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::useStaticObjectFade"] = true; - key["$pref::staticObjectFadeStart"] = 25; - key["$pref::staticObjectFadeEnd"] = 50; - key["$pref::staticObjectUnfadeableSize"] = 200; - }; -}; - -new SimGroup( TextureQualityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::Video::textureReductionLevel"] = 0; - key["$pref::Reflect::refractTexScale"] = 1.25; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::Video::textureReductionLevel"] = 0; - key["$pref::Reflect::refractTexScale"] = 1; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + key["$pref::TS::detailAdjust"] = 0.5; + key["$pref::TS::skipRenderDLs"] = 1; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; - key["$pref::Video::textureReductionLevel"] = 1; - key["$pref::Reflect::refractTexScale"] = 0.75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::Video::textureReductionLevel"] = 2; - key["$pref::Reflect::refractTexScale"] = 0.5; - }; -}; - -new SimGroup( GroundCoverDensityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::GroundCover::densityScale"] = 1.0; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::GroundCover::densityScale"] = 0.75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + displayName = "Low"; + + key["$pref::TS::detailAdjust"] = 0.75; + key["$pref::TS::skipRenderDLs"] = 0; + }; + new ArrayObject( ) + { + class = "OptionsQualityLevel"; + caseSensitive = true; - key["$pref::GroundCover::densityScale"] = 0.5; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; + displayName = "Medium"; - key["$pref::GroundCover::densityScale"] = 0.25; - }; -}; - -new SimGroup( DecalLifetimeGroup ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::decalMgr::enabled"] = true; - key["$pref::Decals::lifeTimeScale"] = 1; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::decalMgr::enabled"] = true; - key["$pref::Decals::lifeTimeScale"] = 0.5; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; - - key["$pref::decalMgr::enabled"] = true; - key["$pref::Decals::lifeTimeScale"] = 0.25; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "None"; - - key["$pref::decalMgr::enabled"] = false; - }; -}; - -new SimGroup( TerrainQualityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::Terrain::lodScale"] = 0.75; - key["$pref::Terrain::detailScale"] = 1.5; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::Terrain::lodScale"] = 1.0; - key["$pref::Terrain::detailScale"] = 1.0; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + key["$pref::TS::detailAdjust"] = 1.0; + key["$pref::TS::skipRenderDLs"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; - key["$pref::Terrain::lodScale"] = 1.5; - key["$pref::Terrain::detailScale"] = 0.75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::Terrain::lodScale"] = 2.0; - key["$pref::Terrain::detailScale"] = 0.5; - }; -}; + displayName = "High"; -//Shadows and Lighting -new SimGroup( ShadowQualityList ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; + key["$pref::TS::detailAdjust"] = 1.5; + key["$pref::TS::skipRenderDLs"] = 0; + }; + }; - displayName = "High"; - - key["$pref::lightManager"] = "Advanced Lighting"; - key["$pref::Shadows::disable"] = false; - key["$pref::Shadows::textureScalar"] = 1.0; - key["$pref::PSSM::detailAdjustScale"] = 1.0; - key["$pref::allowLocalLightShadows"] = true; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::lightManager"] = "Advanced Lighting"; - key["$pref::Shadows::disable"] = false; - key["$pref::Shadows::textureScalar"] = 0.5; - key["$pref::PSSM::detailAdjustScale"] = 0.5; - key["$pref::allowLocalLightShadows"] = true; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + new SimGroup( MeshDrawDistQualityGroup ) + { + class = "OptionsSettings"; + OptionName = "Mesh Draw Distance"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Lowest"; + + key["$pref::useStaticObjectFade"] = true; + key["$pref::staticObjectFadeStart"] = 25; + key["$pref::staticObjectFadeEnd"] = 50; + key["$pref::staticObjectUnfadeableSize"] = 200; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; - key["$pref::lightManager"] = "Advanced Lighting"; - key["$pref::Shadows::disable"] = false; - key["$pref::Shadows::textureScalar"] = 0.25; - key["$pref::PSSM::detailAdjustScale"] = 0.25; - key["$pref::allowLocalLightShadows"] = false; + key["$pref::useStaticObjectFade"] = true; + key["$pref::staticObjectFadeStart"] = 50; + key["$pref::staticObjectFadeEnd"] = 75; + key["$pref::staticObjectUnfadeableSize"] = 100; + }; + new ArrayObject( ) + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "None"; - - key["$pref::lightManager"] = "Advanced Lighting"; - key["$pref::Shadows::disable"] = true; - key["$pref::Shadows::textureScalar"] = 0.5; - key["$pref::allowLocalLightShadows"] = false; - }; -}; + key["$pref::useStaticObjectFade"] = true; + key["$pref::staticObjectFadeStart"] = 75; + key["$pref::staticObjectFadeEnd"] = 100; + key["$pref::staticObjectUnfadeableSize"] = 75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; -new SimGroup( ShadowDistanceList ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Highest"; - - key["$pref::Shadows::drawDistance"] = 1; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::Shadows::drawDistance"] = 0.75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; + key["$pref::useStaticObjectFade"] = false; + key["$pref::staticObjectFadeStart"] = 75; + key["$pref::staticObjectFadeEnd"] = 100; + key["$pref::staticObjectUnfadeableSize"] = 75; - key["$pref::Shadows::drawDistance"] = 0.5; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + }; + }; + + new SimGroup( TextureQualityGroup ) + { + class = "OptionsSettings"; + OptionName = "Texture Quality"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Lowest"; + + key["$pref::Video::textureReductionLevel"] = 2; + key["$pref::Reflect::refractTexScale"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; - key["$pref::Shadows::drawDistance"] = 0.25; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::Shadows::drawDistance"] = 0.1; - }; -}; + key["$pref::Video::textureReductionLevel"] = 1; + key["$pref::Reflect::refractTexScale"] = 0.75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; -new SimGroup( LightingQualityList ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Highest"; - - key["$pref::maximumNumOfLights"] = -1; - key["$pref::useLightFade"] = false; - key["$pref::lightFadeStart"] = 50; - key["$pref::lightFadeEnd"] = 75; - }; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::maximumNumOfLights"] = 15; - key["$pref::useLightFade"] = true; - key["$pref::lightFadeStart"] = 50; - key["$pref::lightFadeEnd"] = 75; - }; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; - - key["$pref::maximumNumOfLights"] = 10; - key["$pref::useLightFade"] = true; - key["$pref::lightFadeStart"] = 25; - key["$pref::lightFadeEnd"] = 50; - }; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; + key["$pref::Video::textureReductionLevel"] = 0; + key["$pref::Reflect::refractTexScale"] = 1; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Video::textureReductionLevel"] = 0; + key["$pref::Reflect::refractTexScale"] = 1.25; + }; + }; + + new SimGroup( GroundCoverDensityGroup ) + { + class = "OptionsSettings"; + OptionName = "Ground Cover Density"; + Description = "Density of ground cover items, such as grass"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Lowest"; + + key["$pref::GroundCover::densityScale"] = 0.25; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Low"; - key["$pref::maximumNumOfLights"] = 5; - key["$pref::useLightFade"] = true; - key["$pref::lightFadeStart"] = 10; - key["$pref::lightFadeEnd"] = 25; + key["$pref::GroundCover::densityScale"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Medium"; - }; -}; + key["$pref::GroundCover::densityScale"] = 0.75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "High"; -new SimGroup( SoftShadowList ) -{ - class = "GraphicsOptionsMenuGroup"; - - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; + key["$pref::GroundCover::densityScale"] = 1.0; + }; + }; + + new SimGroup( DecalLifetimeGroup ) + { + class = "OptionsSettings"; + OptionName = "Decal Life Time"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "None"; + + key["$pref::decalMgr::enabled"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::decalMgr::enabled"] = true; + key["$pref::Decals::lifeTimeScale"] = 0.25; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; + + key["$pref::decalMgr::enabled"] = true; + key["$pref::Decals::lifeTimeScale"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::decalMgr::enabled"] = true; + key["$pref::Decals::lifeTimeScale"] = 1; + }; + }; + + new SimGroup( TerrainQualityGroup ) + { + class = "OptionsSettings"; + OptionName = "Terrain Quality"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Lowest"; + + key["$pref::Terrain::lodScale"] = 2.0; + key["$pref::Terrain::detailScale"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; - key["$pref::Shadows::filterMode"] = "SoftShadowHighQuality"; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; - - key["$pref::Shadows::filterMode"] = "SoftShadow"; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Off"; - - key["$pref::Shadows::filterMode"] = "None"; - }; -}; + key["$pref::Terrain::lodScale"] = 1.5; + key["$pref::Terrain::detailScale"] = 0.75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; -new SimGroup( LightDistanceList ) -{ - class = "GraphicsOptionsMenuGroup"; + key["$pref::Terrain::lodScale"] = 1.0; + key["$pref::Terrain::detailScale"] = 1.0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Terrain::lodScale"] = 0.75; + key["$pref::Terrain::detailScale"] = 1.5; + }; + }; + }; - new ArrayObject() + //Shadows and Lighting + new SimGroup() { - class = "GraphicsQualityLevel"; - caseSensitive = true; + class = "SubOptionsGroup"; + displayName = "Lighting Quality"; - displayName = "Highest"; - - key["$pref::Lights::drawDistance"] = 1; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "High"; - - key["$pref::Lights::drawDistance"] = 0.75; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Medium"; + new SimGroup( ShadowQualityList ) + { + class = "OptionsSettings"; + OptionName = "Shadow Quality"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "None"; + + key["$pref::lightManager"] = "Advanced Lighting"; + key["$pref::Shadows::disable"] = true; + key["$pref::Shadows::textureScalar"] = 0.5; + key["$pref::allowLocalLightShadows"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::lightManager"] = "Advanced Lighting"; + key["$pref::Shadows::disable"] = false; + key["$pref::Shadows::textureScalar"] = 0.25; + key["$pref::PSSM::detailAdjustScale"] = 0.25; + key["$pref::allowLocalLightShadows"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; - key["$pref::Lights::drawDistance"] = 0.5; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Low"; - - key["$pref::Lights::drawDistance"] = 0.25; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; - - displayName = "Lowest"; - - key["$pref::Lights::drawDistance"] = 0.25; - }; -}; + key["$pref::lightManager"] = "Advanced Lighting"; + key["$pref::Shadows::disable"] = false; + key["$pref::Shadows::textureScalar"] = 0.5; + key["$pref::PSSM::detailAdjustScale"] = 0.5; + key["$pref::allowLocalLightShadows"] = true; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::lightManager"] = "Advanced Lighting"; + key["$pref::Shadows::disable"] = false; + key["$pref::Shadows::textureScalar"] = 1.0; + key["$pref::PSSM::detailAdjustScale"] = 1.0; + key["$pref::allowLocalLightShadows"] = true; + }; + }; -new SimGroup( ShaderQualityGroup ) -{ - class = "GraphicsOptionsMenuGroup"; + new SimGroup( ShadowDistanceList ) + { + class = "OptionsSettings"; + OptionName = "Shadow Distance"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Lowest"; + + key["$pref::Shadows::drawDistance"] = 0.1; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::Shadows::drawDistance"] = 0.25; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; + + key["$pref::Shadows::drawDistance"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Shadows::drawDistance"] = 0.75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Highest"; + + key["$pref::Shadows::drawDistance"] = 1; + }; + }; + + new SimGroup( LightingQualityList ) + { + class = "OptionsSettings"; + OptionName = "Lighting Quality"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::maximumNumOfLights"] = 5; + key["$pref::useLightFade"] = true; + key["$pref::lightFadeStart"] = 10; + key["$pref::lightFadeEnd"] = 25; + + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; + + key["$pref::maximumNumOfLights"] = 10; + key["$pref::useLightFade"] = true; + key["$pref::lightFadeStart"] = 25; + key["$pref::lightFadeEnd"] = 50; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::maximumNumOfLights"] = 15; + key["$pref::useLightFade"] = true; + key["$pref::lightFadeStart"] = 50; + key["$pref::lightFadeEnd"] = 75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Highest"; + + key["$pref::maximumNumOfLights"] = -1; + key["$pref::useLightFade"] = false; + key["$pref::lightFadeStart"] = 50; + key["$pref::lightFadeEnd"] = 75; + }; + }; + + new SimGroup( SoftShadowList ) + { + class = "OptionsSettings"; + OptionName = "Soft Shadowing"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Off"; + + key["$pref::Shadows::filterMode"] = "None"; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::Shadows::filterMode"] = "SoftShadow"; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Shadows::filterMode"] = "SoftShadowHighQuality"; + }; + }; + + new SimGroup( LightDistanceList ) + { + class = "OptionsSettings"; + OptionName = "Lights Draw Distance"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Lowest"; + + key["$pref::Lights::drawDistance"] = 0.25; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::Lights::drawDistance"] = 0.25; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Medium"; + + key["$pref::Lights::drawDistance"] = 0.5; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Lights::drawDistance"] = 0.75; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Highest"; + + key["$pref::Lights::drawDistance"] = 1; + }; + }; + }; - new ArrayObject() + new SimGroup() { - class = "GraphicsQualityLevel"; - caseSensitive = true; + class = "SubOptionsGroup"; + displayName = "Effects"; + + new SimGroup(ShaderQualityOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Shader Quality"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "Low"; + + key["$pref::Video::disablePixSpecular"] = true; + key["$pref::Video::disableNormalmapping"] = true; + key["$pref::PostFX::EnableHDRBloom"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + caseSensitive = true; + + displayName = "High"; + + key["$pref::Video::disablePixSpecular"] = false; + key["$pref::Video::disableNormalmapping"] = false; + key["$pref::PostFX::EnableHDRBloom"] = true; + }; + + }; - displayName = "High"; + new SimGroup(AnisotropicFilterOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Anisotropic Filtering"; + Description = "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::Video::defaultAnisotropy"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "4x"; + + key["$pref::Video::defaultAnisotropy"] = 4; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "8x"; + + key["$pref::Video::defaultAnisotropy"] = 8; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "16x"; + + key["$pref::Video::defaultAnisotropy"] =16; + }; + }; - key["$pref::Video::disablePixSpecular"] = false; - key["$pref::Video::disableNormalmapping"] = false; - key["$pref::PostFX::EnableHDRBloom"] = true; - }; - new ArrayObject() - { - class = "GraphicsQualityLevel"; - caseSensitive = true; + new SimGroup(AntiAliasingOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Anti-Aliasing"; + Description = "The Anti-Aliasing Method applied to rendering"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "None"; + + key["$pref::Video::AAMode"] = "None"; + key["$pref::Video::AA"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "FXAA"; + + key["$pref::Video::AAMode"] = "FXAA"; + key["$pref::Video::AA"] = 0; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "SMAA"; + + key["$pref::Video::AAMode"] = "SMAA"; + key["$pref::Video::AA"] = 4; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "SMAA High"; + + key["$pref::Video::AAMode"] ="SMAA High"; + key["$pref::Video::AA"] = 4; + }; + }; - displayName = "Low"; + new SimGroup(ParallaxOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Parallax"; + Description = "Whether the surface parallax shader effect is enabled"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::Video::enableParallaxMapping"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::Video::enableParallaxMapping"] = true; + }; + + }; - key["$pref::Video::disablePixSpecular"] = true; - key["$pref::Video::disableNormalmapping"] = true; - key["$pref::PostFX::EnableHDRBloom"] = false; + new SimGroup(TrueWaterReflectionsOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "True Water Reflections"; + Description = "Whether realtime water reflections are enabled"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::Water::enableTrueReflections"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::Water::enableTrueReflections"] = true; + }; + }; + + new SimGroup(PostFXSSAOOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "SSAO"; + Description = "Whether Screen-Space Ambient Occlusion is enabled"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::PostFX::EnableSSAO"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::PostFX::EnableSSAO"] = true; + }; + }; + + new SimGroup(PostFXDOFOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Depth of Field"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::PostFX::EnableDOF"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::PostFX::EnableDOF"] = true; + }; + }; + + new SimGroup(PostFXVignetteOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Vignette"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::PostFX::EnableVignette"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::PostFX::EnableVignette"] = true; + }; + }; + + new SimGroup(PostFXLightRayOptionsGroup) + { + class = "OptionsSettings"; + OptionName = "Light Rays"; + + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "Off"; + + key["$pref::PostFX::EnableLightRays"] = false; + }; + new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = "On"; + + key["$pref::PostFX::EnableLightRays"] = true; + }; + }; }; }; +function VideoSettingsGroup::populateDisplaySettings(%this) +{ + VideoAPISettingsGroup.clear(); + DisplayDevicesGroup.clear(); + DisplayResSettingsGroup.clear(); + DisplayRefreshSettingsGroup.clear(); + + %apiList = ""; + %apiCount = GFXInit::getAdapterCount(); + for(%i=0; %i < %apiCount; %i++) + { + %api = GFXInit::getAdapterType(%i); + + if(%api !$= "NullDevice") + { + %entry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %api; + key["$pref::Video::displayDevice"] = %api; + }; + + VideoAPISettingsGroup.add(%entry); + } + } + + + %numDevices = Canvas.getMonitorCount(); + + %devicesList = getDisplayDeviceList(); + + for(%i=0; %i < getFieldCount(%devicesList); %i++) + { + %device = getField(%devicesList, %i); + + %entry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %device; + key["$pref::Video::deviceId"] = %i; + }; + + DisplayDevicesGroup.add(%entry); + } + + %mode = getField($Video::ModeTags, $pref::Video::deviceMode); + + if(%mode !$= "Borderless") + { + %resolutionList = getScreenResolutionList($pref::Video::deviceId, $Video::Mode[%mode]); + for(%i=0; %i < getFieldCount(%resolutionList); %i++) + { + %rawResolution = getField(%resolutionList, %i); + + %prettyResolution = _makePrettyResString(%rawResolution); + + %entry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %prettyResolution; + key["$pref::Video::Resolution"] = %rawResolution; + }; + + DisplayResSettingsGroup.add(%entry); + } + } + else + { + if($platform !$= "windows") + %monitorRect = Canvas.getMonitorUsableRect($pref::Video::deviceId); + else + %monitorRect = Canvas.getMonitorRect($pref::Video::deviceId); + + %rawResolution = getWords(%monitorRect, 2); + + %prettyResolution = _makePrettyResString(%rawResolution); + + %entry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %prettyResolution; + key["$pref::Video::Resolution"] = %rawResolution; + }; + + DisplayResSettingsGroup.add(%entry); + } + + %refreshList = getScreenRefreshList($pref::Video::mode); + for(%i=0; %i < getFieldCount(%refreshList); %i++) + { + %refreshRate = getField(%refreshList, %i); + + %entry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %refreshRate; + key["$pref::Video::RefreshRate"] = %refreshRate; + }; + + DisplayRefreshSettingsGroup.add(%entry); + } +} + +function DisplayDevicesGroup::onApply(%this) +{ + updateDisplayOptionsSettings(); +} + +function DisplayModeGroup::onApply(%this) +{ + updateDisplayOptionsSettings(); +} + +function DisplayResSettingsGroup::onApply(%this) +{ + updateDisplayOptionsSettings(); +} + +function VSyncSettingsGroup::onApply(%this) +{ + updateDisplayOptionsSettings(); +} + +function DisplayRefreshSettingsGroup::onApply(%this) +{ + updateDisplayOptionsSettings(); +} + +function updateDisplayOptionsSettings() +{ + //Update the display settings now + %deviceName = getDisplayDeviceName(); + %newDeviceID = getWord(%deviceName, 0) - 1; + + %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode); + %newDeviceMode = 0; + foreach$(%modeName in $Video::ModeTags) + { + if (%deviceModeName $= %modeName) + break; + else + %newDeviceMode++; + } + + if($pref::Video::deviceMode == $Video::ModeBorderless) + { + //if we're changing to borderless, we swap to the full resolution of the desktop + $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode); + + $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y; + } + + %newRes = $pref::Video::Resolution; + %newBpp = 32; // ... its not 1997 anymore. + %newFullScreen = %deviceModeName $= "Fullscreen" ? true : false; + %newRefresh = $pref::Video::RefreshRate; + %newVsync = $pref::Video::enableVerticalSync; + %newAA = $pref::Video::AA; + + // Build the final mode string. + %newMode = $pref::Video::Resolution SPC %newFullScreen SPC %newBpp SPC %newRefresh SPC %newAA; + + // Change the video mode. + if ( %newMode !$= $pref::Video::mode || %newDeviceID != $pref::Video::deviceId || + %newVsync != $pref::Video::enableVerticalSync || %newDeviceMode != $pref::Video::deviceMode) + { + //****Edge Case Hack + // If we're in fullscreen mode and switching to a different monitor at the + // same resolution and maintaining fullscreen, GFX...WindowTarget::resetMode() + // will early-out because there is no "mode change" and the monitor change + // will not get applied. Instead of modifying platform code, we're going to + // move onto the new monitor in borderless and immediately switch to FS. + if (%newFullScreen && $pref::Video::FullScreen && + ($pref::Video::Resolution $= %newRes) && ($pref::Video::deviceId != %newDeviceID)) + { + $pref::Video::deviceId = %newDeviceID; + $pref::Video::deviceMode = $Video::ModeBorderless; + %tmpModeStr = Canvas.getMonitorMode(%newDeviceID, 0); + Canvas.setVideoMode(%tmpModeStr.x, %tmpModeStr.y, false, 32, getWord(%tmpModeStr, $WORD::REFRESH), %newAA); + } + + $pref::Video::mode = %newMode; + $pref::Video::enableVerticalSync = %newVsync; + $pref::Video::deviceId = %newDeviceID; + $pref::Video::deviceMode = %newDeviceMode; + $pref::Video::Resolution = %newRes; + $pref::Video::FullScreen = %newFullScreen; + $pref::Video::RefreshRate = %newRefresh; + $pref::Video::AA = %newAA; + + configureCanvas(); + } +} + +function TextureQualityGroup::onApply(%this) +{ + reloadTextures(); +} + +function PostFXSSAOOptionsGroup::onApply(%this) +{ + %currentLevel = %this.getCurrentQualityLevel(); + PostFXManager.settingsEffectSetEnabled(SSAOPostFx, %currentLevel.getKey(0)); +} + +function PostFXDOFOptionsGroup::onApply(%this) +{ + %currentLevel = %this.getCurrentQualityLevel(); + PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, %currentLevel.getKey(0)); +} + +function PostFXVignetteOptionsGroup::onApply(%this) +{ + %currentLevel = %this.getCurrentQualityLevel(); + PostFXManager.settingsEffectSetEnabled(vignettePostFX, %currentLevel.getKey(0)); +} + +function PostFXLightRayOptionsGroup::onApply(%this) +{ + %currentLevel = %this.getCurrentQualityLevel(); + PostFXManager.settingsEffectSetEnabled(LightRayPostFX, %currentLevel.getKey(0)); +} + function getCurrentQualityLevel(%qualityGroup) { + /*if(%qualityGroup.getId() == DisplayResSettingsGroup.getId()) + { + echo("Checking current quality level of Display Resolution"); + }*/ + for ( %i=0; %i < %qualityGroup.getCount(); %i++ ) { %level = %qualityGroup.getObject( %i ); if ( %level.isCurrent() ) - return %level.displayName; + return %level; } return "Custom"; @@ -652,11 +1199,6 @@ function AutodetectGraphics() %intel = ( strstr( strupr( getDisplayDeviceInformation() ), "INTEL" ) != -1 ) ? true : false; %videoMem = GFXCardProfilerAPI::getVideoMemoryMB(); - return AutodetectGraphics_Apply( %shaderVer, %intel, %videoMem ); -} - -function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) -{ if ( %shaderVer < 2.0 ) { echo("Your video card does not meet the minimum requirment of shader model 2.0."); @@ -680,17 +1222,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) $pref::Shadows::useShadowCaching = true; - $pref::Water::enableTrueReflections = false; - $pref::Video::enableParallaxMapping = false; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AAMode = "None"; - $pref::Video::AA = 0; - $pref::Video::defaultAnisotropy = 0; + AnisotropicFilterOptionsGroup.applySetting("None"); + AntiAliasingOptionsGroup.applySetting("Off"); + ParallaxOptionsGroup.applySetting("Off"); + TrueWaterReflectionsOptionsGroup.applySetting("Off"); + PostFXSSAOOptionsGroup.applySetting("Off"); + PostFXDOFOptionsGroup.applySetting("Off"); + PostFXVignetteOptionsGroup.applySetting("Off"); + PostFXLightRayOptionsGroup.applySetting("Off"); } else { @@ -707,17 +1246,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) $pref::Shadows::useShadowCaching = true; - $pref::Water::enableTrueReflections = false; - $pref::Video::enableParallaxMapping = false; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AAMode = "None"; - $pref::Video::AA = 0; - $pref::Video::defaultAnisotropy = 0; + AnisotropicFilterOptionsGroup.applySetting("None"); + AntiAliasingOptionsGroup.applySetting("Off"); + ParallaxOptionsGroup.applySetting("Off"); + TrueWaterReflectionsOptionsGroup.applySetting("Off"); + PostFXSSAOOptionsGroup.applySetting("Off"); + PostFXDOFOptionsGroup.applySetting("Off"); + PostFXVignetteOptionsGroup.applySetting("Off"); + PostFXLightRayOptionsGroup.applySetting("Off"); } } else @@ -738,17 +1274,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) //Should this default to on in ultra settings? $pref::Shadows::useShadowCaching = true; - $pref::Water::enableTrueReflections = true; - $pref::Video::enableParallaxMapping = true; - $pref::PostFX::EnableSSAO = true; - $pref::PostFX::EnableHDR = true; - $pref::PostFX::EnableDOF = true; - $pref::PostFX::EnableLightRays = true; - $pref::PostFX::EnableVignette = true; - - $pref::Video::AAMode = "SMAA High"; - $pref::Video::AA = 4; - $pref::Video::defaultAnisotropy = 16; + AnisotropicFilterOptionsGroup.applySetting("16x"); + AntiAliasingOptionsGroup.applySetting("SMAA High"); + ParallaxOptionsGroup.applySetting("On"); + TrueWaterReflectionsOptionsGroup.applySetting("On"); + PostFXSSAOOptionsGroup.applySetting("On"); + PostFXDOFOptionsGroup.applySetting("On"); + PostFXVignetteOptionsGroup.applySetting("On"); + PostFXLightRayOptionsGroup.applySetting("On"); } else if ( %videoMem > 400 || %videoMem == 0 ) { @@ -765,17 +1298,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) $pref::Shadows::useShadowCaching = true; - $pref::Water::enableTrueReflections = true; - $pref::Video::enableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = true; - $pref::PostFX::EnableDOF = true; - $pref::PostFX::EnableLightRays = true; - $pref::PostFX::EnableVignette = true; - - $pref::Video::AAMode = "SMAA"; - $pref::Video::AA = 4; - $pref::Video::defaultAnisotropy = 4; + AnisotropicFilterOptionsGroup.applySetting("4x"); + AntiAliasingOptionsGroup.applySetting("SMAA"); + ParallaxOptionsGroup.applySetting("On"); + TrueWaterReflectionsOptionsGroup.applySetting("On"); + PostFXSSAOOptionsGroup.applySetting("Off"); + PostFXDOFOptionsGroup.applySetting("On"); + PostFXVignetteOptionsGroup.applySetting("On"); + PostFXLightRayOptionsGroup.applySetting("On"); if ( %videoMem == 0 ) echo("Torque was unable to detect available video memory. Applying 'Medium' quality."); @@ -795,31 +1325,17 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem ) $pref::Shadows::useShadowCaching = true; - $pref::Water::enableTrueReflections = true; - $pref::Video::enableParallaxMapping = true; - $pref::PostFX::EnableSSAO = false; - $pref::PostFX::EnableHDR = false; - $pref::PostFX::EnableDOF = false; - $pref::PostFX::EnableLightRays = false; - $pref::PostFX::EnableVignette = false; - - $pref::Video::AAMode = "FXAA"; - $pref::Video::AA = 0; - $pref::Video::defaultAnisotropy = 0; + AnisotropicFilterOptionsGroup.applySetting("None"); + AntiAliasingOptionsGroup.applySetting("FXAA"); + ParallaxOptionsGroup.applySetting("On"); + TrueWaterReflectionsOptionsGroup.applySetting("On"); + PostFXSSAOOptionsGroup.applySetting("Off"); + PostFXDOFOptionsGroup.applySetting("Off"); + PostFXVignetteOptionsGroup.applySetting("Off"); + PostFXLightRayOptionsGroup.applySetting("Off"); } } - //%this.refresh(); - - //%this.apply(); - - //force postFX updates - PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO); - PostFXManager.settingsEffectSetEnabled(HDRPostFX, $pref::PostFX::EnableHDR); - PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF); - PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays); - PostFXManager.settingsEffectSetEnabled(VignettePostFX, $pref::PostFX::EnableVignette); - echo("Graphics quality settings have been auto detected."); } @@ -861,7 +1377,7 @@ function getScreenResolutionList(%deviceID, %deviceMode) if ((%deviceMode == $Video::ModeBorderless) && ($platform !$= "windows")) { %borderlessRes = getWords(Canvas.getMonitorUsableRect(%deviceID), 2); - return _makePrettyResString(%borderlessRes); + return %borderlessRes; } %resCount = Canvas.getModeCount(); @@ -873,7 +1389,7 @@ function getScreenResolutionList(%deviceID, %deviceMode) if (!Canvas.checkCanvasRes(%testResString, %deviceID, %deviceMode, false)) continue; - %testRes = _makePrettyResString( %testResString ); + %testRes = getWords(%testResString, 0, 1); //sanitize %found = false; @@ -927,4 +1443,51 @@ function getScreenRefreshList(%resolution) %rateArray.delete(); return %returnsList; +} + +function getDisplayDeviceList() +{ + %numDevices = Canvas.getMonitorCount(); + %devicesList = ""; + for(%i = 0; %i < %numDevices; %i++) + { + %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i); + if(%i==0) + %devicesList = %device; + else + %devicesList = %devicesList @ "\t" @ %device; + } + + return %devicesList; +} + +function getDisplayDeviceId(%displayDeviceName) +{ + %deviceList = getDisplayDeviceList(); + + %deviceCount = getFieldCount(%deviceList); + for(%d = 0; %d < %deviceCount; %d++) + { + %deviceName = getField(%deviceList, %d); + if(%deviceName $= %displayDeviceName) + return %d; + } + + return -1; +} + +function getDisplayDeviceName() +{ + %numDevices = Canvas.getMonitorCount(); + %devicesList = ""; + for(%i = 0; %i < %numDevices; %i++) + { + %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i); + if(%i==0) + %devicesList = %device; + else + %devicesList = %devicesList @ "\t" @ %device; + } + + return getField(%devicesList, $pref::Video::deviceId); } \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/brdf.hlsl b/Templates/BaseGame/game/core/rendering/shaders/brdf.hlsl index e18d1d0be..e36762e6e 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/brdf.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/brdf.hlsl @@ -73,4 +73,14 @@ float D_GGX(float NdotH, float alphaRoughnessSq) return alphaRoughnessSq / (M_PI_F * f * f); } +float3 Fr_DisneyDiffuse(float3 F0, float NdotV, float NdotL, float LdotH, float linearRoughness) +{ + float energyBias = lerp (0 , 0.5 , linearRoughness ); + float energyFactor = lerp (1.0 , 1.0 / 1.51 , linearRoughness ); + float fd90 = energyBias + 2.0 * LdotH * LdotH * linearRoughness ; + float3 lightScatter = F_Schlick( F0 , fd90 , NdotL ); + float3 viewScatter = F_Schlick(F0 , fd90 , NdotV ); + + return lightScatter * viewScatter * energyFactor ; +} #endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/brdf.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/brdf.glsl index dbe4d50ac..9d76de406 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/brdf.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/brdf.glsl @@ -67,4 +67,15 @@ float D_GGX(float NdotH, float alphaRoughnessSq) return alphaRoughnessSq / (M_PI_F * f * f); } +vec3 Fr_DisneyDiffuse(vec3 F0, float NdotV, float NdotL, float LdotH, float linearRoughness) +{ + float energyBias = lerp(0 , 0.5 , linearRoughness ); + float energyFactor = lerp(1.0 , 1.0 / 1.51 , linearRoughness ); + float fd90 = energyBias + 2.0 * LdotH * LdotH * linearRoughness ; + vec3 lightScatter = F_Schlick( F0 , fd90 , NdotL ); + vec3 viewScatter = F_Schlick(F0 , fd90 , NdotV ); + + return lightScatter * viewScatter * energyFactor ; +} + #endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl index a903c0896..723a62511 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl @@ -66,6 +66,10 @@ uniform vec4 albedo; #define DEBUGVIZ_CONTRIB 0 #endif +#ifndef CAPTURE_LIGHT_FLOOR +#define CAPTURE_LIGHT_FLOOR 0.04 +#endif + vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane ) { float denum = dot( plane.xyz, direction.xyz ); @@ -216,15 +220,15 @@ float getDistanceAtt( vec3 unormalizedLightVector , float invSqrAttRadius ) float getSpotAngleAtt( vec3 normalizedLightVector , vec3 lightDir , vec2 lightSpotParams ) { - float cd = dot ( lightDir , normalizedLightVector ); - float attenuation = saturate ( ( cd - lightSpotParams.x ) / lightSpotParams.y ); + float cd = max(dot( lightDir , normalizedLightVector ),0.0); + float attenuation = saturate ( ( cd - lightSpotParams.x/(cd*1.001) ) / lightSpotParams.y ); // smooth the transition return sqr(attenuation); } vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) { - //lambert diffuse + //diffuse term vec3 Fd = surface.albedo.rgb * M_1OVER_PI_F; //GGX specular @@ -234,23 +238,47 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) vec3 Fr = D * F * Vis; #if CAPTURING == 1 - return saturate(mix(Fd + Fr,surface.f0,surface.metalness)); + return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); #else - return saturate(Fd + Fr); + return Fd + Fr; #endif } vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow) { - vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, 0.0f); +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif + vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor); return evaluateStandardBRDF(surface,surfaceToLight) * factor; } vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow) { +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif float attenuation = getDistanceAtt(surfaceToLight.Lu, radius); - vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, 0.0f); + vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor); + return evaluateStandardBRDF(surface,surfaceToLight) * factor; +} + +vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow) +{ +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif + float attenuation = 1.0f; + attenuation *= getDistanceAtt(surfaceToLight.Lu, radius); + attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy); + vec3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor); return evaluateStandardBRDF(surface,surfaceToLight) * factor; } @@ -270,7 +298,7 @@ vec4 compute4Lights( Surface surface, vec4 inLightConfigData[4], vec4 inLightColor[4], vec4 inLightSpotDir[4], - vec2 lightSpotParams[4], + vec2 inlightSpotParams[4], int hasVectorLight, vec4 vectorLightDirection, vec4 vectorLightingColor, @@ -305,13 +333,10 @@ vec4 compute4Lights( Surface surface, //get punctual light contribution lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); } - else //spot + else if(inLightConfigData[i].x == 1) //spot { - - //get Punctual light contribution - lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); - //get spot angle attenuation - lighting *= getSpotAngleAtt(-surfaceToLight.L, inLightSpotDir[i].xyz, lightSpotParams[i].xy ); + //get spot light contribution + lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, inLightSpotDir[i].xyz, inlightSpotParams[i], shadowed); } } finalLighting += lighting; diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl index 0a0f1b967..3ec490af1 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -68,6 +68,10 @@ uniform float4 albedo; #define DEBUGVIZ_CONTRIB 0 #endif +#ifndef CAPTURE_LIGHT_FLOOR +#define CAPTURE_LIGHT_FLOOR 0.04 +#endif + inline float3 getDistanceVectorToPlane( float3 origin, float3 direction, float4 plane ) { float denum = dot( plane.xyz, direction.xyz ); @@ -217,15 +221,15 @@ float getDistanceAtt( float3 unormalizedLightVector , float invSqrAttRadius ) float getSpotAngleAtt( float3 normalizedLightVector , float3 lightDir , float2 lightSpotParams ) { - float cd = dot ( lightDir , normalizedLightVector ); - float attenuation = saturate ( ( cd - lightSpotParams.x ) / lightSpotParams.y ); + float cd = max(dot ( lightDir , normalizedLightVector ),0.0); + float attenuation = saturate(((cd - lightSpotParams.x/(cd*1.001))/lightSpotParams.y)); // smooth the transition return sqr(attenuation); } float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) { - //lambert diffuse + //diffuse term float3 Fd = surface.albedo.rgb * M_1OVER_PI_F; //GGX specular @@ -235,23 +239,47 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) float3 Fr = D * F * Vis; #if CAPTURING == 1 - return saturate(lerp(Fd + Fr,surface.f0,surface.metalness)); + return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness); #else - return saturate(Fd + Fr); + return Fd + Fr; #endif } float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow) { - float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, 0.0f) ; +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif + float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, lightfloor) ; return evaluateStandardBRDF(surface,surfaceToLight) * factor; } float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow) { +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif float attenuation = getDistanceAtt(surfaceToLight.Lu, radius); - float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, 0.0f) ; + float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ; + return evaluateStandardBRDF(surface,surfaceToLight) * factor; +} + +float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow) +{ +#if CAPTURING == 1 + float lightfloor = CAPTURE_LIGHT_FLOOR; +#else + float lightfloor = 0.0; +#endif + float attenuation = 1.0f; + attenuation *= getDistanceAtt(surfaceToLight.Lu, radius); + attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy); + float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ; return evaluateStandardBRDF(surface,surfaceToLight) * factor; } @@ -271,7 +299,7 @@ float4 compute4Lights( Surface surface, float4 inLightConfigData[4], float4 inLightColor[4], float4 inLightSpotDir[4], - float2 lightSpotParams[4], + float2 inlightSpotParams[4], int hasVectorLight, float4 vectorLightDirection, float4 vectorLightingColor, @@ -296,7 +324,7 @@ float4 compute4Lights( Surface surface, float lightBrightness = inLightConfigData[i].y; float lightInvSqrRange= inLightConfigData[i].a; - float3 lighting = 0.0.xxx; + float3 lighting = float3(0.0,0.0,0.0); [branch] if(dist < lightRange) @@ -307,13 +335,10 @@ float4 compute4Lights( Surface surface, //get punctual light contribution lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); } - else //spot + else if(inLightConfigData[i].x == 1) //spot { - - //get Punctual light contribution - lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); - //get spot angle attenuation - lighting *= getSpotAngleAtt(-surfaceToLight.L, inLightSpotDir[i].xyz, lightSpotParams[i].xy ); + //get spot light contribution + lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, inLightSpotDir[i].xyz, inlightSpotParams[i], shadowed); } } finalLighting += lighting; @@ -321,7 +346,7 @@ float4 compute4Lights( Surface surface, //Vector light [branch] - if(hasVectorLight) + if(hasVectorLight == 1) { SurfaceToLight surfaceToVecLight = createSurfaceToLight(surface, -vectorLightDirection.xyz); diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/prefilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/prefilterP.glsl index 1a2be0d2a..d83ee249a 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/prefilterP.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/prefilterP.glsl @@ -86,7 +86,7 @@ vec3 ImportanceSampleGGX(vec2 Xi, vec3 N) vec3 prefilterEnvMap(vec3 R) { - int sampleCount = resolution*2; + int sampleCount = 1024; vec3 N = R; vec3 V = R; float totalWeight = 0.0; @@ -107,7 +107,7 @@ vec3 prefilterEnvMap(vec3 R) float HdotV = max(dot(H, V), 0.0); float pdf = D * NdotH / (4.0 * HdotV) + 0.0001; - float saTexel = 4.0 * M_PI_F / float(6.0 * sampleCount * sampleCount); + float saTexel = 4.0 * M_PI_F / float(6.0 * resolution * resolution); float saSample = 1.0 / (float(sampleCount) * pdf + 0.0001); float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl index 1a7c42822..42654c532 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl @@ -154,10 +154,8 @@ void main() return; #endif - //get Punctual light contribution - lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow); - //get spot angle attenuation - lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams ); + //get spot light contribution + lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, lightDirection, lightSpotParams, shadow); } OUT_col = vec4(lighting, 0); diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/prefilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/prefilterP.hlsl index fbacdadc9..b1f485e91 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/prefilterP.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/prefilterP.hlsl @@ -88,7 +88,7 @@ float3 ImportanceSampleGGX(float2 Xi, float3 N) float4 prefilterEnvMap(float3 R) { - int sampleCount = resolution*2; + int sampleCount = 1024; float3 N = R; float3 V = R; float totalWeight = 0.0; @@ -109,7 +109,7 @@ float4 prefilterEnvMap(float3 R) float HdotV = max(dot(H, V), 0.0); float pdf = D * NdotH / (4.0 * HdotV) + 0.0001; - float saTexel = 4.0 * M_PI_F / (6.0 * sampleCount * sampleCount); + float saTexel = 4.0 * M_PI_F / (6.0 * resolution * resolution); float saSample = 1.0 / (float(sampleCount) * pdf + 0.0001); float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl index a78ed019b..d4ef36a36 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl @@ -151,10 +151,8 @@ float4 main( ConvexConnectP IN ) : SV_TARGET return final; #endif - //get Punctual light contribution - lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow); - //get spot angle attenuation - lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams ); + //get spot light contribution + lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, lightDirection, lightSpotParams, shadow); } return float4(lighting, 0); diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.tscript b/Templates/BaseGame/game/core/sfx/Core_SFX.tscript index f0babb90f..771048b32 100644 --- a/Templates/BaseGame/game/core/sfx/Core_SFX.tscript +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.tscript @@ -7,7 +7,7 @@ function Core_SFX::onCreate(%this) exec("./scripts/audioDescriptions." @ $TorqueScriptFileExtension); exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension); exec("./scripts/audioStates." @ $TorqueScriptFileExtension); - + exec("./scripts/audioOptions." @ $TorqueScriptFileExtension); } function Core_SFX::onDestroy(%this) diff --git a/Templates/BaseGame/game/core/sfx/scripts/audio.tscript b/Templates/BaseGame/game/core/sfx/scripts/audio.tscript index abc6cb6a8..2d8726afc 100644 --- a/Templates/BaseGame/game/core/sfx/scripts/audio.tscript +++ b/Templates/BaseGame/game/core/sfx/scripts/audio.tscript @@ -309,17 +309,26 @@ function sfxAutodetect() //----------------------------------------------------------------------------- // Volume channel IDs for backwards-compatibility. - +$AudioChannelCount = 5; $GuiAudioType = 1; // Interface. $SimAudioType = 2; // Game. $MessageAudioType = 3; // Notifications. $MusicAudioType = 4; // Music. $AudioChannels[ 0 ] = AudioChannelDefault; +$AudioChannelsName[ 0 ] = "Master"; + $AudioChannels[ $GuiAudioType ] = AudioChannelGui; +$AudioChannelsName[ $GuiAudioType ] = "Gui"; + $AudioChannels[ $SimAudioType ] = AudioChannelEffects; +$AudioChannelsName[ $SimAudioType ] = "Effects"; + $AudioChannels[ $MessageAudioType ] = AudioChannelMessages; +$AudioChannelsName[ $MessageAudioType ] = "Messages"; + $AudioChannels[ $MusicAudioType ] = AudioChannelMusic; +$AudioChannelsName[ $MusicAudioType ] = "Music"; function sfxOldChannelToGroup( %channel ) { diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript b/Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript new file mode 100644 index 000000000..eb72c3f86 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript @@ -0,0 +1,103 @@ +new SimGroup(AudioSettingsGroup) +{ + class = "PrimaryOptionsGroup"; + displayName = "Audio"; + + new SimGroup() + { + class = "SubOptionsGroup"; + displayName = "Audio Devices"; + + new SimGroup(AudioSettingsProviderGroup) + { + class = "AudioOptionsSettings"; + + OptionName = "Audio Provider"; + Description = ""; + }; + + new SimGroup(AudioSettingsDeviceGroup) + { + class = "AudioOptionsSettings"; + + OptionName = "Audio Device"; + Description = ""; + }; + }; +}; + +function AudioSettingsGroup::populateSettings(%this) +{ + AudioSettingsProviderGroup.clear(); + AudioSettingsDeviceGroup.clear(); + + %buffer = sfxGetAvailableDevices(); + %count = getRecordCount( %buffer ); + + for(%i = 0; %i < %count; %i++) + { + %record = getRecord(%buffer, %i); + %provider = getField(%record, 0); + %device = getField(%record, 1); + + //When the client is actually running, we don't care about null audo devices + if(%provider $= "null") + continue; + + //We can't have duplicate providers, so double check for uniqueness + %foundProvider = false; + foreach(%registeredProviders in AudioSettingsProviderGroup) + { + if(%registeredProviders.displayName $= %provider) + { + %foundProvider = true; + break; + } + } + + if(!%foundProvider) + { + //Provider entry + %providerEntry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %provider; + key["$pref::SFX::provider"] = %provider; + }; + + AudioSettingsProviderGroup.add(%providerEntry); + } + + //Device Entry + %deviceEntry = new ArrayObject() + { + class = "OptionsQualityLevel"; + displayName = %device; + provider = %provider; //this is for filtering later, if we need to + key["$pref::SFX::device"] = %device; + }; + + AudioSettingsDeviceGroup.add(%deviceEntry); + } +} + +function AudioSettingsProviderGroup::onApply(%this) +{ + updateAudioOptionsSettings(); +} + +function AudioSettingsDeviceGroup::onApply(%this) +{ + updateAudioOptionsSettings(); +} + +function updateAudioOptionsSettings() +{ + if ( !sfxCreateDevice( $pref::SFX::provider, + $pref::SFX::device, + $pref::SFX::useHardware, + -1 ) ) + error( "Unable to create SFX device: " @ $pref::SFX::provider + SPC $pref::SFX::device + SPC $pref::SFX::useHardware ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ExampleModule/scripts/client/defaultKeybinds.tscript b/Templates/BaseGame/game/data/ExampleModule/scripts/client/defaultKeybinds.tscript index cb4f84431..9a9a3ddd5 100644 --- a/Templates/BaseGame/game/data/ExampleModule/scripts/client/defaultKeybinds.tscript +++ b/Templates/BaseGame/game/data/ExampleModule/scripts/client/defaultKeybinds.tscript @@ -17,13 +17,20 @@ addKeyRemap("Ascend", "ExampleMoveMap", "keyboard", "moveup", "Makes the camera addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend"); addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump"); +//addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement"); +//addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement"); +//addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement"); +//addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement"); +addKeyRemap("Jump", "ExampleMoveMap", "gamepad", "jump", "Jump"); + //------------------------------------------------------------------------------ // Non-remapable binds //------------------------------------------------------------------------------ ExampleMoveMap.bind( keyboard, F2, showPlayerList ); ExampleMoveMap.bind(keyboard, "ctrl h", hideHUDs); ExampleMoveMap.bind(keyboard, "alt p", doScreenShotHudless); -ExampleMoveMap.bindCmd(keyboard, "escape", "", "Canvas.pushDialog(PauseMenu);"); +ExampleMoveMap.bindCmd(keyboard, "escape", "", "Canvas.pushDialog(GameMenu);"); +ExampleMoveMap.bindCmd(gamepad, btn_start, "Canvas.pushDialog(GameMenu);", "" ); //------------------------------------------------------------------------------ // Movement Keys diff --git a/Templates/BaseGame/game/data/Prototyping/Prototyping.tscript b/Templates/BaseGame/game/data/Prototyping/Prototyping.tscript index c053fd2cf..abdf546be 100644 --- a/Templates/BaseGame/game/data/Prototyping/Prototyping.tscript +++ b/Templates/BaseGame/game/data/Prototyping/Prototyping.tscript @@ -37,6 +37,9 @@ function Prototyping::onDestroyGameServer(%this) //This is called when the client is initially set up by the game application function Prototyping::initClient(%this) { + //class method prototyping + %this.queueExec("./UI/classPrototyping"); + %this.queueExec("./UI/classPrototyping.gui"); } //This is called when a client connects to a server diff --git a/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.asset.taml b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.asset.taml new file mode 100644 index 000000000..a269f2329 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.gui b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.gui new file mode 100644 index 000000000..e01b92046 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.gui @@ -0,0 +1,115 @@ +//--- OBJECT WRITE BEGIN --- +$guiContent = new GuiControl(classPrototyping) { + extent = "1024 768"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + canSaveDynamicFields = "1"; + originalAssetName = "classPrototyping"; + + new GuiWindowCtrl() { + text = "Class Prototyping"; + position = "216 124"; + extent = "592 519"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + tooltipProfile = "GuiToolTipProfile"; + closeCommand = "Canvas.popDialog(classPrototyping);"; + new GuiScrollCtrl() { + lockVertScroll = "1"; + position = "14 30"; + extent = "564 33"; + profile = "ToolsGuiScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiDynamicCtrlArrayControl(ClassInheritanceListCtrl) { + colCount = "1"; + colSize = "80"; + rowCount = "1"; + rowSize = "18"; + autoCellSize = "1"; + fillRowFirst = "0"; + dynamicSize = "1"; + position = "1 1"; + extent = "400 18"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiTextCtrl() { + text = "Callbacks"; + position = "24 66"; + extent = "54 14"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiScrollCtrl() { + position = "19 80"; + extent = "552 326"; + profile = "ToolsGuiScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiDynamicCtrlArrayControl(ClassMethodListCtrl) { + colCount = "1"; + colSize = "8000"; + rowCount = "1"; + rowSize = "18"; + dynamicSize = "1"; + extent = "552 326"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiBitmapButtonCtrl() { + BitmapAsset = "ToolsModule:iconOpen_image"; + bitmapMode = "Centered"; + position = "348 467"; + extent = "22 22"; + horizSizing = "left"; + profile = "ToolsGuiButtonProfile"; + command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setProtoTypeFilePath\");\nSelectAssetPathWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Module"; + }; + new GuiTextEditCtrl() { + text = "data/ExampleModule"; + position = "143 470"; + extent = "201 20"; + horizSizing = "width"; + profile = "ToolsGuiTextEditProfile"; + active = "0"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "targetPath"; + }; + new GuiTextCtrl() { + text = "Target Path:"; + position = "20 470"; + extent = "116 17"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Save"; + position = "431 465"; + profile = "ToolsGuiButtonProfile"; + command = "classPrototyping.writeResults();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiCheckBoxCtrl(ReportCommands) { + text = "Report Commands"; + position = "16 420"; + extent = "125 30"; + profile = "ToolsGuiCheckBoxProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiCheckBoxCtrl(ReportVariables) { + text = "Report Stock Variables"; + position = "152 420"; + extent = "125 30"; + profile = "ToolsGuiCheckBoxProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.tscript b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.tscript new file mode 100644 index 000000000..1a2ca8fac --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/UI/classPrototyping.tscript @@ -0,0 +1,204 @@ +function classPrototyping::onWake(%this) +{ + +} + +function classPrototyping::onSleep(%this) +{ + +} +//PrototypeClass(MainMenuGui) +//PrototypeClass(GuiChunkedBitmapCtrl) +function PrototypeClass(%classInstance) +{ + if (!isObject(%classInstance)) return; + Canvas.pushDialog(classPrototyping); + classPrototyping.fillClasslist(%classInstance); + classPrototyping.SetNamespaceUsed(%classInstance); +} + +function classPrototyping::fillClasslist(%this, %classInstance) +{ + ClassInheritanceListCtrl.deleteAllObjects(); + %this.instanceName = %classInstance.getName(); + + //get potentially scripted namespaces + %class = %classInstance.getClassName(); + %prepend = ""; + if (%classInstance.getName() !$= "") + %prepend = %classInstance.getName(); + if (%classInstance.class !$= "") + %prepend = %prepend SPC %classInstance.class; + if (%classInstance.superclass !$= "") + %prepend = %prepend SPC %classInstance.superclass; + + //append to hardcoded potential namespaces + %this.classlist = %prepend SPC getClassHierarchy(%class); + %this.classCount = getWordCount(%this.classlist); + for (%i=0; %i<%this.classCount; %i++) + { + %inheritanceOrder = %this.classCount-(%i+1); + %className = getWord(%this.classlist,%inheritanceOrder); + if (%i<%this.classCount-1) + %className = %className @"->"; + %elemClass = new GuiRadioCtrl("ProtoClassSelect"@ %i) { + text = %className; + entry = strreplace(%className,"->",""); + groupNum = "1"; + extent = "80 18"; + profile = "ToolsGuiRadioProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + eval("function ProtoClassSelect"@ %i @"::onClick(%this){classPrototyping.SetNamespaceUsed(%this.entry);}"); + ClassInheritanceListCtrl.addGuiControl(%elemClass); + } + %lastElem = "ProtoClassSelect"@ %this.classCount-1; + %lastElem.setStateOn(true); +} + +function classPrototyping::SetNamespaceUsed(%this, %nameSpaceUsed) +{ + ClassMethodListCtrl.deleteAllObjects(); + %this.fillMethodlist(%nameSpaceUsed); +} + +function classPrototyping::fillMethodlist(%this, %nameSpaceUsed) +{ + ClassMethodListCtrl.deleteAllObjects(); + %this.nameSpaceUsed = %nameSpaceUsed; + %this.methodArray = getMethodSigsNS(%nameSpaceUsed); + %this.methodCount = %this.methodArray.count(); + + for (%i=0; %i<%this.methodCount; %i++) + { + %methodDef = getRecord(%this.methodArray.getValue(%i),0); + %methodName = strreplace(%methodDef,"::"," "); + %methodName = getWord(strreplace(%methodName,"("," "),2); + + %elemMethod = new GuiCheckBoxCtrl("ProtoMethodSelect"@ %i) { + text = %methodName; + position = "1 1"; + profile = "ToolsGuiCheckBoxProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + ClassMethodListCtrl.addGuiControl(%elemMethod); + } +} + +function setProtoTypeFilePath(%targetPath) +{ + classPrototyping-->targetPath.text = %targetPath; +} + +function classPrototyping::readExistingLayout(%this) +{ + for (%i=0; %i<%this.classCount; %i++) + { + %inheritanceOrder = %this.classCount-(%i+1); + %obj = "ProtoClassSelect"@ %i; + if (%obj.isStateOn()) + %namespaceUsed = getWord(%this.classlist,%inheritanceOrder); + } + + %file = new FileObject(); + %filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension; + + if (!isObject(%this.callbacksDefined)) + %this.callbacksDefined = new arrayobject(); + %this.callbacksDefined.empty(); + %this.reportedCommands = false; + %this.reportedVariables = false; + %this.callbackBlockDefined = false; + + %key=0; + if(%file.openForRead(%filename)) + { + while (!%file.isEof()) + { + %line = %file.readLine(); + + //have we already reported commands? + if (startsWith(%line,"/* Available Commands:") ) + %this.reportedCommands = true; + + //have we already reported variables? + if (startsWith(%line,"/* HardCoded Variables") ) + %this.reportedVariables = true; + + if (startsWith(%line,"/*--- Callbacks ---*/") ) + %this.callbackBlockDefined = true; + + //get list of methods already existing + if (startswith(%line,"function "@ %namespaceUsed) ) + { + %methodName = strreplace(%line,"::"," "); + %methodName = getWord(strreplace(%methodName,"("," "),2); + %this.callbacksDefined.add(%key++,%methodName); + } + } + } + %file.delete(); +} + +function classPrototyping::writeResults(%this) +{ + %namespaceUsed = ""; + for (%i=0; %i<%this.classCount; %i++) + { + %inheritanceOrder = %this.classCount-(%i+1); + %obj = "ProtoClassSelect"@ %i; + if (%obj.isStateOn()) + %namespaceUsed = getWord(%this.classlist,%inheritanceOrder); + } + %this.readExistingLayout(); + %file = new FileObject(); + %filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension; + if(%file.openForAppend(%filename)) + { + if (ReportCommands.isStateOn() && %this.reportedCommands == false) + { + %this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true); + %this.commandCount = %this.commandArray.count(); + %file.writeLine("/* Available Commands:"); + for (%i=0; %i< %this.commandCount; %i++) + { + %file.writeLine(getRecord(%this.commandArray.getValue(%i),0)); + } + %file.writeLine("*/"); + } + + if (ReportVariables.isStateOn() && %this.reportedVariables == false) + { + %file.writeLine("/* HardCoded Variables"); + for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++) + { + %file.writeLine(getFieldNS(%this.nameSpaceUsed,%i)); + } + %file.writeLine("*/"); + } + + if (%this.callbackBlockDefined == false) + %file.writeLine("\n/*--- Callbacks ---*/\n"); + + for (%i=0; %i<%this.methodCount; %i++) + { + %obj = "ProtoMethodSelect"@ %i; + if (%obj.isStateOn()) + { + %methodDef = getRecord(%this.methodArray.getValue(%i),0); + %methodName = strreplace(%methodDef,"::"," "); + %methodName = getWord(strreplace(%methodName,"("," "),2); + if (%this.callbacksDefined.countValue(%methodName)==0) + { + echo(%methodName @ "not found. defining..."); + %file.writeLine("\n" @ strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed)); + } + } + } + } + else + { + error( "Failed to open " @ %filename @ " for writing" ); + } + %file.delete(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml new file mode 100644 index 000000000..4dd762c17 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.fbx b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.fbx new file mode 100644 index 000000000..d0a9af823 Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.fbx differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.tscript b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.tscript new file mode 100644 index 000000000..97f5ac066 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.tscript @@ -0,0 +1,8 @@ + +singleton TSShapeConstructor(ArrowPrimitivefbx) +{ + baseShapeAsset = "Prototyping:ArrowPrimitive"; + singleDetailSize = "0"; + neverImportMat = "DefaultMaterial ColorEffect*"; + animFPS = "2"; +}; diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart.png b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart.png new file mode 100644 index 000000000..4d45d2585 Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart.png differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart_image.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart_image.asset.taml new file mode 100644 index 000000000..da4d0f1fa --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibrationChart_image.asset.taml @@ -0,0 +1,3 @@ + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibration_mat.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibration_mat.asset.taml new file mode 100644 index 000000000..21ea3ed5b --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/ColorCalibration_mat.asset.taml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.asset.taml new file mode 100644 index 000000000..be367def9 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.asset.taml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx new file mode 100644 index 000000000..5389ce531 Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter.dds b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter.dds new file mode 100644 index 000000000..c924508d0 Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter.dds differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter_normals.dds b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter_normals.dds new file mode 100644 index 000000000..12cbf4fed Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid.fbx_imposter_normals.dds differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid_shape.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid_shape.asset.taml new file mode 100644 index 000000000..a518ecf9b --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/MaterialGrid_shape.asset.taml @@ -0,0 +1 @@ + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.dae b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.dae new file mode 100644 index 000000000..26ff0651d --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.dae @@ -0,0 +1,115 @@ + + + + + Blender User + Blender 4.0.1 commit date:2023-11-16, commit time:16:40, hash:d0dd92834a08 + + 2023-11-28T06:31:25 + 2023-11-28T06:31:25 + + Z_UP + + + + + + + ColorCalibrationChart_png + + + + + ColorCalibrationChart_png-surface + + + + + + 0 0 0 1 + + + + + + 1.45 + + + + + + + + + ColorCalibrationChart.png + + + + + + + + + + + + -3 -2 -0.125 3 -2 -0.125 -3 2 -0.125 3 2 -0.125 -3 -2 0.09394234 -2.906827 -1.937885 0.125 -2.972711 -1.981807 0.1159034 3 -2 0.09394234 2.906827 -1.937885 0.125 2.972711 -1.981807 0.1159034 -2.906827 1.937885 0.125 -3 2 0.09394234 -2.972711 1.981807 0.1159034 3 2 0.09394234 2.906827 1.937885 0.125 2.972711 1.981807 0.1159034 + + + + + + + + + + 0 -1 0 0 0 -1 0.04734104 -0.08288294 0.9954342 -0.04734104 0.08288294 0.9954342 -0.04734086 -0.08288335 0.9954342 1 0 0 0 1 0 -0.6269479 0 0.7790613 -0.6269475 0 0.7790615 -0.6269475 0 0.7790616 -0.08579593 -0.07703024 0.9933305 -0.08579528 0.07703095 0.9933305 0 -0.7700822 0.6379447 0 -0.7700783 0.6379494 0.08579528 -0.07703095 0.9933305 0.6269479 0 0.7790613 0.6269475 0 0.7790615 0.6269475 0 0.7790616 0.08579593 0.07703024 0.9933305 0 0.7700822 0.6379447 0 0.7700783 0.6379494 0.04734086 0.08288335 0.9954342 -1 0 0 0 -0.7700822 0.6379448 0 0.7700822 0.6379448 + + + + + + + + + + 0 0 1 0 1 0 0 1 1 0 0 0 0.9844712 0.01552879 0.01552879 0.9844712 0.01552879 0.01552879 1 0 1 1 1 1 1 1 0 1 0 1 0 0 0.002274096 0.9977259 0 1 0.002274096 0.002274096 0.01552879 0.9844712 0.002274096 0.9977259 1 0 0.002274096 0.002274096 0 0 0.9977259 0.002274096 0.01552879 0.01552879 0.002274096 0.002274096 1 1 0.9977259 0.002274096 1 0 0.9977259 0.9977259 0.9844712 0.01552879 0.9977259 0.002274096 0 1 0.9977259 0.9977259 1 1 0.002274096 0.9977259 0.9844712 0.9844712 0.9977259 0.9977259 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0.9844712 0.01552879 0.9844712 0.9844712 0.01552879 0.9844712 1 0 1 0 1 1 1 1 1 1 0 1 0 0 0.002274096 0.002274096 0.002274096 0.9977259 0.002274096 0.002274096 0.01552879 0.01552879 0.01552879 0.9844712 1 0 0.9977259 0.002274096 0.002274096 0.002274096 0.9977259 0.002274096 0.9844712 0.01552879 0.01552879 0.01552879 1 1 0.9977259 0.9977259 0.9977259 0.002274096 0.9977259 0.9977259 0.9844712 0.9844712 0.9844712 0.01552879 0 1 0.002274096 0.9977259 0.9977259 0.9977259 0.002274096 0.9977259 0.01552879 0.9844712 0.9844712 0.9844712 0 1 0 1 0 0 + + + + + + + + + + + + + + +

4 0 0 1 0 1 7 0 2 2 1 3 1 1 4 0 1 5 8 2 6 10 3 7 5 4 8 7 5 9 3 5 10 13 5 11 13 6 12 2 6 13 11 6 14 4 7 15 12 8 16 11 9 17 6 10 18 10 3 19 12 11 20 7 12 21 6 13 22 4 13 23 9 14 24 5 4 25 6 10 26 13 15 27 9 16 28 7 17 29 15 18 30 8 2 31 9 14 32 11 19 33 15 20 34 13 20 35 12 11 36 14 21 37 15 18 38 11 22 39 0 22 40 4 22 41 4 0 42 0 0 43 1 0 44 2 1 45 3 1 46 1 1 47 8 2 48 14 21 49 10 3 50 7 5 51 1 5 52 3 5 53 13 6 54 3 6 55 2 6 56 4 7 57 6 7 58 12 8 59 6 10 60 5 4 61 10 3 62 7 12 63 9 23 64 6 13 65 9 14 66 8 2 67 5 4 68 13 15 69 15 15 70 9 16 71 15 18 72 14 21 73 8 2 74 11 19 75 12 24 76 15 20 77 12 11 78 10 3 79 14 21 80 11 22 81 2 22 82 0 22 83

+
+
+
+
+ + + + 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.tscript b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.tscript new file mode 100644 index 000000000..3b98259b8 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard.tscript @@ -0,0 +1,12 @@ + +singleton TSShapeConstructor(colorCalibrationCarddae) +{ + baseShapeAsset = ":colorCalibrationCard_shape"; + singleDetailSize = "0"; + neverImportMat = "DefaultMaterial ColorEffect*"; + flipUVCoords = "0"; + joinIdenticalVerts = "0"; + reverseWindingOrder = "0"; + removeRedundantMats = "0"; + animFPS = "2"; +}; diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard_shape.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard_shape.asset.taml new file mode 100644 index 000000000..092dd88f0 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/colorCalibrationCard_shape.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM.png b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM.png new file mode 100644 index 000000000..148b4aa88 Binary files /dev/null and b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM.png differ diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM_image.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM_image.asset.taml new file mode 100644 index 000000000..fda774c35 --- /dev/null +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Reference/materialGrid_ORM_image.asset.taml @@ -0,0 +1 @@ + diff --git a/Templates/BaseGame/game/data/UI/UI.tscript b/Templates/BaseGame/game/data/UI/UI.tscript index 3baad2bd5..027451977 100644 --- a/Templates/BaseGame/game/data/UI/UI.tscript +++ b/Templates/BaseGame/game/data/UI/UI.tscript @@ -39,21 +39,12 @@ function UI::initClient(%this) //Load UI stuff //Profiles %this.queueExec("./scripts/profiles"); - - //Navigation Utility Scripts - %this.queueExec("./scripts/menuNavigation"); - - //Now gui files - %this.queueExec("./scripts/menuInputHandling"); - + %this.queueExec("./guis/mainMenu"); %this.queueExec("./guis/mainMenu.gui"); - %this.queueExec("./guis/mainMenuButtons"); - %this.queueExec("./guis/mainMenuButtons.gui"); - - %this.queueExec("./guis/chooseLevelDlg"); - %this.queueExec("./guis/chooseLevelDlg.gui"); + %this.queueExec("./guis/ChooseLevelMenu"); + %this.queueExec("./guis/ChooseLevelMenu.gui"); %this.queueExec("./guis/joinServerMenu"); %this.queueExec("./guis/joinServerMenu.gui"); @@ -63,9 +54,10 @@ function UI::initClient(%this) %this.queueExec("./guis/optionsMenu"); %this.queueExec("./guis/optionsMenu.gui"); - %this.queueExec("./guis/pauseMenu"); - %this.queueExec("./guis/pauseMenu.gui"); + %this.queueExec("./guis/GameMenu"); + %this.queueExec("./guis/GameMenu.gui"); + %this.queueExec("./guis/remapDlg"); %this.queueExec("./guis/remapDlg.gui"); %this.queueExec("./guis/remapConfirmDlg.gui"); @@ -73,21 +65,18 @@ function UI::initClient(%this) %this.queueExec("./guis/profiler.gui"); %this.queueExec("./guis/netGraphGui.gui"); - %this.queueExec("./guis/RecordingsDlg.gui"); - - %this.queueExec("./guis/guiMusicPlayer"); - %this.queueExec("./guis/guiMusicPlayer.gui"); %this.queueExec("./guis/startupGui"); %this.queueExec("./guis/startupGui.gui"); - // Load Editor Dialogs + %this.queueExec("./guis/messageBoxDlg"); %this.queueExec("./guis/messageBoxDlg.gui"); + %this.queueExec("./guis/SystemMenu"); + %this.queueExec("./guis/SystemMenu.gui"); + //Load scripts %this.queueExec("./scripts/controlsMenu"); - %this.queueExec("./scripts/messageBoxes"); - %this.queueExec("./scripts/help"); %this.queueExec("./scripts/cursors"); if(isToolBuild()) @@ -97,3 +86,8 @@ function UI::initClient(%this) function UI::onCreateClientConnection(%this){} function UI::onDestroyClientConnection(%this){} + +function UI::registerGameMenus(%this, %menusArrayObj) +{ + %menusArrayObj.add("System", SystemMenu); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/ChooseLevelDlg.asset.taml b/Templates/BaseGame/game/data/UI/guis/ChooseLevelDlg.asset.taml deleted file mode 100644 index 9090ea1af..000000000 --- a/Templates/BaseGame/game/data/UI/guis/ChooseLevelDlg.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.asset.taml b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.asset.taml new file mode 100644 index 000000000..7b612550f --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui new file mode 100644 index 000000000..15ad905d0 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui @@ -0,0 +1,345 @@ +//--- OBJECT WRITE BEGIN --- +$guiContent = new GuiControl(ChooseLevelMenu) { + extent = "1280 720"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiMenuBackgroundProfile"; + category = "BaseUI"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + canSaveDynamicFields = "1"; + launchInEditor = "0"; + previewButtonSize = "445 120"; + + new GuiInputCtrl(ChooseLevelInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "ChooseLevelActionMap"; + position = "-50 0"; + extent = "2186 851"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiPanel(ChooseLevelTitlePanel) { + extent = "1281 60"; + horizSizing = "width"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl(ChooseLevelTitleText) { + text = "SINGLE PLAYER"; + position = "22 23"; + extent = "1281 28"; + profile = "MenuHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiStackControl(ChooseLevelMenuTabList) { + stackingType = "Horizontal"; + padding = "10"; + position = "485 61"; + extent = "310 41"; + horizSizing = "center"; + profile = "GuiDefaultProfile"; + visible = "0"; + tooltipProfile = "GuiToolTipProfile"; + hidden = "1"; + + new GuiButtonCtrl() { + text = "Level"; + groupNum = "1"; + extent = "150 41"; + profile = "GuiMenuButtonProfile"; + command = "ChooseLevelMenu.openMenu(0);"; + tooltipProfile = "GuiToolTipProfile"; + class = "ChooseLevelMenuButton"; + }; + new GuiButtonCtrl() { + text = "Server Config"; + groupNum = "1"; + position = "160 0"; + extent = "150 41"; + profile = "GuiMenuButtonProfile"; + command = "ChooseLevelMenu.openMenu(1);"; + tooltipProfile = "GuiToolTipProfile"; + class = "ChooseLevelMenuButton"; + }; + }; + new GuiControl(ChooseLevelMenuNavButtonOverlay) { + position = "0 61"; + extent = "1281 60"; + horizSizing = "width"; + profile = "GuiNonModalDefaultProfile"; + visible = "0"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + hidden = "1"; + + new GuiBitmapCtrl(ChooseLevelMenuPrevNavIcon) { + BitmapAsset = "UI:Keyboard_Black_Q_image"; + position = "485 24"; + extent = "40 40"; + vertSizing = "top"; + profile = "GuiNonModalDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiBitmapCtrl(ChooseLevelMenuNextNavIcon) { + BitmapAsset = "UI:Keyboard_Black_E_image"; + position = "595 24"; + extent = "40 40"; + vertSizing = "top"; + profile = "GuiNonModalDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer(LevelSelectContainer) { + position = "196 119"; + extent = "888 566"; + horizSizing = "center"; + profile = "GuiNonModalDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiScrollCtrl(LevelPreviewScroll) { + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + extent = "445 562"; + vertSizing = "height"; + profile = "GuiMenuScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl(LevelPreviewArray) { + padding = "5"; + position = "0 1"; + extent = "445 120"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiMenuDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiBitmapCtrl(LevelPreviewBitmap) { + BitmapAsset = ""; + position = "448 0"; + extent = "440 440"; + horizSizing = "left"; + profile = "GuiNonModalDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextCtrl(LevelNameText) { + text = ""; + position = "448 445"; + extent = "440 20"; + horizSizing = "left"; + profile = "MenuSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "levelNameTxt"; + }; + new GuiMLTextCtrl(LevelDescriptionText) { + position = "448 473"; + extent = "440 19"; + horizSizing = "left"; + profile = "GuiMLTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "levelDescTxt"; + }; + }; + new GuiContainer(ServerConfigContainer) { + position = "196 119"; + extent = "888 566"; + horizSizing = "center"; + profile = "GuiNonModalDefaultProfile"; + visible = "0"; + tooltipProfile = "GuiToolTipProfile"; + hidden = "1"; + + new GuiScrollCtrl(ServerConfigScroll) { + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + extent = "888 566"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiMenuScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl(ServerConfigList) { + padding = "5"; + changeChildSizeToFit = "0"; + position = "1 1"; + extent = "900 170"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiMenuDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiContainer() { + extent = "900 30"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Host Player Name"; + position = "0 3"; + extent = "140 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(playerNameCTRL) { + text = "Visitor"; + position = "606 4"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$pref::Player::Name"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "0 35"; + extent = "900 30"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Server Name"; + position = "0 3"; + extent = "101 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(serverNameCTRL) { + text = ""; + position = "606 4"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$Pref::Server::Name"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "0 70"; + extent = "900 30"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Server Password"; + position = "0 3"; + extent = "135 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(serverPassCTRL) { + text = ""; + position = "606 4"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$Pref::Server::Password"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "0 105"; + extent = "900 30"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Server Description"; + position = "0 3"; + extent = "147 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(serverInfoCTRL) { + text = "This is a Torque 3D server."; + position = "606 4"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$Pref::Server::Info"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "0 140"; + extent = "900 30"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Max Players"; + position = "0 3"; + extent = "94 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(serverMaxPlayersCTRL) { + text = "64"; + position = "606 4"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$Pref::Server::MaxPlayers"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + }; + }; + }; + new GuiPanel(ChooseLevelButtonPanel) { + position = "0 683"; + extent = "1281 40"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiIconButtonCtrl(ChooseLevelStartBtn) { + BitmapAsset = "UI:Keyboard_Black_Return_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Start Game"; + position = "1092 0"; + extent = "163 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "ChooseLevelBegin(1);"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiIconButtonCtrl(ChooseLevelBackBtn) { + BitmapAsset = "UI:Keyboard_Black_Escape_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Back"; + position = "16 0"; + extent = "140 40"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "Canvas.popDialog();"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript new file mode 100644 index 000000000..970ff0f87 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript @@ -0,0 +1,285 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +//---------------------------------------- +function ChooseLevelMenu::onAdd( %this ) +{ + if(!isObject(ChooseLevelAssetQuery)) + new AssetQuery(ChooseLevelAssetQuery); + + %this.previewButtonSize = "445 120"; +} + +function ChooseLevelMenu::fillPrefEntries( %this ) +{ + playerNameCTRL.setText($Pref::Player::Name); + serverNameCTRL.setText($Pref::Server::Name); + serverPassCTRL.setText($Pref::Server::Password); + serverInfoCTRL.setText($Pref::Server::Info); + serverMaxPlayersCTRL.setText($Pref::Server::MaxPlayers); +} + +function ChooseLevelMenu::onWake(%this) +{ + %this.fillPrefEntries(); + LevelPreviewArray.clear(); + + ChooseLevelAssetQuery.clear(); + AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset"); + + %count = ChooseLevelAssetQuery.getCount(); + + if(%count == 0 && !IsDirectory("tools")) + { + //We have no levels found. Prompt the user to open the editor to the default level if the tools are present + MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", + "Canvas.popDialog(ChooseLevelMenu); if(isObject(ChooseLevelMenu.returnGui) && ChooseLevelMenu.returnGui.isMethod(\"onReturnTo\")) ChooseLevelMenu.returnGui.onReturnTo();"); + + ChooseLevelAssetQuery.clear(); + return; + } + + for(%i=0; %i < %count; %i++) + { + %assetId = ChooseLevelAssetQuery.getAsset(%i); + + if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule") + continue; + + %levelAsset = AssetDatabase.acquireAsset(%assetId); + + %file = %levelAsset.getLevelPath(); + + if ( !isFile(%file) ) + continue; + + %levelPreviewImg = %levelAsset.getPreviewImagePath(); + + if (!isFile(%levelPreviewImg)) + %levelPreviewImg = "UI:no_preview_image"; + + %preview = new GuiIconButtonCtrl() { + position = "0 0"; + extent = %this.previewButtonSize; + buttonType = "PushButton"; + profile = GuiMenuButtonLeftJustProfile; + horizSizing = "right"; + vertSizing = "bottom"; + internalName = "button"; + class = "LevelPreviewButton"; + //command = "$selectedLevelAsset = " @ %assetId @ ";"; + altCommand = "ChooseLevelBegin(1);"; //allow doubleclick to quick action it + text = %levelAsset.levelName; + bitmapAsset = %levelPreviewImg; + levelAsset = %levelAsset; + levelAssetId = %assetId; + iconLocation = "left"; + sizeIconToButton = true; + makeIconSquare = true; + textLocation = "left"; + textMargin = 120; + groupNum = 2; + cansave = false; + }; + + LevelPreviewArray.add(%preview); + } + + LevelPreviewArray.listPosition = 0; + + // Also add the new level mission as defined in the world editor settings + // if we are choosing a level to launch in the editor. + if ( %this.launchInEditor ) + { + %this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" ); + } + + if(!$pref::HostMultiPlayer) + ChooseLevelTitleText.setText("SINGLE PLAYER"); + else + ChooseLevelTitleText.setText("CREATE SERVER"); + + ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer; + ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer; + + %this.schedule(32, openMenu, 0); +} + +if(!isObject( ChooseLevelActionMap ) ) +{ + new ActionMap(ChooseLevelActionMap){}; + + ChooseLevelActionMap.bind( keyboard, q, ChooseLevelMenuPrevMenu); + ChooseLevelActionMap.bind( gamepad, btn_l, ChooseLevelMenuPrevMenu); + + ChooseLevelActionMap.bind( keyboard, e, ChooseLevelMenuNextMenu); + ChooseLevelActionMap.bind( gamepad, btn_r, ChooseLevelMenuNextMenu); + + ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin ); + ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin ); +} + +function ChooseLevelMenu::syncGUI(%this) +{ + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + //Category handling + %btn = ChooseLevelMenuTabList.getObject(%this.currentMenuIdx); + %btn.setHighlighted(true); + + %buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x; + + ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX; + ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40; + + ChooseLevelBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); + + ChooseLevelStartBtn.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelBegin")); + + ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu")); + ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu")); +} + +function LevelPreviewArray::syncGUI(%this) +{ + %btn = %this.getObject(%this.listPosition); + %btn.setHighlighted(true); + + $selectedLevelAsset = %btn.levelAssetId; +} + +function ChooseLevelMenuPrevMenu(%val) +{ + if(%val && $pref::HostMultiPlayer) + { + %currentIdx = ChooseLevelMenu.currentMenuIdx; + ChooseLevelMenu.currentMenuIdx -= 1; + + ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1); + + if(%currentIdx == ChooseLevelMenu.currentMenuIdx) + return; + + ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx); + } +} + +function ChooseLevelMenuNextMenu(%val) +{ + if(%val && $pref::HostMultiPlayer) + { + %currentIdx = ChooseLevelMenu.currentMenuIdx; + ChooseLevelMenu.currentMenuIdx += 1; + + ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1); + + if(%currentIdx == ChooseLevelMenu.currentMenuIdx) + return; + + ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx); + } +} + + +function ChooseLevelMenu::openMenu(%this, %menuIdx) +{ + LevelSelectContainer.setVisible(%menuIdx == 0); + ServerConfigContainer.setVisible(%menuIdx == 1); + + if(%menuIdx == 0) + $MenuList = LevelPreviewArray; + else if(%menuIdx == 1) + $MenuList = ServerConfigList; + + %this.currentMenuIdx = %menuIdx; + + if($MenuList.isMethod("syncGui")) + $MenuList.syncGui(); + + %this.syncGui(); +} + +function ChooseLevelBegin(%val) +{ + if(%val) + { + // So we can't fire the button when loading is in progress. + if ( isObject( ServerGroup ) ) + return; + + Canvas.popDialog(); + + %entry = LevelPreviewArray.getObject(LevelPreviewArray.listPosition); + + if(!AssetDatabase.isDeclaredAsset(%entry.levelAssetId)) + { + MessageBoxOK("Error", "Selected level preview does not have a valid level asset!"); + return; + } + + $selectedLevelAsset = %entry.levelAssetId; + + // Launch the chosen level with the editor open? + if ( ChooseLevelMenu.launchInEditor ) + { + activatePackage( "BootEditor" ); + ChooseLevelMenu.launchInEditor = false; + StartGame(%entry.levelAssetId, "SinglePlayer"); + } + else + { + StartGame(%entry.levelAssetId); + } + } +} + +function ChooseLevelMenu::onSleep( %this ) +{ + // This is set from the outside, only stays true for a single wake/sleep + // cycle. + %this.launchInEditor = false; + + //Ensure any changes we made to our server configs is saved out + if($pref::HostMultiPlayer) + { + echo("Exporting server prefs"); + %prefPath = getPrefpath(); + export("$Pref::Server::*", %prefPath @ "/serverPrefs." @ $TorqueScriptFileExtension, false); + BanList::Export(%prefPath @ "/banlist." @ $TorqueScriptFileExtension); + } +} + +function LevelPreviewButton::onHighlighted(%this, %highlighted) +{ + if(%highlighted) + { + $MenuList.listPosition = $MenuList.getObjectIndex(%this); + + LevelPreviewBitmap.bitmapAsset = %this.bitmapAsset; + LevelNameText.text = %this.levelAsset.levelName; + LevelDescriptionText.setText(%this.levelAsset.levelDescription); + + LevelPreviewScroll.scrollToObject(%this); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/GameMenu.asset.taml b/Templates/BaseGame/game/data/UI/guis/GameMenu.asset.taml new file mode 100644 index 000000000..2b9ed760a --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/GameMenu.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/UI/guis/GameMenu.gui b/Templates/BaseGame/game/data/UI/guis/GameMenu.gui new file mode 100644 index 000000000..09cdf31e1 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/GameMenu.gui @@ -0,0 +1,93 @@ +//--- OBJECT WRITE BEGIN --- +$guiContent = new GuiControl(GameMenu) { + extent = "1280 720"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + canSaveDynamicFields = "1"; + + new GuiInputCtrl(GameMenuInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "GameMenuActionMap"; + position = "-50 0"; + extent = "50 50"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiChunkedBitmapCtrl(GameMenuBG) { + BitmapAsset = "UI:hudfill_image"; + extent = "1280 720"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + canSaveDynamicFields = "1"; + + new GuiPanel(GameMenuTitlePanel) { + extent = "1281 60"; + horizSizing = "width"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl(GameMenuButtonList){ + position = "40 0"; + extent = "1240 60"; + profile = GuiDefaultProfile; + stackingType = "Horizontal"; + padding = "10"; + horizSizing = "center"; + vertSizing = "center"; + }; + + new GuiControl(GameMenuNavButtonOverlay) { + extent = "1281 60"; + horizSizing = "width"; + vertSizing = "height"; + profile = GuiNonModalDefaultProfile; + + new GuiBitmapCtrl(GameMenuPrevNavIcon) { + BitmapAsset = "UI:Keyboard_Black_Q_image"; + position = "0 24"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + + new GuiBitmapCtrl(GameMenuNextNavIcon) { + BitmapAsset = "UI:Keyboard_Black_E_image"; + position = "0 24"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + }; + }; + }; + new GuiPanel(GameMenuButtonPanel) { + position = "0 683"; + extent = "1281 40"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiIconButtonCtrl(GameMenuBackBtn) { + BitmapAsset = "UI:Keyboard_Black_Escape_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Back"; + position = "16 0"; + extent = "140 40"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "Canvas.popDialog(GameMenu);"; + tooltipProfile = "GuiToolTipProfile"; + class = "MenuInputButton"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/GameMenu.tscript b/Templates/BaseGame/game/data/UI/guis/GameMenu.tscript new file mode 100644 index 000000000..58f9fd145 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/GameMenu.tscript @@ -0,0 +1,187 @@ +function GameMenu::onAdd(%this) +{ + %this.gameMenusArray = new ArrayObject(){}; +} + +function GameMenu::onWake(%this) +{ + if($Server::ServerType $= "SinglePlayer") + { + $timescale = 0; + + sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] ); + } + + callOnModules("registerGameMenus", "", %this.gameMenusArray); + + //Remove duplicates as needed + %this.gameMenusArray.uniqueKey(); + + GameMenuButtonList.clear(); + + %stackWidth = 0; + //process the entries and give 'em buttons on the button array + for(%i=0; %i < %this.gameMenusArray.count(); %i++) + { + %buttonText = %this.gameMenusArray.getKey(%i); + + %textWidth = GuiMenuButtonProfile.getStringWidth(%buttonText); + + %btn = new GuiButtonCtrl() { + extent = %textWidth + 80 SPC 40; + profile = GuiMenuButtonProfile; + text = %buttonText; + class = "GameMenuButton"; + command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");"; + canSave = false; + }; + + %stackWidth += %textWidth + 40; + + GameMenuButtonList.add(%btn); + } + + GameMenuButtonList.resize(GameMenuTitlePanel.extent.x/2 - %stackWidth/2, 0, %stackWidth, GameMenuTitlePanel.extent.y); + + %this.openGameMenu("System"); + + //give a slight delay for the canvas to be fully refreshed before we sync things + %this.schedule(500, "syncGUI"); +} + +function GameMenu::onSleep(%this) +{ + if($Server::ServerType $= "SinglePlayer") + { + $timescale = 1; + sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] ); + } + + if(isObject(%this.currentMenu)) + { + Canvas.popDialog(%this.currentMenu); + } +} + +if(!isObject( GameMenuActionMap ) ) +{ + new ActionMap(GameMenuActionMap){}; + + //We'll just use the existing BaseUI nav functions because it'd be the same logic anyways + GameMenuActionMap.bind( keyboard, w, BaseUINavigatePrev ); + GameMenuActionMap.bind( keyboard, s, BaseUINavigateNext ); + GameMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate ); + GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev ); + GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext ); + + GameMenuActionMap.bind( keyboard, Space, BaseUIActivateSelected ); + GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected ); + + GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" ); + GameMenuActionMap.bindCmd( gamepad, btn_b, "Canvas.popDialog(GameMenu);", "" ); + GameMenuActionMap.bindCmd( gamepad, btn_start, "Canvas.popDialog(GameMenu);", "" ); + + GameMenuActionMap.bind( keyboard, q, GameMenuPrevMenu ); + GameMenuActionMap.bind( gamepad, btn_l, GameMenuPrevMenu ); + + GameMenuActionMap.bind( keyboard, e, GameMenuNextMenu ); + GameMenuActionMap.bind( gamepad, btn_r, GameMenuNextMenu ); +} + +function GameMenu::openGameMenu(%this, %menuName) +{ + %menuIdx = %this.gameMenusArray.getIndexFromKey(%menuName); + if(%menuIdx != -1) + { + %newMenu = %this.gameMenusArray.getValue(%menuIdx); + + if(isObject(%this.currentMenu)) + Canvas.popDialog(%this.currentMenu); + + Canvas.pushDialog(%newMenu); + %this.currentMenu = %newMenu; + %this.currentMenuIdx = %menuIdx; + } + + %this.syncGui(); +} + +function openPauseMenuOptions() +{ + GameMenu.pushPage(OptionsMenu); +} + +function pauseMenuExitToMenu() +{ + MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", ""); +} + +function pauseMenuExitToDesktop() +{ + MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", ""); +} + +function GameMenuPrevMenu(%val) +{ + if(%val) + { + %currentIdx = GameMenu.currentMenuIdx; + GameMenu.currentMenuIdx -= 1; + if(GameMenu.currentMenuIdx < 0) + GameMenu.currentMenuIdx = 0; + + if(%currentIdx == GameMenu.currentMenuIdx) + return; + + %menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx); + + GameMenu.openGameMenu(%menuName); + } +} + +function GameMenuNextMenu(%val) +{ + if(%val) + { + %currentIdx = GameMenu.currentMenuIdx; + GameMenu.currentMenuIdx += 1; + if(GameMenu.currentMenuIdx >= GameMenu.gameMenusArray.count()) + GameMenu.currentMenuIdx = GameMenu.gameMenusArray.count()-1; + + if(%currentIdx == GameMenu.currentMenuIdx) + return; + + %menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx); + + GameMenu.openGameMenu(%menuName); + } +} + +function GameMenu::syncGui(%this) +{ + GameMenuButtonList.callOnChildren("setHighlighted", false); + + %btn = GameMenuButtonList.getObject(%this.currentMenuIdx); + %btn.setHighlighted(true); + + %buttonPosX = %btn.position.x + GameMenuButtonList.position.x; + + GameMenuPrevNavIcon.position.x = %buttonPosX; + GameMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40; + + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + GameMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); + + GameMenuPrevNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuPrevMenu")); + GameMenuNextNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuNextMenu")); + + %this.schedule(500, "syncGUI"); +} + +/* + +*/ \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/GuiMusicPlayer.asset.taml b/Templates/BaseGame/game/data/UI/guis/GuiMusicPlayer.asset.taml deleted file mode 100644 index 94601d7a3..000000000 --- a/Templates/BaseGame/game/data/UI/guis/GuiMusicPlayer.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.asset.taml b/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.asset.taml deleted file mode 100644 index d1d0c8c8e..000000000 --- a/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.asset.taml +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.ed.gui b/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.ed.gui deleted file mode 100644 index 6a98fe6d7..000000000 --- a/Templates/BaseGame/game/data/UI/guis/IODropdownDlg.ed.gui +++ /dev/null @@ -1,159 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(IODropdownDlg) { - profile = "GuiDefaultProfile"; - horizSizing = "width"; - vertSizing = "height"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; - new GuiWindowCtrl(IODropdownFrame) { - canSaveDynamicFields = "0"; - Profile = "GuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "272 77"; - extent = "256 117"; - minExtent = "256 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - maxLength = "255"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "1"; - canMinimize = "0"; - canMaximize = "0"; - minSize = "50 50"; - text = ""; - closeCommand="IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);"; - - new GuiMLTextCtrl(IODropdownText) { - text = ""; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - isContainer = "0"; - profile = "GuiMLTextProfile"; - horizSizing = "center"; - vertSizing = "bottom"; - position = "9 26"; - extent = "237 16"; - minExtent = "8 8"; - canSave = "1"; - visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapBorderCtrl() { - isContainer = "0"; - profile = "GuiGroupBorderProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "7 51"; - extent = "243 28"; - minExtent = "0 0"; - canSave = "1"; - visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - - new GuiTextCtrl(IOInputText) { - text = "Decal Datablock"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - isContainer = "0"; - profile = "GuiTextRightProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "5 5"; - extent = "105 18"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiPopUpMenuCtrl(IODropdownMenu) { - maxPopupHeight = "200"; - sbUsesNAColor = "0"; - reverseTextList = "0"; - bitmapBounds = "16 16"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - isContainer = "0"; - profile = "GuiPopUpMenuProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "115 5"; - extent = "122 18"; - minExtent = "8 2"; - canSave = "1"; - visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - }; - new GuiButtonCtrl() { - text = "OK"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - isContainer = "0"; - profile = "GuiButtonProfile"; - horizSizing = "width"; - vertSizing = "top"; - position = "7 85"; - extent = "156 24"; - minExtent = "8 8"; - canSave = "1"; - visible = "1"; - accelerator = "return"; - command = "IOCallback(IODropdownDlg,IODropdownDlg.callback);"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiButtonCtrl() { - text = "Cancel"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - isContainer = "0"; - profile = "GuiButtonProfile"; - horizSizing = "left"; - vertSizing = "top"; - position = "170 85"; - extent = "80 24"; - minExtent = "8 8"; - canSave = "1"; - visible = "1"; - accelerator = "escape"; - command = "IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.asset.taml b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.asset.taml deleted file mode 100644 index 2ab6cfeef..000000000 --- a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui deleted file mode 100644 index de086ec19..000000000 --- a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui +++ /dev/null @@ -1,84 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(MainMenuButtons) { - extent = "1024 768"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiNonModalDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - canSaveDynamicFields = "1"; - originalAssetName = "MainMenuButtons"; - - new GuiStackControl(MainMenuButtonList) { - padding = "15"; - dynamicSize = "0"; - position = "312 145"; - extent = "400 477"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - - new GuiButtonCtrl(MainMenuSinglePlayerBtn) { - text = "Single Player"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openSinglePlayerMenu();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl(MainMenuCreateSrvrBtn) { - text = "Create Server"; - position = "0 70"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openMultiPlayerMenu();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl(MainMenuJoinSrvrBtn) { - text = "Join Server"; - position = "0 140"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openJoinServerMenu();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl(MainMenuOptionBtn) { - text = "Options"; - position = "0 210"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openOptionsMenu();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl(MainMenuWorldEditBtn) { - text = "Open World Editor (F11)"; - position = "0 280"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openWorldEditorBtn();"; - tooltipProfile = "GuiToolTipProfile"; - enabled = (ModuleDatabase.findModule("ToolsModule") !$= ""); - visible = (ModuleDatabase.findModule("ToolsModule") !$= ""); - }; - new GuiButtonCtrl(MainMenuGuiEditBtn) { - text = "Open GUI Editor (F10)"; - position = "0 350"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "openGUIEditorBtn();"; - tooltipProfile = "GuiToolTipProfile"; - enabled = (ModuleDatabase.findModule("ToolsModule") !$= ""); - visible = (ModuleDatabase.findModule("ToolsModule") !$= ""); - }; - new GuiButtonCtrl(MainMenuExitBtn) { - text = "Exit"; - position = "0 420"; - extent = "400 55"; - profile = "GuiMenuButtonProfile"; - command = "quit();"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript deleted file mode 100644 index be79f9dd3..000000000 --- a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript +++ /dev/null @@ -1,116 +0,0 @@ -function MainMenuButtons::onWake(%this) -{ -} - -function MainMenuButtons::onSleep(%this) -{ -} - -//============================================================================== -// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control -// set MainMenuButtonList as it's root page. -// This is an optional function, but is called as part of the validation that the page -// CAN be opened, so it's shown here as an example -function MainMenuButtons::canOpen(%this) -{ - return true; -} - -//============================================================================== -// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control -// set MainMenuButtonList as it's root page. -// Once the page is added to the MainMenuGUI's UINavigation page stack, onOpen here is called -// Which allows us to actually do the work we need to do for display -function MainMenuButtons::onOpen(%this) -{ - //Here, we set the MainMenuButtonList - a GuiStackControl with the MenuList class - // to be the active menu list. - // This means that when the MainMenuGUI's MainMenuInputHandler receives an input - // or we have one of the buttons in the MainMenuButtonHolder be actioned, we know - // we're working/navigating this list of buttons specifically - // In practice, it sets the $activeMenuList global variable so the various menu class code - // can reference it consistently - MainMenuButtonList.setAsActiveMenuList(); - - //Because MainMenuGUI set it's MainMenuButtonHolder as the active button container, we can reference it - //by $activeMenuButtonContainer and set the menu button/accelerator prompts we need for the MainMenuButtonList - //specifically. - //In particular, being a simple list of buttons, the only one we NEED is a simple activate, so we'll - //disable all the other ones to keep them clear in case they were set by other pages at some point - $activeMenuButtonContainer-->button1.disable(); - $activeMenuButtonContainer-->button2.disable(); - $activeMenuButtonContainer-->button3.disable(); - - //Here we set the 4th button in the container - //All the buttons have the MenuInputButton class, which, like the other classes - //help keep things accessible and consistent. Here we use that class's set function to - //configure the accelerator behavior - //The first parameter sets the gamepad button to the 'A' button - //The second sets the keyboard button to Enter or Return - //Third is what the displayed text will be - //And finally we set the command when the button is clicked, or either key inputs are caught by - //our MenuInputHandler - //The menu buttons automatically detect which input device you're using and swap the display between - //gamepad or keyboard for consistent behavior - $activeMenuButtonContainer-->button4.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();"); - $activeMenuButtonContainer-->button5.disable(); -} - -//Optional, as the check defaults to true, but here as an example case -function MainMenuButtons::canClose(%this) -{ - return true; -} - - -function MainMenuButtons::onClose(%this) -{ -} - -//Our actual commands when we activate the buttons -function openSinglePlayerMenu() -{ - $pref::HostMultiPlayer=false; - MainMenuGui.pushPage(ChooseLevelDlg); -} - -function openMultiPlayerMenu() -{ - $pref::HostMultiPlayer=true; - - //Here, like the other commands, we add a new page onto the stack - //In this case, we'll push the ChooseLevelDlg control onto the stack. This will - //invoke the canClose() and then onClose() functions for MainMenuButtonList - //before calling the onOpen() for ChooseLevelDlg then displaying. - MainMenuGui.pushPage(ChooseLevelDlg); -} - -function openJoinServerMenu() -{ - //Here, like the other commands, we add a new page onto the stack - //In this case, we'll push the JoinServerMenu control onto the stack. This will - //invoke the canClose() and then onClose() functions for MainMenuButtonList - //before calling the onOpen() for JoinServerMenu then displaying. - MainMenuGui.pushPage(JoinServerMenu); -} - -function openOptionsMenu() -{ - //Here, like the other commands, we add a new page onto the stack - //In this case, we'll push the OptionsMenu control onto the stack. This will - //invoke the canClose() and then onClose() functions for MainMenuButtonList - //before calling the onOpen() for OptionsMenu then displaying. - //The options menu additionally has an example of why we may want to capitalize on the - //canClose() call. - MainMenuGui.pushPage(OptionsMenu); -} - -function openWorldEditorBtn() -{ - fastLoadWorldEdit(1); -} - -function openGUIEditorBtn() -{ - fastLoadGUIEdit(1); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/PauseMenu.asset.taml b/Templates/BaseGame/game/data/UI/guis/PauseMenu.asset.taml deleted file mode 100644 index 08a16f03d..000000000 --- a/Templates/BaseGame/game/data/UI/guis/PauseMenu.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/RecordingsDlg.gui b/Templates/BaseGame/game/data/UI/guis/RecordingsDlg.gui deleted file mode 100644 index c13008f11..000000000 --- a/Templates/BaseGame/game/data/UI/guis/RecordingsDlg.gui +++ /dev/null @@ -1,230 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(recordingsDlg) { - position = "0 0"; - extent = "1024 768"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - helpTag = "0"; - - new GuiWindowCtrl() { - text = "Demo Recordings"; - resizeWidth = "0"; - resizeHeight = "0"; - canMove = "1"; - canClose = "1"; - canMinimize = "0"; - canMaximize = "0"; - canCollapse = "0"; - closeCommand = "Canvas.popDialog(recordingsDlg);"; - edgeSnap = "1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "247 215"; - extent = "530 338"; - minExtent = "48 92"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiWindowProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "dynamic"; - vScrollBar = "alwaysOn"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "23 60"; - extent = "484 237"; - minExtent = "32 32"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiScrollProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTextListCtrl(RecordingsDlgList) { - columns = "0"; - fitParentWidth = "1"; - clipColumnText = "0"; - position = "1 1"; - extent = "469 32"; - minExtent = "8 20"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiTextArrayProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiButtonCtrl(DR_CancelBtn) { - text = "Cancel"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "396 306"; - extent = "110 20"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "top"; - profile = "GuiButtonProfile"; - visible = "1"; - active = "1"; - command = "Canvas.popDialog(recordingsDlg);"; - accelerator = "escape"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiButtonCtrl(DR_StartDemoBtn) { - text = "Play"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "25 305"; - extent = "110 20"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "top"; - profile = "GuiButtonProfile"; - visible = "1"; - active = "1"; - command = "StartSelectedDemo();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "During gameplay press the following keys:"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "23 30"; - extent = "206 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiTextProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Start = F3"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "253 32"; - extent = "50 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiTextProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Stop = F4"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "320 32"; - extent = "49 13"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiTextProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiButtonCtrl(DR_DelDemoBtn) { - text = "Delete"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "210 305"; - extent = "110 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiButtonProfile"; - visible = "1"; - active = "1"; - command = "deleteDemoRecord();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; -}; -//--- OBJECT WRITE END --- - diff --git a/Templates/BaseGame/game/data/UI/guis/SystemMenu.asset.taml b/Templates/BaseGame/game/data/UI/guis/SystemMenu.asset.taml new file mode 100644 index 000000000..e5e752734 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/SystemMenu.asset.taml @@ -0,0 +1,5 @@ + diff --git a/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui b/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui new file mode 100644 index 000000000..18605ba85 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/SystemMenu.gui @@ -0,0 +1,60 @@ +//--- OBJECT WRITE BEGIN --- +$guiContent = new GuiControl(SystemMenu) { + extent = "1280 720"; + profile = "GuiNonModalDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + canSaveDynamicFields = "1"; + + new GuiStackControl(SystemMenuButtonList) { + padding = "5"; + dynamicSize = "0"; + position = "440 263"; + extent = "400 189"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiButtonCtrl() { + text = "Return to Game"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "Canvas.popDialog(GameMenu);"; + tooltipProfile = "GuiToolTipProfile"; + groupNum = "1"; + class = "SystemMenuButton"; + }; + new GuiButtonCtrl() { + text = "Options"; + position = "0 45"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "Canvas.pushDialog(OptionsMenu);"; + tooltipProfile = "GuiToolTipProfile"; + groupNum = "1"; + class = "SystemMenuButton"; + }; + new GuiButtonCtrl() { + text = "Exit to Menu"; + position = "0 90"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "systemMenuExitToMenu();"; + tooltipProfile = "GuiToolTipProfile"; + groupNum = "1"; + class = "SystemMenuButton"; + }; + new GuiButtonCtrl() { + text = "Exit to Desktop"; + position = "0 135"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "systemMenuExitToDesktop();"; + tooltipProfile = "GuiToolTipProfile"; + groupNum = "1"; + class = "SystemMenuButton"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/SystemMenu.tscript b/Templates/BaseGame/game/data/UI/guis/SystemMenu.tscript new file mode 100644 index 000000000..1974b2d0f --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/SystemMenu.tscript @@ -0,0 +1,43 @@ +function SystemMenu::onWake(%this) +{ + $MenuList = SystemMenuButtonList; + $MenuList.listPosition = 0; + + $MenuList.syncGui(); +} + +function SystemMenu::onSleep(%this) +{ + +} + +function systemMenuExitToMenu() +{ + MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", ""); +} + +function systemMenuExitToDesktop() +{ + MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", ""); +} + +function SystemMenuButton::onHighlighted(%this, %highlighted) +{ + if(%highlighted) + $MenuList.listPosition = $MenuList.getObjectIndex(%this); +} + +function SystemMenuButtonList::syncGUI(%this) +{ + %btn = %this.getObject(%this.listPosition); + %btn.setHighlighted(true); + + // + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + //We'll call back to the GameMenu parent just to be sure everything's on the same page + GameMenu.syncGui(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.gui b/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.gui deleted file mode 100644 index 414f1ccb3..000000000 --- a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.gui +++ /dev/null @@ -1,106 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(ChooseLevelDlg) { - extent = "1024 768"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiNonModalDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - canSaveDynamicFields = "1"; - Enabled = "1"; - launchInEditor = "0"; - returnGui = "MainMenuGui"; - - new GuiControl(ChooseLevelWindow) { - position = "48 56"; - extent = "928 655"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_image"; - extent = "927 40"; - horizSizing = "width"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiTextCtrl(LevelSelectTitle) { - text = "SINGLE PLAYER"; - position = "22 10"; - extent = "307 28"; - profile = "MenuHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_low_image"; - position = "0 40"; - extent = "927 618"; - horizSizing = "width"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiBitmapCtrl() { - BitmapAsset = "Core_Rendering:missingTexture_image"; - position = "513 71"; - extent = "400 300"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "CurrentPreview"; - canSaveDynamicFields = "1"; - Enabled = "1"; - }; - new GuiTextCtrl() { - text = "Example Level"; - maxLength = "255"; - position = "514 375"; - extent = "398 27"; - minExtent = "8 8"; - profile = "MenuHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - internalName = "LevelName"; - }; - new GuiTextCtrl() { - text = "Description:"; - maxLength = "255"; - position = "522 410"; - extent = "91 18"; - minExtent = "8 8"; - profile = "MenuSubHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - internalName = "LevelDescriptionLabel"; - }; - new GuiMLTextCtrl() { - text = "This is placeholder text"; - position = "522 436"; - extent = "391 14"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "LevelDescription"; - }; - new GuiScrollCtrl() { - hScrollBar = "dynamic"; - vScrollBar = "dynamic"; - position = "0 40"; - extent = "450 580"; - profile = "GuiMenuScrollProfile"; - tooltipProfile = "GuiToolTipProfile"; - - new GuiGameListMenuCtrl(LevelList) { - callbackOnInputs = "1"; - position = "1 1"; - extent = "450 90"; - profile = "DefaultListMenuProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "UIMenuButtonList"; - }; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript b/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript deleted file mode 100644 index b39db49d1..000000000 --- a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript +++ /dev/null @@ -1,210 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//---------------------------------------- -function ChooseLevelDlg::onWake( %this ) -{ - if(!isObject(LevelListEntries)) - new ArrayObject(LevelListEntries){}; - - if(!isObject(ChooseLevelAssetQuery)) - new AssetQuery(ChooseLevelAssetQuery); -} - -function ChooseLevelDlg::onOpen(%this) -{ - LevelList.clearRows(); - LevelListEntries.empty(); - - ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image"); - ChooseLevelWindow->LevelDescriptionLabel.visible = false; - ChooseLevelWindow->LevelDescription.visible = false; - - ChooseLevelAssetQuery.clear(); - AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset"); - - %count = ChooseLevelAssetQuery.getCount(); - - if(%count == 0 && !IsDirectory("tools")) - { - //We have no levels found. Prompt the user to open the editor to the default level if the tools are present - MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - - ChooseLevelAssetQuery.delete(); - return; - } - - for(%i=0; %i < %count; %i++) - { - %assetId = ChooseLevelAssetQuery.getAsset(%i); - - if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule") - continue; - - %levelAsset = AssetDatabase.acquireAsset(%assetId); - - %file = %levelAsset.getLevelPath(); - - if ( !isFile(%file @ ".mis") && !isFile(%file @ ".mis.dso") &&!isFile(%file) ) - continue; - - // Skip our new level/mission if we arent choosing a level - // to launch in the editor. - if ( !%this.launchInEditor ) - { - %fileName = fileName(%file); - if (strstr(%fileName, "newMission.mis") > -1 || strstr(%fileName, "newLevel.mis") > -1) - continue; - } - - %this.addLevelAsset( %levelAsset ); - } - - // Also add the new level mission as defined in the world editor settings - // if we are choosing a level to launch in the editor. - if ( %this.launchInEditor ) - { - %this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" ); - } - - for(%i=0; %i < LevelListEntries.count(); %i++) - { - %levelAsset = LevelListEntries.getKey(%i); - - LevelList.addRow(%levelAsset.LevelName, "", -1, -30); - } - - LevelList.setSelected(0); - LevelList.onChange(); - - if(!$pref::HostMultiPlayer) - LevelSelectTitle.setText("SINGLE PLAYER"); - else - LevelSelectTitle.setText("CREATE SERVER"); - - $activeMenuButtonContainer-->button1.disable(); - $activeMenuButtonContainer-->button2.disable(); - $activeMenuButtonContainer-->button3.disable(); - $activeMenuButtonContainer-->button4.set("btn_a", "Return", "Start Level", "ChooseLevelDlg.beginLevel();"); - $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();"); -} - -function ChooseLevelDlg::onSleep( %this ) -{ - // This is set from the outside, only stays true for a single wake/sleep - // cycle. - %this.launchInEditor = false; -} - -function ChooseLevelDlg::addMissionFile( %this, %file ) -{ - %levelName = fileBase(%file); - %levelDesc = "A Torque level"; - - %LevelInfoObject = getLevelInfo(%file); - - if (%LevelInfoObject != 0) - { - if(%LevelInfoObject.levelName !$= "") - %levelName = %LevelInfoObject.levelName; - else if(%LevelInfoObject.name !$= "") - %levelName = %LevelInfoObject.name; - - if (%LevelInfoObject.desc0 !$= "") - %levelDesc = %LevelInfoObject.desc0; - - if (%LevelInfoObject.preview !$= "") - %levelPreview = %LevelInfoObject.preview; - - %LevelInfoObject.delete(); - } - - LevelListEntries.add( %levelName TAB %file TAB %levelDesc TAB %levelPreview ); -} - -function ChooseLevelDlg::addLevelAsset( %this, %levelAsset ) -{ - LevelListEntries.add( %levelAsset ); -} - -function LevelList::onChange(%this) -{ - %index = %this.getSelectedRow(); - - %levelAsset = LevelListEntries.getKey(%index); - - // Get the name - ChooseLevelWindow->LevelName.text = %levelAsset.LevelName; - - // Get the level id - $selectedLevelAsset = %levelAsset.getAssetId(); - - // Find the preview image - %levelPreview = %levelAsset.getPreviewImagePath(); - - // Test against all of the different image formats - // This should probably be moved into an engine function - if (isFile(%levelPreview)) - ChooseLevelWindow->CurrentPreview.setBitmap(%levelPreview); - else - ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image"); - - // Get the description - %levelDesc = %levelAsset.description; - - if(%levelDesc !$= "") - { - ChooseLevelWindow->LevelDescriptionLabel.setVisible(true); - ChooseLevelWindow->LevelDescription.setVisible(true); - ChooseLevelWindow->LevelDescription.setText(%levelDesc); - } - else - { - ChooseLevelWindow->LevelDescriptionLabel.setVisible(false); - ChooseLevelWindow->LevelDescription.setVisible(false); - } - -} - -// Do this onMouseUp not via Command which occurs onMouseDown so we do -// not have a lingering mouseUp event lingering in the ether. -function ChooseLevelDlg::beginLevel(%this) -{ - // So we can't fire the button when loading is in progress. - if ( isObject( ServerGroup ) ) - return; - - %this.navigation.popPage(); - - // Launch the chosen level with the editor open? - if ( ChooseLevelDlg.launchInEditor ) - { - activatePackage( "BootEditor" ); - ChooseLevelDlg.launchInEditor = false; - StartGame("", "SinglePlayer"); - } - else - { - StartGame(); - } -} diff --git a/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.gui b/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.gui deleted file mode 100644 index cfd2c3e96..000000000 --- a/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.gui +++ /dev/null @@ -1,192 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(GuiMusicPlayer) { - isContainer = "1"; - Profile = "GuiWindowProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "0 0"; - Extent = "1024 768"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "1"; - superClass = "GuiMusicPlayerClass"; - - new GuiWindowCtrl() { - resizeWidth = "0"; - resizeHeight = "0"; - canMove = "1"; - canClose = "1"; - canMinimize = "1"; - canMaximize = "1"; - minSize = "50 50"; - EdgeSnap = "1"; - text = "Torque Music Player"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - isContainer = "1"; - Profile = "GuiWindowProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "29 35"; - Extent = "518 377"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - closeCommand = "toggleMusicPlayer();"; - - new GuiCheckBoxCtrl(GuiMusicPlayerFadeCheckBox) { - useInactiveState = "0"; - text = "Fade"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - isContainer = "0"; - Profile = "GuiCheckBoxProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "457 347"; - Extent = "53 30"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(GuiMusicPlayerLoopCheckBox) { - useInactiveState = "0"; - text = "Loop"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - isContainer = "0"; - Profile = "GuiCheckBoxProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "457 330"; - Extent = "44 30"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "dynamic"; - vScrollBar = "alwaysOn"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - isContainer = "1"; - Profile = "GuiScrollProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "9 31"; - Extent = "500 298"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - - new GuiListBoxCtrl(GuiMusicPlayerMusicList) { - AllowMultipleSelections = "1"; - fitParentWidth = "1"; - isContainer = "0"; - Profile = "GuiListBoxProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "1 1"; - Extent = "485 2"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - superClass = "GuiMusicPlayerMusicListClass"; - }; - }; - new GuiSliderCtrl(GuiMusicPlayerScrubber) { - range = "0 1"; - ticks = "10"; - value = "0"; - snap = "false"; - isContainer = "0"; - Profile = "GuiSliderProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "114 343"; - Extent = "331 23"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "$thisControl.onDragComplete();"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - class = "GuiMusicPlayerScrubberClass"; - className = "GuiMusicPlayerScrubberClass"; - }; - new GuiButtonCtrl(GuiMusicPlayerStopButton) { - text = "Stop"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - isContainer = "0"; - Profile = "GuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "57 338"; - Extent = "40 30"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "GuiMusicPlayer.stop();"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - new GuiButtonCtrl(GuiMusicPlayerPlayButton) { - text = "Play"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - isContainer = "0"; - Profile = "GuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "13 338"; - Extent = "40 30"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "GuiMusicPlayer.play();"; - tooltipprofile = "GuiToolTipProfile"; - hovertime = "1000"; - canSaveDynamicFields = "0"; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.tscript b/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.tscript deleted file mode 100644 index 2a302e635..000000000 --- a/Templates/BaseGame/game/data/UI/guis/guiMusicPlayer.tscript +++ /dev/null @@ -1,236 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// A very simple music player. -//--------------------------------------------------------------------------------------------- -// Preferences. - -$pref::GuiMusicPlayer::filePattern = "*.ogg\t*.wav"; -$pref::GuiMusicPlayer::fadeTime = "3.0"; - -//--------------------------------------------------------------------------------------------- -// Datablocks. - -singleton SFXDescription( GuiMusicPlayerStream : AudioMusic2D ) -{ - volume = 1.0; - isLooping = false; - isStreaming = true; - is3D = false; -}; -singleton SFXDescription( GuiMusicPlayerLoopingStream : AudioMusic2D ) -{ - volume = 1.0; - isLooping = true; - isStreaming = true; - is3D = false; -}; - -//--------------------------------------------------------------------------------------------- -// Functions. - -function toggleMusicPlayer() -{ - if( !GuiMusicPlayer.isAwake() ) - { - GuiMusicPlayer.setExtent( Canvas.getExtent() ); - GuiMusicPlayer.setPosition( 0, 0 ); - - Canvas.pushDialog( GuiMusicPlayer ); - } - else - Canvas.popDialog( GuiMusicPlayer ); -} - -//--------------------------------------------------------------------------------------------- -// Methods. - -function GuiMusicPlayer_onSFXSourceStatusChange( %id, %status ) -{ - if( %status $= "Stopped" ) - GuiMusicPlayer.onStop(); -} - -function GuiMusicPlayerClass::play( %this ) -{ - if( %this.status $= "Stopped" - || %this.status $= "Paused" - || %this.status $= "" ) - { - %isPlaying = true; - if( %this.status $= "Paused" && isObject( %this.sfxSource ) ) - %this.sfxSource.play(); - else - { - %sel = GuiMusicPlayerMusicList.getSelectedItem(); - if( %sel == -1 ) - %isPlaying = false; - else - { - %desc = GuiMusicPlayerStream; - if( GuiMusicPlayerLoopCheckBox.getValue() ) - %desc = GuiMusicPlayerLoopingStream; - - if( GuiMusicPlayerFadeCheckBox.getValue() ) - { - %desc.fadeInTime = $pref::GuiMusicPlayer::fadeTime; - %desc.fadeOutTime = $pref::GuiMusicPlayer::fadeTime; - } - else - { - %desc.fadeInTime = 0; - %desc.fadeOutTime = 0; - } - - %file = GuiMusicPlayerMusicList.getItemText( %sel ); - %this.sfxSource = sfxPlayOnce( %desc, %file ); - if( !%this.sfxSource ) - %isPlaying = false; - else - { - %this.sfxSource.statusCallback = "GuiMusicPlayer_onSFXSourceStatusChange"; - GuiMusicPlayer.status = "Playing"; - - GuiMusicPlayerScrubber.setActive( true ); - GuiMusicPlayerScrubber.setup( %this.sfxSource.getDuration() ); - } - } - } - - if( %isPlaying ) - { - GuiMusicPlayerPlayButton.setText( "Pause" ); - GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.pause();"; - GuiMusicPlayerLoopCheckBox.setActive( false ); - GuiMusicPlayerFadeCheckBox.setActive( false ); - %this.status = "Playing"; - } - } -} - -function GuiMusicPlayerClass::stop( %this ) -{ - if( %this.status $= "Playing" - || %this.status $= "Paused" ) - { - if( isObject( %this.sfxSource ) ) - %this.sfxSource.stop( 0 ); // Stop immediately. - } -} - -function GuiMusicPlayerClass::onStop( %this ) -{ - %this.sfxSource = 0; - - GuiMusicPlayerLoopCheckBox.setActive( true ); - GuiMusicPlayerFadeCheckBox.setActive( true ); - GuiMusicPlayerScrubber.setActive( false ); - GuiMusicPlayerPlayButton.setText( "Play" ); - GuiMusicPlayerPlayButton.Command = "GuiMusicPlayer.play();"; - %this.status = "Stopped"; - - GuiMusicPlayerScrubber.setValue( 0 ); -} - -function GuiMusicPlayerClass::pause( %this ) -{ - if( %this.status $= "Playing" ) - { - if( isObject( %this.sfxSource ) ) - %this.sfxSource.pause( 0 ); - - GuiMusicPlayerPlayButton.setText( "Play" ); - GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.play();"; - %this.status = "Paused"; - } -} - -function GuiMusicPlayerClass::seek( %this, %playtime ) -{ - if( ( %this.status $= "Playing" - || %this.status $= "Paused" ) - && isObject( %this.sfxSource ) ) - %this.sfxSource.setPosition( %playtime ); -} - -function GuiMusicPlayer::onWake( %this ) -{ - GuiMusicPlayerMusicList.load(); -} - -function GuiMusicPlayerMusicListClass::load( %this ) -{ - // Remove all the files currently in the list. - - %this.clearItems(); - - // Find the file matching pattern we should use. - - %filePattern = $pref::GuiMusicPlayer::filePattern; - %sfxProvider = getWord( sfxGetDeviceInfo(), 0 ); - %filePatternVarName = "$pref::GuiMusicPlayer::filePattern" @ %sfxProvider; - if( isDefined( %filePatternVarName ) ) - eval( "%filePattern = " @ %filePatternVarName @ ";" ); - - // Find all files matching the pattern. - - for( %file = findFirstFileMultiExpr( %filePattern ); - %file !$= ""; - %file = findNextFileMultiExpr( %filePattern ) ) - %this.addItem( makeRelativePath( %file, getMainDotCsDir() ) ); -} - -function GuiMusicPlayerMusicList::onDoubleClick( %this ) -{ - GuiMusicPlayer.stop(); - GuiMusicPlayer.play(); -} - -function GuiMusicPlayerScrubber::onMouseDragged( %this ) -{ - %this.isBeingDragged = true; -} - -function GuiMusicPlayerScrubberClass::setup( %this, %totalPlaytime ) -{ - %this.range = "0 " @ %totalPlaytime; - %this.ticks = %totalPlaytime / 5; // One tick per five seconds. - - %this.update(); -} - -function GuiMusicPlayerScrubberClass::update( %this ) -{ - if( GuiMusicPlayer.status $= "Playing" - && !%this.isBeingDragged ) - %this.setValue( GuiMusicPlayer.sfxSource.getPosition() ); - - if( GuiMusicPlayer.status $= "Playing" - || GuiMusicPlayer.status $= "Paused" ) - %this.schedule( 5, "update" ); -} - -function GuiMusicPlayerScrubberClass::onDragComplete( %this ) -{ - GuiMusicPlayer.seek( %this.getValue() ); - %this.isBeingDragged = false; -} diff --git a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui index 758d1bf32..9394ca35f 100644 --- a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.gui @@ -1,159 +1,207 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(JoinServerMenu) { - extent = "1024 768"; - profile = "GuiNonModalDefaultProfile"; + extent = "1280 720"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiMenuBackgroundProfile"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; + canSaveDynamicFields = "1"; + + new GuiInputCtrl(JoinServerInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "JoinServerActionMap"; + position = "-50 0"; + extent = "50 50"; horizSizing = "width"; vertSizing = "height"; - canSaveDynamicFields = "0"; - - new GuiControl(JoinServerWindow) { - position = "48 56"; - extent = "928 655"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiPanel(JoinServerTitlePanel) { + extent = "1281 60"; + horizSizing = "width"; + profile = "GuiMenuPanelProfile"; tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_image"; - extent = "927 40"; - horizSizing = "width"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; new GuiTextCtrl() { text = "JOIN SERVER"; - position = "22 10"; - extent = "207 28"; + position = "22 23"; + extent = "1281 28"; profile = "MenuHeaderText"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_low_image"; - position = "0 40"; - extent = "927 618"; - horizSizing = "width"; - profile = "GuiDefaultProfile"; + }; + new GuiContainer() { + position = "190 61"; + extent = "900 30"; + horizSizing = "center"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Player Name"; + position = "0 5"; + extent = "98 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiTextCtrl(JS_status) { - text = "No servers found."; - maxLength = "255"; - position = "392 47"; - extent = "148 18"; - minExtent = "8 8"; + new GuiTextEditCtrl(JoinServerPlayerNameTxt) { + text = "Visitor"; + position = "606 7"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$pref::Player::Name"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "190 87"; + extent = "900 30"; + horizSizing = "center"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Password"; + position = "0 5"; + extent = "78 23"; + vertSizing = "center"; + profile = "MenuMLSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(JoinServerPasswordTxt) { + text = "Visitor"; + position = "606 7"; + extent = "295 22"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuTextEditprofile"; + variable = "$Client::Password"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiContainer() { + position = "190 121"; + extent = "900 30"; + horizSizing = "center"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTextCtrl() { + text = "Server Details"; + extent = "700 30"; + vertSizing = "center"; profile = "MenuSubHeaderText"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiTextCtrl() { - text = "Players"; - maxLength = "255"; - position = "269 67"; - extent = "36 18"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - }; - new GuiTextCtrl() { - text = "Version"; - maxLength = "255"; - position = "335 67"; - extent = "38 18"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - }; - new GuiTextCtrl() { - text = "Game"; - maxLength = "255"; - position = "412 67"; - extent = "28 18"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - }; new GuiTextCtrl() { text = "Ping"; - maxLength = "255"; - position = "212 67"; - extent = "20 18"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; + position = "700 0"; + extent = "70 30"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; }; new GuiTextCtrl() { - text = "Server Name"; - maxLength = "255"; - position = "12 67"; - extent = "63 18"; - minExtent = "8 8"; - profile = "GuiMLWhiteTextProfile"; + text = "Player Count"; + position = "770 0"; + extent = "130 30"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuSubHeaderCenteredText"; tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; }; - new GuiScrollCtrl() { - hScrollBar = "dynamic"; - vScrollBar = "dynamic"; - position = "19 98"; - extent = "890 501"; - minExtent = "8 8"; - profile = "GuiMenuScrollProfile"; - tooltipProfile = "GuiToolTipProfile"; - - new GuiStackControl(JoinServerList) { - padding = "10"; - changeChildSizeToFit = "0"; - position = "1 1"; - extent = "888 16"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - }; - }; - new GuiControl(JS_queryStatus) { - position = "16 615"; - extent = "900 35"; - profile = "GuiDefaultProfile"; - visible = "0"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - hidden = "1"; - - new GuiProgressCtrl(JS_statusBar) { - position = "84 0"; - extent = "695 35"; - minExtent = "8 8"; - profile = "GuiProgressProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - }; - new GuiButtonCtrl(JS_cancelQuery) { - text = "Cancel!"; - extent = "84 35"; - minExtent = "8 8"; - profile = "GuiMenuButtonProfile"; - command = "JoinServerDlg.cancel();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiTextCtrl(JS_statusText) { - text = "Querying master server"; - maxLength = "255"; - position = "84 0"; - extent = "695 35"; - minExtent = "8 8"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; }; + new GuiScrollCtrl() { + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + position = "190 151"; + extent = "900 532"; + minExtent = "8 8"; + horizSizing = "center"; + vertSizing = "height"; + profile = "GuiMenuScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl(JoinServerList) { + padding = "10"; + changeChildSizeToFit = "0"; + position = "1 1"; + extent = "888 16"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiMenuDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiPanel(JoinServerButtonPanel) { + position = "0 683"; + extent = "1281 40"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiIconButtonCtrl(JoinServerJoinBtn) { + BitmapAsset = "UI:Keyboard_Black_Space_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Join"; + position = "1115 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + active = "0"; + command = "JoinServerMenu.join();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiIconButtonCtrl(JoinServerQLanBtn) { + BitmapAsset = "UI:Keyboard_Black_E_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Query Lan"; + position = "965 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "JoinServerMenu.queryLan();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiIconButtonCtrl(JoinServerQServerBtn) { + BitmapAsset = "UI:Keyboard_Black_Q_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Query Server"; + position = "800 0"; + extent = "160 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "JoinServerMenu.query();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiIconButtonCtrl(JoinServerBackBtn) { + BitmapAsset = "UI:Keyboard_Black_Escape_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Back"; + position = "16 0"; + extent = "140 40"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "Canvas.popDialog();"; + tooltipProfile = "GuiToolTipProfile"; }; }; }; diff --git a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript index c4d9fff24..24aad2152 100644 --- a/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/joinServerMenu.tscript @@ -1,22 +1,41 @@ function JoinServerMenu::onWake(%this) { + $MenuList = JoinServerList; + $MenuList.clear(); + $Client::Password = ""; + JoinServerList.listPosition = 0; + + JoinServerList.syncGui(); } -function JoinServerMenu::onOpen(%this) +function JoinServerMenu::onSleep(%this) { - JoinServerList.setAsActiveMenuList(); + echo("Exporting client prefs"); + %prefPath = getPrefpath(); + export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false); +} - $activeMenuButtonContainer-->button1.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();"); - $activeMenuButtonContainer-->button2.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();"); - $activeMenuButtonContainer-->button3.set("btn_x", "E", "Query Online", "JoinServerMenu.query();"); - $activeMenuButtonContainer-->button4.set("btn_start", "Return", "Join", "JoinServerMenu.join();"); - $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "cancelServerQuery(); " @ %this @ ".navigation.popPage();"); +if(!isObject( JoinServerActionMap ) ) +{ + new ActionMap(JoinServerActionMap){}; + + JoinServerActionMap.bindCmd( keyboard, q, "JoinServerMenu.query();" ); + JoinServerActionMap.bindCmd( gamepad, btn_x, "JoinServerMenu.query();" ); + + JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" ); + JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" ); + + JoinServerActionMap.bindCmd( keyboard, Space, "JoinServerMenu::join();" ); + JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" ); } //---------------------------------------- function JoinServerMenu::query(%this) { + //Nuke the current list and indicate we're working on a query... + JoinServerList.clear(); + queryMasterServer( 0, // Query flags $Client::GameTypeQuery, // gameTypes @@ -34,6 +53,9 @@ function JoinServerMenu::query(%this) //---------------------------------------- function JoinServerMenu::queryLan(%this) { + //Nuke the current list and indicate we're working on a query... + JoinServerList.clear(); + queryLANServers( $pref::Net::Port, // lanPort for local queries 0, // Query flags @@ -61,16 +83,14 @@ function JoinServerMenu::cancel(%this) function JoinServerMenu::join(%this) { cancelServerQuery(); - %index = JS_serverList.getSelectedId(); - - JoinGame(%index); + JoinGame(JoinServerList.listPosition); } //---------------------------------------- function JoinServerMenu::refresh(%this) { cancelServerQuery(); - %index= JoinServerList.getActiveRow(); + %index = JoinServerList.listPosition; // The server info index is stored in the row along with the // rest of displayed info. @@ -93,19 +113,19 @@ function JoinServerMenu::update(%this) %sc = getServerCount(); for( %i = 0; %i < %sc; %i ++ ) { setServerInfo(%i); - %serverBtn = new GuiButtonCtrl(){ - text = $ServerInfo::Name TAB - $ServerInfo::Ping TAB - $ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB - $ServerInfo::Version TAB - $ServerInfo::MissionName; - profile = GuiJoinServerButtonProfile; - extent = JoinServerList.extent.x SPC 30; - }; - JoinServerList.add(%serverBtn); + + %serverEntry = %this.addServerEntry(); + %serverEntry-->serverNameTxt.text = $ServerInfo::Name; + %serverEntry-->serverDetailsTxt.text = $ServerInfo::MissionName @ " | v" @ $ServerInfo::Version @ " | " @ $ServerInfo::MissionType @ " | " @ $ServerInfo::Info; + %serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms"; + %serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers; + + %serverEntry.resize(0, 0, JoinServerList.extent.x, %serverEntry.extent.y); + + JoinServerList.add(%serverEntry); } - - $activeMenuButtonContainer-->button4.setActive(JoinServerList.getCount() > 0); + + JoinServerList.syncGui(); } //---------------------------------------- @@ -115,26 +135,148 @@ function onServerQueryStatus(%status, %msg, %value) // Update query status // States: start, update, ping, query, done // value = % (0-1) done for ping and query states - if (!JS_queryStatus.isVisible()) - JS_queryStatus.setVisible(true); + //if (!JS_queryStatus.isVisible()) + // JS_queryStatus.setVisible(true); switch$ (%status) { case "start": - JS_statusText.setText(%msg); - JS_statusBar.setValue(0); + MessagePopup("", %msg, 5000); JoinServerList.clear(); case "ping": - JS_statusText.setText("Ping Servers"); - JS_statusBar.setValue(%value); + MessagePopup("", "Pinging Servers", 5000); case "query": - JS_statusText.setText("Query Servers"); - JS_statusBar.setValue(%value); + MessagePopup("", "Querying Servers", 5000); case "done": - JS_queryStatus.setVisible(false); - JS_status.setText(%msg); + MessagePopup("", %msg, 1000); JoinServerMenu.update(); } } + +function JoinServerMenu::addServerEntry(%this) +{ + %entry = new GuiContainer() { + position = "0 0"; + extent = "900 40"; + profile = GuiMenuDefaultProfile; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "width"; + vertSizing = "bottom"; + class = "JoinServerServerEntry"; + canSave = false; + + new GuiButtonCtrl() { + profile = GuiMenuButtonProfile; + position = "0 0"; + extent = "900 40"; + horizSizing = "width"; + vertSizing = "height"; + internalName = "button"; + class = "JoinServerEntryButton"; + }; + + new GuiTextCtrl() { + position = "0 0"; + extent = "700 20"; + profile = "MenuSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "serverNameTxt"; + }; + new GuiTextCtrl() { + position = $optionsEntryPad SPC 17; + extent = "700 18"; + profile = "GuiMLTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "serverDetailsTxt"; + }; + + new GuiTextCtrl() { + position = "700 0"; + extent = "70 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuSubHeaderCenteredText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "pingTxt"; + }; + + new GuiTextCtrl() { + position = "770 0"; + extent = "130 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "MenuSubHeaderCenteredText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "playerCountTxt"; + }; + }; + + return %entry; +} + +function JoinServerEntryButton::onHighlighted(%this, %highlighted) +{ + %container = %this.getParent(); + + %container-->serverNameTxt.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText; + %container-->serverDetailsTxt.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile; + %container-->pingTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText; + %container-->playerCountTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText; +} + +function JoinServerMenu::addStatusEntry(%this) +{ + %entry = new GuiContainer() { + position = "0 0"; + extent = "900 40"; + profile = GuiMenuDefaultProfile; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "width"; + vertSizing = "bottom"; + class = "JoinServerStatusEntry"; + + new GuiTextCtrl() { + position = "0 0"; + extent = "730 20"; + profile = "MenuSubHeaderCenteredText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "statusTxt"; + }; + }; + + return %entry; +} + +function JoinServerStatusEntry::updateProgress(%this) +{ + %this-->statusText.text = %this-->statusText.text @ "."; //ellipses....... + + %this.schedule(500, "updateProgress"); +} + +function JoinServerList::syncGui(%this) +{ + %this.callOnChildren("setHighlighted", false); + + if(%this.listPosition < %this.getCount()) + { + %btn = %this.getObject(%this.listPosition); + %btn-->button.setHighlighted(true); + } + + // + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + JoinServerBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); + JoinServerJoinBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu::join();")); + JoinServerQLanBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.queryLan();")); + JoinServerQServerBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.query();")); + + + JoinServerJoinBtn.setActive(JoinServerList.getCount() > 0); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/mainMenu.gui b/Templates/BaseGame/game/data/UI/guis/mainMenu.gui index 69ceaf317..ce1ab06a5 100644 --- a/Templates/BaseGame/game/data/UI/guis/mainMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/mainMenu.gui @@ -1,40 +1,38 @@ //--- OBJECT WRITE BEGIN --- -$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) { - BitmapAsset = "UI:backgrounddark_image"; - extent = "1024 768"; +$guiContent = new GuiControl(MainMenuGui) { + extent = "1280 720"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiDefaultProfile"; + profile = "GuiMenuBackgroundProfile"; + category = "BaseUI"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - superClass = "UINavigation"; - canSaveDynamicFields = "0"; - + canSaveDynamicFields = "1"; + + new GuiInputCtrl(MainMenuInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "BaseUIActionMap"; + position = "-50 0"; + extent = "2186 851"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; new GuiBitmapCtrl(SideBackgroundImage) { - bitmapAsset = "UI:menu_side_background_image"; - color = "255 255 255 255"; - wrap = "0"; - position = "0 0"; + BitmapAsset = "UI:menu_side_background_image"; + position = "0 -48"; extent = "900 600"; - minExtent = "8 2"; - horizSizing = "right"; vertSizing = "top"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; - new GuiBitmapCtrl(MainMenuAppLogo) { BitmapAsset = "UI:Torque_3D_logo_image"; - position = "550 30"; + position = "460 78"; extent = "360 100"; - horizSizing = "left"; + horizSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; canSaveDynamicFields = "1"; @@ -46,98 +44,108 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) { useModifiers = "0"; useStates = "1"; }; - new GuiControl(MainMenuButtonHolder) { - position = "143 711"; - extent = "736 40"; - horizSizing = "center"; + new GuiPanel(MainMenuButtonPanel) { + position = "0 683"; + extent = "1281 40"; + horizSizing = "width"; vertSizing = "top"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiIconButtonCtrl(MainMenuGoButton) { + BitmapAsset = "UI:Keyboard_Black_Return_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Go"; + position = "1115 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "activateSelected();"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiStackControl(MainMenuButtonList) { + padding = "5"; + dynamicSize = "0"; + position = "440 199"; + extent = "400 322"; + horizSizing = "center"; + vertSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - class = "MenuInputButtonContainer"; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - text = "Go"; - position = "11 0"; - extent = "140 40"; + new GuiButtonCtrl(MainMenuSinglePlayerBtn) { + text = "Single Player"; + extent = "400 40"; profile = "GuiMenuButtonProfile"; - command = "MainMenuButtonList.activate();"; + command = "$pref::HostMultiPlayer=false;\nCanvas.pushDialog(ChooseLevelMenu);"; tooltipProfile = "GuiToolTipProfile"; - internalName = "button1"; - class = "MenuInputButton"; + class="MainMenuButton"; + groupNum = 1; }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - text = "Go"; - position = "155 0"; - extent = "140 40"; + new GuiButtonCtrl(MainMenuCreateSrvrBtn) { + text = "Create Server"; + position = "0 45"; + extent = "400 40"; profile = "GuiMenuButtonProfile"; - command = "MainMenuButtonList.activate();"; + command = "$pref::HostMultiPlayer=true;Canvas.pushDialog(ChooseLevelMenu);"; tooltipProfile = "GuiToolTipProfile"; - internalName = "button2"; - class = "MenuInputButton"; + class="MainMenuButton"; + groupNum = 1; }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - text = "Go"; - position = "299 0"; - extent = "140 40"; + new GuiButtonCtrl(MainMenuJoinSrvrBtn) { + text = "Join Server"; + position = "0 90"; + extent = "400 40"; profile = "GuiMenuButtonProfile"; - command = "MainMenuButtonList.activate();"; + command = "Canvas.pushDialog(JoinServerMenu);"; tooltipProfile = "GuiToolTipProfile"; - internalName = "button3"; - class = "MenuInputButton"; + class="MainMenuButton"; + groupNum = 1; }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - text = "Go"; - position = "443 0"; - extent = "140 40"; + new GuiButtonCtrl(MainMenuOptionBtn) { + text = "Options"; + position = "0 135"; + extent = "400 40"; profile = "GuiMenuButtonProfile"; - command = "MainMenuButtonList.activate();"; + command = "Canvas.pushDialog(OptionsMenu);"; tooltipProfile = "GuiToolTipProfile"; - internalName = "button4"; - class = "MenuInputButton"; - }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - text = "Go"; - position = "587 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - command = "MainMenuButtonList.activate();"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button5"; - class = "MenuInputButton"; + class="MainMenuButton"; + groupNum = 1; + }; + new GuiButtonCtrl(MainMenuWorldEditBtn) { + text = "Open World Editor (F11)"; + position = "0 180"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "fastLoadWorldEdit(1);"; + tooltipProfile = "GuiToolTipProfile"; + class="MainMenuButton"; + groupNum = 1; + }; + new GuiButtonCtrl(MainMenuGuiEditBtn) { + text = "Open GUI Editor (F10)"; + position = "0 225"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "fastLoadGUIEdit(1);"; + tooltipProfile = "GuiToolTipProfile"; + class="MainMenuButton"; + groupNum = 1; + }; + new GuiButtonCtrl(MainMenuExitBtn) { + text = "Exit"; + position = "0 270"; + extent = "400 40"; + profile = "GuiMenuButtonProfile"; + command = "quit();"; + tooltipProfile = "GuiToolTipProfile"; + class="MainMenuButton"; + groupNum = 1; }; - }; - new GuiInputCtrl(MainMenuInputHandler) { - sendAxisEvents = "1"; - sendBreakEvents = "1"; - ignoreMouseEvents = "1"; - position = "-50 0"; - extent = "10 10"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiInputCtrlProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuInputHandler"; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript b/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript index ec4fa44f7..b8f86c3cf 100644 --- a/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript @@ -1,52 +1,130 @@ +$BaseUI::scrollSpeedTimeMs = 250; +$BaseUI::scrollSchedule = 0; + function MainMenuGui::onAdd(%this) { - $activeControllerName = "K&M"; //default input type } function MainMenuGui::onWake(%this) { - //In the BaseUI example case, the MainMenuGUI acts as our background - //So it's a logical control to set as our UINavigation as well. So we - //set the MainMenuGUI's superClass to UINavigation to integrate it into - //that namespace to open up page navigation + $MenuList = MainMenuButtonList; + $MenuList.listPosition = 0; - //At the same time, the MainMenuGUI control has the button holder, set to - //the MenuInputButtonContainer class, allowing us to set it as the active button - //holder here, prepping it for catching any button inputs to active commands - //Specifically, it sets the $activeMenuButtonContainer to be this, which allows - //other controls to manage what the behavior of the buttons is consistently - //without needing to worry about hardcoded names - MainMenuButtonHolder.setActive(); - - //We also have the MainMenuInputHandler, a GuiInputCtrl with the MenuInputHandler class - //This allows us to catch any input/axis event and pass it along to the active menuList - //or button containers to navigate the menus - //We set up this catch by making said control our first responder, here - MainMenuInputHandler.setFirstResponder(); - - //We also go ahead and mark for any future pages being added to the UINavigation's page stack - //to be prompted to resize when added. This isn't required, but helps keep pages formated to - //the current size of the UINavigation, which is useful when dealing with aspect ratio or resolution - //changes. - %this.resizePages = true; - //Lastly, we go ahead and display some actual navigable content up on our main menu here - //In this case, we set the MainMenuButtons as our root page, so we always come back - //to having the main menu buttons on screen if every other page is closed. - //This will ultimately call MainMenuButtons::onOpen(), so to see where the navigation - //chain continues, see that function. - %this.setRootPage(MainMenuButtons); - - %this.refreshPage(); + $MenuList.syncGui(); } -function MainMenuButtonHolder::onWake(%this) +function MainMenuGui::onSleep(%this) { - //Because the blan slate MainMenuGUI doesn't have anything we need to bother with inputs on - //we just go ahead and disable all the buttons in our MainMenuButtonHolder to have - // a clean slate - %this-->button1.disable(); - %this-->button2.disable(); - %this-->button3.disable(); - %this-->button4.disable(); - %this-->button5.disable(); +} + +if(!isObject( BaseUIActionMap ) ) +{ + new ActionMap(BaseUIActionMap){}; + + BaseUIActionMap.bind( keyboard, w, BaseUINavigatePrev ); + BaseUIActionMap.bind( keyboard, s, BaseUINavigateNext ); + BaseUIActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate ); + BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev ); + BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext ); + + BaseUIActionMap.bind( keyboard, Space, BaseUIActivateSelected ); + BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected ); + + BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut ); + BaseUIActionMap.bind( gamepad, btn_b, BaseUIBackOut ); +} + +function BaseUINavigatePrev(%val) +{ + if(%val) + { + $MenuList.listPosition -= 1; + if($MenuList.listPosition < 0) + $MenuList.listPosition = 0; + + $MenuList.syncGUI(); + + $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigatePrev", 1); + } + else + { + cancel($BaseUI::scrollSchedule); + } +} + +function BaseUINavigateNext(%val) +{ + if(%val) + { + $MenuList.listPosition += 1; + if($MenuList.listPosition >= $MenuList.getCount()) + $MenuList.listPosition = $MenuList.getCount()-1; + + $MenuList.syncGUI(); + + $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigateNext", 1); + } + else + { + cancel($BaseUI::scrollSchedule); + } +} + +function BaseUIStickNavigate(%val) +{ + if(%val == 1) + BaseUINavigateNext(1); + else if(%val == -1) + BaseUINavigatePrev(1); + else + cancel($BaseUI::scrollSchedule); +} + +function BaseUIBackOut(%val) +{ + //we can't navigate further back than the MainMenuGui + if(%val && Canvas.getObject(Canvas.getCount()-1).getId() != MainMenuGui.getId()) + { + Canvas.popDialog(); + %topMenu = Canvas.getObject(Canvas.getCount()-1); + if(isObject(%topMenu)) + { + //re-kick the on-wake so we can be fully up to date and relevently + //contexted + %topMenu.onWake(); + } + } +} + +function MainMenuButtonList::syncGUI(%this) +{ + //%this.callOnChildren("setHighlighted", false); + + %btn = %this.getObject(%this.listPosition); + %btn.setHighlighted(true); + + // + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + MainMenuGoButton.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected")); +} + +function MainMenuButton::onHighlighted(%this, %highlighted) +{ + if(%highlighted) + $MenuList.listPosition = MainMenuButtonList.getObjectIndex(%this); +} + +function BaseUIActivateSelected() +{ + if($MenuList.getCount() == 0 || $MenuList.listPosition >= $MenuList.getCount() || $MenuList.listPosition < 0) + return; + + %btn = $MenuList.getObject($MenuList.listPosition); + + if(%btn.isMethod("performClick")) + %btn.performClick(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.gui b/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.gui index 91207adff..1923c3a11 100644 --- a/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.gui +++ b/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.gui @@ -1,347 +1,75 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(MessageBoxDlg) { - position = "0 0"; - extent = "1024 768"; + extent = "1280 720"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; profile = "GuiOverlayProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; canSaveDynamicFields = "1"; helpTag = "0"; - new GuiControl(MessageBoxCtrl) { - position = "192 197"; - extent = "641 381"; - minExtent = "8 2"; + new GuiInputCtrl(MessageBoxInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "MessageBoxActionMap"; + position = "-50 0"; + extent = "2186 851"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + + new GuiBitmapCtrl() { + BitmapAsset = "UI:backdrop_image"; + position = "272 128"; + extent = "735 463"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiControl(MessageBoxCtrl) { + position = "319 169"; + extent = "641 381"; horizSizing = "center"; vertSizing = "center"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - new GuiBitmapBarCtrl() { - percent = "100"; - vertical = "0"; - flipClip = "0"; - bitmapAsset = "UI:panel_image"; - color = "255 255 255 255"; - position = "0 0"; - extent = "641 40"; - minExtent = "8 2"; + new GuiPanel() { + extent = "641 381"; horizSizing = "width"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; + vertSizing = "height"; + profile = "GuiMenuBasePanelProfile"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl(MessageBoxTitleText) { - text = "OPTIONS"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "32 7"; extent = "577 28"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "MenuHeaderText"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapBarCtrl() { - percent = "100"; - vertical = "0"; - flipClip = "0"; - bitmapAsset = "UI:panel_low_image"; - color = "255 255 255 255"; - position = "0 40"; - extent = "641 341"; - minExtent = "8 2"; horizSizing = "width"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; + profile = "MenuHeaderText"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiMLTextCtrl(MessageBoxText) { - lineSpacing = "2"; - allowColorChars = "0"; - maxChars = "-1"; - useURLMouseCursor = "0"; position = "81 83"; extent = "481 19"; minExtent = "8 8"; horizSizing = "center"; vertSizing = "center"; profile = "MenuMLSubHeaderText"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; - new GuiControl(MessageBoxOKButtonHolder) { - position = "0 285"; - extent = "642 40"; - minExtent = "8 2"; - horizSizing = "center"; + new GuiStackControl(MessageBoxButtonHolder) { + stackingType = "Horizontal"; + position = "250 285"; + extent = "140 40"; + horizSizing = "width"; vertSizing = "top"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - class = "MenuInputButtonContainer"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "251 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "OKButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiControl(MessageBoxOCButtonHolder) { - position = "0 285"; - extent = "642 40"; - minExtent = "8 2"; - horizSizing = "center"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - class = "MenuInputButtonContainer"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "171 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "OKButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "323 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "CancelButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiControl(MessageBoxYNCButtonHolder) { - position = "0 285"; - extent = "642 40"; - minExtent = "8 2"; - horizSizing = "center"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - class = "MenuInputButtonContainer"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "99 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "yesButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "251 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "noButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Go"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "403 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "MainMenuButtonList.activateRow();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "CancelButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; }; }; }; diff --git a/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript b/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript new file mode 100644 index 000000000..322b81082 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript @@ -0,0 +1,220 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// -------------------------------------------------------------------- +// Message Sound +// -------------------------------------------------------------------- +/*new SFXDescription(MessageBoxAudioDescription) +{ + volume = 1.0; + isLooping = false; + is3D = false; + channel = $GuiAudioType; +}; + +new SFXProfile(messageBoxBeep) +{ + filename = "./messageBoxSound"; + description = MessageBoxAudioDescription; + preload = true; +};*/ + +//--------------------------------------------------------------------------------------------- +// messageCallback +// Calls a callback passed to a message box. +//--------------------------------------------------------------------------------------------- +function messageCallback(%dlg, %callback) +{ + Canvas.popDialog(%dlg); + eval(%callback); +} + +//--------------------------------------------------------------------------------------------- +// MBSetText +// Sets the text of a message box and resizes it to accomodate the new string. +//--------------------------------------------------------------------------------------------- +function MBSetText(%text, %frame, %msg) +{ + // Get the extent of the text box. + %ext = %text.getExtent(); + // Set the text in the center of the text box. + %text.setText("" @ %msg); + // Force the textbox to resize itself vertically. + %text.forceReflow(); + // Grab the new extent of the text box. + %newExtent = %text.getExtent(); + + // Get the vertical change in extent. + %deltaY = getWord(%newExtent, 1) - getWord(%ext, 1); + + // Resize the window housing the text box. + %windowPos = %frame.getPosition(); + %windowExt = %frame.getExtent(); + %frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2), + getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY); + + %frame.canMove = "0"; + //%frame.canClose = "0"; + %frame.resizeWidth = "0"; + %frame.resizeHeight = "0"; + %frame.canMinimize = "0"; + %frame.canMaximize = "0"; + + //sfxPlayOnce( messageBoxBeep ); +} + +function MessageBoxCtrl::onWake(%this) +{ + %this.callback = ""; + %this.cancelCallback = ""; +} + +//--------------------------------------------------------------------------------------------- +// Various message box display functions. Each one takes a window title, a message, and a +// callback for each button. +//--------------------------------------------------------------------------------------------- +function MessageBoxCtrl::createButton(%this, %text, %command, %bitmap) +{ + %btn = new GuiIconButtonCtrl() { + BitmapAsset = %bitmap; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + iconLocation = "Left"; + text = %text; + position = "251 0"; + extent = "140 40"; + profile = "GuiMenuButtonProfile"; + command = %command; + tooltipProfile = "GuiToolTipProfile"; + }; + + MessageBoxButtonHolder.add(%btn); + + //update positioning of the holder to be centered + MessageBoxButtonHolder.position.x = MessageBoxCtrl.extent.x/2 - MessageBoxButtonHolder.extent.x/2; + + return %btn; +} + +function MessageBoxDlg::onWake(%this) +{ + +} + +if(!isObject( MessageBoxActionMap ) ) +{ + new ActionMap(MessageBoxActionMap){}; + + MessageBoxActionMap.bind( keyboard, Space, messageBoxYesClicked ); + MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked ); + + MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked ); + MessageBoxActionMap.bind( gamepad, btn_b, messageBoxNoClicked ); +} + +function MessageBoxCtrl::syncGui(%this) +{ + +} + +function messageBoxYesClicked(%val) +{ + if(%val) + MessageCallback(MessageBoxDlg, MessageBoxDlg.callback); +} + +function messageBoxNoClicked(%val) +{ + if(%val) + MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback); +} + +//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\""); +function MessageBoxOK(%title, %message, %callback) +{ + MessageBoxButtonHolder.clear(); + + Canvas.pushDialog(MessageBoxDlg); + MessageBoxTitleText.text = %title; + + %okButton = MessageBoxCtrl.createButton("OK", "messageBoxYesClicked(1);"); + %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked"); + %okButton.setBitmap(%bitmapAssetId); + + MBSetText(MessageBoxText, MessageBoxCtrl, %message); + MessageBoxDlg.callback = %callback; +} + +function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride) +{ + MessageBoxButtonHolder.clear(); + + Canvas.pushDialog(MessageBoxDlg); + MessageBoxTitleText.text = %title; + + if(%okLabelOverride $= "") + %okLabel = "OK"; + else + %okLabel = %okLabelOverride; + + if(%cancelLabelOverride $= "") + %cancelLabel = "Cancel"; + else + %cancelLabel = %cancelLabelOverride; + + %okButton = MessageBoxCtrl.createButton(%okLabel, "messageBoxYesClicked(1);"); + %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked"); + %okButton.setBitmap(%bitmapAssetId); + + %cancelButton = MessageBoxCtrl.createButton(%cancelLabel, "messageBoxNoClicked(1);"); + %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxNoClicked"); + %cancelButton.setBitmap(%bitmapAssetId); + + MBSetText(MessageBoxText, MessageBoxCtrl, %message); + MessageBoxDlg.callback = %callback; + MessageBoxDlg.cancelCallback = %cancelCallback; +} + +function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback) +{ + MessageBoxOKCancel(%title, %message, %yesCallback, %noCallback, "Yes", "No"); +} + +//--------------------------------------------------------------------------------------------- +// MessagePopup +// Displays a message box with no buttons. Disappears after %delay milliseconds. +//--------------------------------------------------------------------------------------------- +function MessagePopup(%title, %message, %delay) +{ + Canvas.pushDialog(MessageBoxDlg); + MessageBoxTitleText.text = %title; + MBSetText(MessageBoxText, MessageBoxCtrl, %message); + + if (%delay !$= "") + schedule(%delay, 0, CloseMessagePopup); +} + +function CloseMessagePopup() +{ + Canvas.popDialog(MessageBoxDlg); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui index 8a85fd848..08e312d52 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui @@ -1,226 +1,242 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(OptionsMenu) { - extent = "1024 768"; - profile = "GuiNonModalDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; + extent = "1280 720"; + minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; + profile = "GuiMenuBackgroundProfile"; + category = "BaseUI"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; canSaveDynamicFields = "0"; - new GuiControl(OptionsMenuContainer) { - position = "48 56"; - extent = "928 655"; - horizSizing = "aspectCenter"; - vertSizing = "center"; + new GuiInputCtrl(OptionsMenuInputHandler) { + ignoreMouseEvents = "1"; + ActionMap = "OptionsMenuActionMap"; + position = "-50 0"; + extent = "2186 851"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiInputCtrlProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiControl(OptionsMenuCategoryContainer) { + position = "0 60"; + extent = "1280 49"; + horizSizing = "center"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_low_image"; - position = "0 40"; - extent = "927 618"; + new GuiStackControl(OptionsMenuCategoryList) { + stackingType = "Horizontal"; + padding = "10"; + dynamicSize = "0"; + position = "330 0"; + extent = "650 40"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiButtonCtrl() { + text = "Video"; + extent = "120 40"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.openOptionsCategory(\"Video\");"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Audio"; + position = "130 0"; + extent = "120 40"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.openOptionsCategory(\"Audio\");"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Keyboard/Mouse"; + position = "260 0"; + extent = "220 40"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.openOptionsCategory(\"KBM\");"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Controller"; + position = "480 0"; + extent = "160 40"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.openOptionsCategory(\"Controller\");"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + + new GuiControl(OptionsMenuNavButtonOverlay) { + extent = "1281 40"; horizSizing = "width"; + vertSizing = "height"; + profile = GuiNonModalDefaultProfile; + + new GuiBitmapCtrl(OptionsMenuPrevNavIcon) { + BitmapAsset = "UI:Keyboard_Black_Q_image"; + position = "0 10"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + + new GuiBitmapCtrl(OptionsMenuNextNavIcon) { + BitmapAsset = "UI:Keyboard_Black_E_image"; + position = "0 10"; + extent = "40 40"; + profile = GuiNonModalDefaultProfile; + vertSizing = "top"; + }; + }; + }; + new GuiScrollCtrl(OptionsMenuSettingsScroll) { + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + position = "240 110"; + extent = "800 573"; + horizSizing = "center"; + vertSizing = "height"; + profile = "GuiMenuScrollProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl(VideoSettingsList) { + class = "OptionsMenuList"; + padding = "5"; + changeChildSizeToFit = "0"; + position = "0 1"; + extent = "800 200"; + horizSizing = "width"; + vertSizing = "height"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_image"; - extent = "927 40"; + new GuiStackControl(AudioSettingsList) { + class = "OptionsMenuList"; + padding = "5"; + changeChildSizeToFit = "0"; + position = "0 1"; + extent = "800 200"; horizSizing = "width"; + vertSizing = "height"; profile = "GuiDefaultProfile"; + visible = "0"; tooltipProfile = "GuiToolTipProfile"; + hidden = "1"; }; + new GuiStackControl(KBMControlsList) { + class = "OptionsMenuList"; + padding = "5"; + changeChildSizeToFit = "0"; + position = "0 1"; + extent = "800 200"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "0"; + tooltipProfile = "GuiToolTipProfile"; + hidden = "1"; + }; + new GuiStackControl(GamepadControlsList) { + class = "OptionsMenuList"; + padding = "5"; + changeChildSizeToFit = "0"; + position = "0 1"; + extent = "800 200"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "0"; + tooltipProfile = "GuiToolTipProfile"; + hidden = "1"; + }; + }; + new GuiPanel(OptionMenuTitlePanel) { + extent = "1281 60"; + horizSizing = "width"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + new GuiTextCtrl() { text = "OPTIONS"; - position = "22 7"; - extent = "220 28"; + position = "22 23"; + extent = "1281 28"; profile = "MenuHeaderText"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiTextCtrl(OptionName) { - position = "3 606"; - extent = "293 17"; - horizSizing = "width"; - profile = "MenuSubHeaderText"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiMLTextCtrl(OptionDescription) { - text = "This is a placeholder text for an option."; - position = "3 625"; - extent = "293 14"; - horizSizing = "width"; - profile = "GuiMLTextProfile"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiSplitContainer() { - splitPoint = "250 100"; - fixedPanel = "FirstPanel"; - fixedSize = "250"; - position = "0 48"; - extent = "928 555"; - horizSizing = "width"; - profile = "GuiMenuScrollProfile"; - tooltipProfile = "GuiToolTipProfile"; - - new GuiPanel() { - docking = "Client"; - extent = "248 555"; - profile = "GuiOverlayProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "Panel1"; - - new GuiStackControl(OptionsMenuCategoryList) { - padding = "10"; - dynamicSize = "0"; - extent = "248 555"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - - new GuiButtonCtrl() { - text = "Display"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "populateDisplaySettingsList();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Graphics"; - position = "0 45"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "populateGraphicsSettingsList();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Audio"; - position = "0 90"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "populateAudioSettingsList();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Keyboard & Mouse"; - position = "0 135"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "populateKeyboardMouseSettingsList();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Gamepad"; - position = "0 180"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "populateGamepadSettingsList();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Example Options"; - position = "0 225"; - extent = "248 35"; - profile = "GuiMenuButtonProfile"; - command = "testExampleOptions();"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; - }; - new GuiPanel() { - docking = "Client"; - position = "252 0"; - extent = "676 555"; - profile = "GuiOverlayProfile"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "panel2"; - - new GuiScrollCtrl(OptionsMenuSettingsScroll) { - hScrollBar = "alwaysOff"; - vScrollBar = "dynamic"; - extent = "676 554"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiMenuScrollProfile"; - tooltipProfile = "GuiToolTipProfile"; - - new GuiStackControl(OptionsMenuSettingsList) { - padding = "5"; - changeChildSizeToFit = "0"; - position = "1 1"; - extent = "661 170"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - new GuiGameSettingsCtrl() { - PreviousBitmapAsset = "UI:previousOption_n_image"; - NextBitmapAsset = "UI:nextOption_n_image"; - columnSplit = "198"; - useMouseEvents = "1"; - extent = "661 30"; - horizSizing = "width"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuOptionsButton"; - }; - new GuiGameSettingsCtrl() { - PreviousBitmapAsset = "UI:previousOption_n_image"; - NextBitmapAsset = "UI:nextOption_n_image"; - columnSplit = "198"; - useMouseEvents = "1"; - position = "0 35"; - extent = "661 30"; - horizSizing = "width"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuOptionsButton"; - }; - new GuiGameSettingsCtrl() { - PreviousBitmapAsset = "UI:previousOption_n_image"; - NextBitmapAsset = "UI:nextOption_n_image"; - columnSplit = "198"; - useMouseEvents = "1"; - position = "0 70"; - extent = "661 30"; - horizSizing = "width"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuOptionsButton"; - }; - new GuiGameSettingsCtrl() { - PreviousBitmapAsset = "UI:previousOption_n_image"; - NextBitmapAsset = "UI:nextOption_n_image"; - columnSplit = "198"; - useMouseEvents = "1"; - position = "0 105"; - extent = "661 30"; - horizSizing = "width"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuOptionsButton"; - }; - new GuiGameSettingsCtrl() { - PreviousBitmapAsset = "UI:previousOption_n_image"; - NextBitmapAsset = "UI:nextOption_n_image"; - columnSplit = "198"; - useMouseEvents = "1"; - position = "0 140"; - extent = "661 30"; - horizSizing = "width"; - profile = "GuiMenuButtonProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuOptionsButton"; - }; - }; - }; - }; }; + new GuiPanel(OptionsMenuButtonPanel) { + position = "0 683"; + extent = "1281 40"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiMenuPanelProfile"; + tooltipProfile = "GuiToolTipProfile"; + new GuiIconButtonCtrl(OptionsMenuBackBtn) { + BitmapAsset = "UI:Keyboard_Black_Escape_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Back"; + position = "16 0"; + extent = "140 40"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "tryCloseOptionsMenu(1);"; + tooltipProfile = "GuiToolTipProfile"; + class = "MenuInputButton"; + }; + new GuiIconButtonCtrl(OptionsMenuRemapBtn) { + BitmapAsset = "UI:Keyboard_Black_Space_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Remap"; + position = "850 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenuActivateOption(1)"; + tooltipProfile = "GuiToolTipProfile"; + class = "MenuInputButton"; + }; + new GuiIconButtonCtrl(OptionsMenuApplyBtn) { + BitmapAsset = "UI:Keyboard_Black_Return_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Apply"; + position = "990 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.applyChangedOptions();"; + tooltipProfile = "GuiToolTipProfile"; + class = "MenuInputButton"; + }; + new GuiIconButtonCtrl(OptionsMenuResetBtn) { + BitmapAsset = "UI:Keyboard_Black_R_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Center"; + text = "Reset"; + position = "1135 0"; + extent = "140 40"; + horizSizing = "left"; + vertSizing = "center"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.resetSettings();"; + tooltipProfile = "GuiToolTipProfile"; + class = "MenuInputButton"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript index a8db2ba83..44321630a 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript @@ -1,53 +1,9 @@ -//options settings +$optionsEntryPad = 10; -//Screen and Display menu -//Renderer Mode -//Screen resolution -//Windowed/fullscreen(borderless?) -//VSync - -//Screen brightness -//screen brightness -//screen gamma - -//Lighting Menu -//Shadow Distance(Distance shadows are drawn to. Also affects shadowmap slices) -//Shadow Quality(Resolution of shadows rendered, setting to none disables dynamic shadows) -//Soft Shadows(Whether shadow softening is used) -//Shadow caching(If the lights enable it, shadow caching is activated) -//Light Draw Distance(How far away lights are still drawn. Doesn't impact vector lights like the sun) - -//Mesh and Textures Menu -//Draw distance(Overall draw distance) -slider -//Object draw distance(Draw distance from small/unimportant objects) -slider -//Mesh quality -//Texture quality -//Foliage draw distance -//Terrain Quality -//Decal Quality - -//Effects Menu -//Parallax -//HDR -//Light shafts -//Motion Blur -//Depth of Field -//SSAO -//AA(ModelXAmount)[defualt is FXAA] -//Anisotropic filtering - -//Keybinds - -//Camera -//horizontal mouse sensitivity -//vert mouse sensitivity -//invert vertical -//zoom mouse sensitivities(both horz/vert) -//headbob -//FOV - -$yesNoList = "No\tYes"; -$onOffList = "Off\tOn"; +$OptionsMenuCategories[0] = "Video"; +$OptionsMenuCategories[1] = "Audio"; +$OptionsMenuCategories[2] = "KBM"; +$OptionsMenuCategories[3] = "Controller"; function OptionsMenu::onAdd(%this) { @@ -56,1126 +12,1053 @@ function OptionsMenu::onAdd(%this) %this.optionsCategories = new ArrayObject(); } - if(!isObject(%this.unappliedChanges)) - { - %this.unappliedChanges = new ArrayObject(OptionsMenuUnappliedChanges); - } - %this.currentCategory = ""; - addOptionsMenuCategory("Display", "populateDisplaySettingsList();"); - addOptionsMenuCategory("Graphics", "populateGraphicsSettingsList();"); - addOptionsMenuCategory("Audio", "populateAudioSettingsList();"); - addOptionsMenuCategory("Keyboard & Mouse", "populateKeyboardMouseSettingsList();"); - addOptionsMenuCategory("Gamepad", "populateGamepadSettingsList();"); - callOnModules("populateOptionsMenuCategories", "Game"); } -function OptionsMenu::onOpen(%this) +function OptionsMenu::onWake(%this) { - OptionsMenuCategoryList.clear(); + %this.optsListCount = -1; + $optionsChangeRequiresRestart = false; - for(%i=0; %i < %this.optionsCategories.count(); %i++) + %this.populateVideoSettings(); + + %this.populateAudioSettings(); + + %this.populateKBMControls(); + + %this.populateGamepadControls(); + //establish the cached prefs values here + + %this.openOptionsCategory("Video"); +} + +if(!isObject( OptionsMenuActionMap ) ) +{ + new ActionMap(OptionsMenuActionMap){}; + + OptionsMenuActionMap.bind( keyboard, Escape, tryCloseOptionsMenu); + OptionsMenuActionMap.bind( gamepad, btn_b, tryCloseOptionsMenu); + + OptionsMenuActionMap.bind( keyboard, w, OptionMenuNavigatePrev ); + OptionsMenuActionMap.bind( keyboard, s, OptionMenuNavigateNext ); + OptionsMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", OptionMenuStickNavigate ); + OptionsMenuActionMap.bind( gamepad, upov, OptionMenuNavigatePrev ); + OptionsMenuActionMap.bind( gamepad, dpov, OptionMenuNavigateNext ); + + OptionsMenuActionMap.bind( keyboard, a, OptionMenuPrevSetting ); + OptionsMenuActionMap.bind( keyboard, d, OptionMenuNextSetting ); + OptionsMenuActionMap.bind( gamepad, xaxis, "D", "-0.23 0.23", OptionMenuStickChangeSetting ); + OptionsMenuActionMap.bind( gamepad, lpov, OptionMenuPrevSetting ); + OptionsMenuActionMap.bind( gamepad, rpov, OptionMenuNextSetting ); + + OptionsMenuActionMap.bind( keyboard, q, OptionsMenuPrevCategory ); + OptionsMenuActionMap.bind( gamepad, btn_l, OptionsMenuPrevCategory ); + + OptionsMenuActionMap.bind( keyboard, e, OptionsMenuNextCategory ); + OptionsMenuActionMap.bind( gamepad, btn_r, OptionsMenuNextCategory ); + + OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset ); + OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset ); + + OptionsMenuActionMap.bind( keyboard, Space, OptionsMenuActivateOption ); + OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption ); + + OptionsMenuActionMap.bind( keyboard, Enter, tryApplyOptions); + OptionsMenuActionMap.bind( gamepad, btn_start, tryApplyOptions); +} + +//============================================================================== +// This function updates all the elements in the actual lists to ensure they're +// sized, stylized and formatted correctly, as well as up to date values +function OptionsMenuList::syncGui(%this) +{ + %this.callOnChildren("setHighlighted", false); + + %btn = %this.getObject(%this.listPosition); + if(%btn.class $= "OptionsListEntry" || + %btn.class $= "OptionsListSliderEntry" || + %btn.class $= "OptionsKeybindEntry") + %btn-->button.setHighlighted(true); + + //iterate over the items and ensure that they are formatted well based on the settings selected + foreach(%option in %this) { - %catName = %this.optionsCategories.getKey(%i); - %callback = %this.optionsCategories.getValue(%i); + %container = %option-->valuesContainer; - %newCatButton = new GuiButtonCtrl() { - text = %catName; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "0 180"; - extent = "248 35"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = %callback; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - - OptionsMenuCategoryList.add(%newCatButton); + if(%option.class $= "OptionsListEntry") + { + %hasLevels = %option.optionsObject.getCount() <= 1; + + %optionObject = %option.optionsObject; + + //If it's out of range of the options, it's probably a custom value + if(%option.currentOptionIndex < %optionObject.getCount() && %option.currentOptionIndex >= 0) + { + %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + %currentOptionLevelTxt = %currentOptionLevel.displayName; + } + else + { + %currentOptionLevelTxt = "Custom"; + } + + %optionValTextWidth = %option-->optionValue.profile.getStringWidth(%currentOptionLevelTxt); + + %option-->optionValue.resize(%container.extent.x - %container-->prevValButton.extent.x - %optionValTextWidth - 20, 0, + %optionValTextWidth + 20, %container.extent.y); + + %option-->optionValue.text = %currentOptionLevelTxt; + + %container-->prevValButton.position.x = %option-->optionValue.position.x - 20; + %container-->nextValButton.position.x = %container.extent.x - %container-->prevValButton.extent.x; + + //if there's no alternatives, disable the left/right buttons + %container-->prevValButton.setHidden(%hasLevels); + %container-->nextValButton.setHidden(%hasLevels); + } + else if(%option.class $= "OptionsListSliderEntry") + { + } + else if(%option.class $= "OptionsKeybindEntry") + { + %bindImgAsset = getButtonBitmap(%option.device, getField(%option.keymap, 1)); + + if(%bindImgAsset $= "UI:Keyboard_Black_Blank_image") + %bindImgAsset = ""; + + %container-->bindButton.setBitmap(%bindImgAsset); + } + } +} + +function OptionsMenuList::checkForUnappliedChanges(%this) +{ + %unappliedChanges = false; + + foreach(%option in %this) + { + if(%option.class $= "OptionsListEntry") + { + if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount()) + { + %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex); + + if(!%targetOptionLevel.isCurrent()) + %unappliedChanges = true; + + if(%unappliedChanges && %option.optionsObject.requiresRestart) + $optionsChangeRequiresRestart = true; + } + } } - %this.unappliedChanges.empty(); - $pref::Video::displayDeviceId = ""; - - OptionsMenuCategoryList.setAsActiveMenuList(); - - $activeMenuButtonContainer-->button1.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();"); - $activeMenuButtonContainer-->button2.disable(); - $activeMenuButtonContainer-->button3.set("", "Space", "Apply", "OptionsMenu.apply();"); - $activeMenuButtonContainer-->button4.set("btn_a", "", "Select", "OptionsMenu.select();"); - $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();"); + return %unappliedChanges; } - -//We capitalize on the canClose test here, because we want to prompt for unapplied options changes before -//backing out. So when the UINavigation test canClose, we can see if we have unapplied settings and prompt -//that via the message box and return false. -//This gives the user a chance to choose how they wish to proceed before we allow the -//UINavigation to move away from the options menu -function OptionsMenu::canClose(%this) + +function OptionsMenuList::applyChanges(%this) { - //Another special case is us catching the 'back/pop' action by just shifting from one - //menu list to another. In this case, we check if we were on the settings list as our active MenuList - //if so, then the back/pop just moves us to the Category list as our active and we inform the - //UINavigation to not close the page - if(OptionsMenuSettingsList.isActiveMenuList()) + foreach(%option in %this) { - OptionsMenuCategoryList.setAsActiveMenuList(); - return false; + if(%option.class $= "OptionsListEntry") + { + //If it's custom or nonsensical index, there's some kind of external factor going on, so we're + //just going to skip applying it because we don't know what we'd be applying + if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount()) + { + %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex); + + if(!%targetOptionLevel.isCurrent()) + %targetOptionLevel.apply(); + } + } + } +} + +function OptionsMenu::openOptionsCategory(%this, %categoryName) +{ + VideoSettingsList.setVisible(%categoryName $= "Video"); + AudioSettingsList.setVisible(%categoryName $= "Audio"); + KBMControlsList.setVisible(%categoryName $= "KBM"); + GamepadControlsList.setVisible(%categoryName $= "Controller"); + + if(%categoryName $= "Video") + { + $MenuList = VideoSettingsList; + //Find our first non-group entry + while($MenuList.getObject($MenuList.listPosition).class !$= OptionsListEntry && $MenuList.listPosition < $MenuList.getCount()) + { + $MenuList.listPosition += 1; + } + + %this.currentCatgeoryIdx = 0; + } + else if(%categoryName $= "Audio") + { + $MenuList = AudioSettingsList; + + %this.currentCatgeoryIdx = 1; + } + else if(%categoryName $= "KBM") + { + $MenuList = KBMControlsList; + + %this.currentCatgeoryIdx = 2; + } + else if(%categoryName $= "Controller") + { + $MenuList = GamepadControlsList; + + %this.currentCatgeoryIdx = 3; + } + + $MenuList.syncGui(); + %this.syncGui(); +} + +//============================================================================== +// This function updates the non-list items of the menu to be up to date and stylistically +// complaint. This ensures keybind hint buttons are presented correctly based on the current input +// device +function OptionsMenu::syncGui(%this) +{ + OptionsMenuCategoryList.callOnChildren("setHighlighted", false); + + %btn = OptionsMenuCategoryList.getObject(%this.currentCatgeoryIdx); + %btn.setHighlighted(true); + + %buttonPosX = %btn.position.x + OptionsMenuCategoryList.position.x; + + OptionsMenuPrevNavIcon.position.x = %buttonPosX - 5; + OptionsMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 35; + + //Update the button imagery to comply to the last input device we'd used + %device = Canvas.getLastInputDevice(); + if(%device $= "mouse") + %device = "keyboard"; + + OptionsMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut")); + OptionsMenuResetBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuReset")); + + OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory")); + OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory")); + + OptionsMenuApplyBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "tryApplyOptions")); + + OptionsMenuRemapBtn.visible = KBMControlsList.visible || GamepadControlsList.visible; + OptionsMenuRemapBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuActivateOption")); +} + +//============================================================================== +// Menu navigation functions +// Primarily used by keybinds +function OptionsMenuPrevCategory(%val) +{ + if(%val) + { + %currentIdx = OptionsMenu.currentMenuIdx; + OptionsMenu.currentMenuIdx -= 1; + + OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3); + + if(%currentIdx == OptionsMenu.currentMenuIdx) + return; + + %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx]; + OptionsMenu.openOptionsCategory(%newCategory); + } +} + +function OptionsMenuNextCategory(%val) +{ + if(%val) + { + %currentIdx = OptionsMenu.currentMenuIdx; + OptionsMenu.currentMenuIdx += 1; + + OptionsMenu.currentMenuIdx = mClamp(OptionsMenu.currentMenuIdx, 0, 3); + + if(%currentIdx == OptionsMenu.currentMenuIdx) + return; + + %newCategory = $OptionsMenuCategories[OptionsMenu.currentMenuIdx]; + OptionsMenu.openOptionsCategory(%newCategory); + } +} + +function OptionMenuNavigatePrev(%val) +{ + if(%val) + { + $MenuList.listPosition -= 1; + while( $MenuList.listPosition >= 0 && ($MenuList.getObject($MenuList.listPosition).class !$= "OptionsListEntry" && + $MenuList.getObject($MenuList.listPosition).class !$= "OptionsListSliderEntry" && + $MenuList.getObject($MenuList.listPosition).class !$= "OptionsKeybindEntry")) + { + $MenuList.listPosition -= 1; + } + + if($MenuList.listPosition < 0) + $MenuList.listPosition = 0; + + $MenuList.syncGUI(); + + $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigatePrev", 1); } else { - //Here, we're on the category list as our active, so we're actually trying to leae the page - //If we have unapplied changes, we want to prompt about them before closing the page and navigating away - //If we don't, then we can process the popPage as normal and let the OptionsMenu close - if(%this.unappliedChanges.count() != 0) + cancel($BaseUI::scrollSchedule); + } +} + +function OptionMenuNavigateNext(%val) +{ + if(%val) + { + $MenuList.listPosition += 1; + while($MenuList.listPosition < $MenuList.getCount() && ($MenuList.getObject($MenuList.listPosition).class !$= "OptionsListEntry" && + $MenuList.getObject($MenuList.listPosition).class !$= "OptionsListSliderEntry" && + $MenuList.getObject($MenuList.listPosition).class !$= "OptionsKeybindEntry")) { - MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", - "OptionsMenu.apply(); MainMenuGUI.popPage();", "" @ %this @ ".unappliedChanges.empty(); " @ %this @ ".navigation.popPage();", - "Apply", "Discard"); - return false; + $MenuList.listPosition += 1; } - } - - return true; -} - -function OptionsMenu::onClose(%this) -{ - -} - -function OptionsMenuSettingsList::onAdd(%this) -{ -} - -function OptionsMenuSettingsList::getOptionsList(%this, %index) -{ -} - -function OptionsMenu::select(%this) -{ - if(OptionsMenuCategoryList.isActiveMenuList()) - { - OptionsMenuSettingsList.setAsActiveMenuList(); - } -} - -function OptionsMenu::apply(%this) -{ - //Now we run through our list of unapplied changes and... apply them. - %hasKeybindChanges = false; - %hasVideoChanges = false; - %hasPostFXChanges = false; - %hasAudioChanges = false; - %hasGraphicsChanges = false; - for(%i=0; %i < %this.unappliedChanges.count(); %i++) - { - %targetVar = %this.unappliedChanges.getKey(%i); - %newValue = strReplace(%this.unappliedChanges.getValue(%i), "\"", ""); - //First, lets just check through our action map names, see if any match - %wasKeybind = false; - for(%am=0; %am < ActionMapGroup.getCount(); %am++) - { - %actionMap = ActionMapGroup.getObject(%am); - - if(%actionMap == GlobalActionMap.getId()) - continue; + if($MenuList.listPosition >= $MenuList.getCount()) + $MenuList.listPosition = $MenuList.getCount()-1; - %actionMapName = %actionMap.getName(); - if(%actionMapName $= %targetVar) - { - %hasKeybindChanges = true; - %wasKeybind = true; - break; - } - } + $MenuList.syncGUI(); - if(!%wasKeybind) + $BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigateNext", 1); + } + else + { + cancel($BaseUI::scrollSchedule); + } +} + +function OptionMenuStickNavigate(%val) +{ + if(%val == 1) + OptionMenuNavigateNext(1); + else if(%val == -1) + OptionMenuNavigatePrev(1); + else + cancel($BaseUI::scrollSchedule); +} + +function OptionMenuPrevSetting(%val) +{ + if(!%val) + return; + + %option = $MenuList.getObject($MenuList.listPosition); + + if(!isObject(%option)) + return; + + if(%option.class $= "OptionsListEntry") + { + %optionObject = %option.optionsObject; + %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + %option.currentOptionIndex = mClamp(%option.currentOptionIndex-1, 0, %optionObject.getCount()-1); + + %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName); + } + else if(%option.class $= "OptionsListSliderEntry") + { + %sliderCtrl = %option-->valuesContainer-->slider; + %minValue = %sliderCtrl.range.x; + %maxValue = %sliderCtrl.range.y; + %ticks = %sliderCtrl.ticks; + + %tickIncrementVal = (%maxValue - %minValue) / %ticks; + + %sliderCtrl.value -= %tickIncrementVal; + } + + $MenuList.syncGUI(); +} + +function OptionMenuNextSetting(%val) +{ + if(!%val) + return; + + %option = $MenuList.getObject($MenuList.listPosition); + + if(!isObject(%option) ) + return; + + if(%option.class $= "OptionsListEntry") + { + %optionObject = %option.optionsObject; + %currentOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + %option.currentOptionIndex = mClamp(%option.currentOptionIndex+1, 0, %optionObject.getCount()-1); + + %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex); + + //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName); + } + else if(%option.class $= "OptionsListSliderEntry") + { + %sliderCtrl = %option-->valuesContainer-->slider; + %minValue = %sliderCtrl.range.x; + %maxValue = %sliderCtrl.range.y; + %ticks = %sliderCtrl.ticks; + + %tickIncrementVal = (%maxValue - %minValue) / %ticks; + + %sliderCtrl.value += %tickIncrementVal; + } + + $MenuList.syncGUI(); +} + +function OptionMenuStickChangeSetting(%val) +{ + if(%val == 1) + OptionMenuNextSetting(1); + else if(%val == -1) + OptionMenuPrevSetting(1); +} + +function OptionsMenuActivateOption(%val) +{ + if(!%val) + return; + + %option = $MenuList.getObject($MenuList.listPosition); + + if(!isObject(%option)) + return; + + if(%option.class $= "OptionsKeybindEntry") + { + %option-->button.execAltCommand(); + } +} + +//============================================================================== +// This function utilizes the VideoSettingsGroup SimGroup to populate options. +// The object is defined in core/rendering/scripts/graphicsOptions.tscript +// A majority of the options are statically defined, but some are dynamically populated +// on refresh, like the display device or available resolution options. +// Once populated, we loop over the simgroup structure to populate our option entry +// rows in the options menu itself. +function OptionsMenu::populateVideoSettings(%this) +{ + VideoSettingsList.clear(); + + VideoSettingsGroup::populateDisplaySettings(); + + for(%i=0; %i < VideoSettingsGroup.getCount(); %i++) + { + %setting = VideoSettingsGroup.getObject(%i); + + if(%setting.class $= "SubOptionsGroup") { - %sanitizedVar = strReplace(%targetVar, "[", ""); - %sanitizedVar = strReplace(%sanitizedVar, "]", ""); - %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); - %currentValue = getVariable(%sanitizedVar); - if(%currentValue !$= %newValue) + %entry = addOptionGroup(%setting.displayName); + + if(isObject(%entry)) + VideoSettingsList.add(%entry); + + for(%s=0; %s < %setting.getCount(); %s++) { - setVariable(%targetVar, %newValue); + %option = %setting.getObject(%s); - //now, lets check for special cases that need additional handling - //for updates - if ( %targetVar $= "$pref::Video::displayDevice" ) - { - schedule(32, 0, "MessageBoxOK", "Change requires restart", "Please restart the game for a display device change to take effect."); - } - else if(startsWith(%targetVar, "$pref::PostFX::")) - { - %hasPostFXChanges = true; - } - else if(startsWith(%targetVar, "$pref::Video::")) - { - %hasVideoChanges = true; - - //if it's the resolution, it's possible we got the human-friendly - //version stored off. if so, reprocess into the usable state - if(%targetVar $= "$pref::Video::Resolution") - { - if(strpos(%newValue, " x ") != -1) - { - %newValue = strreplace(%newValue, " x ", " "); - setVariable(%targetVar, %newValue); - } - } - //This is a bit of hackery to have an intermediate variable because we display in text - //but save by index, so we take the applied name and get the index of the deviceId - else if(%targetVar $= "$pref::Video::displayDeviceId") - { - %deviceId = getDisplayDeviceId($pref::Video::displayDeviceId); - if(%deviceId == -1) - %deviceId = 0; - - $pref::Video::deviceId = %deviceId; - $pref::Video::displayDeviceId = ""; - } - } - else if(startsWith(%targetVar, "$pref::SFX::")) - { - %hasAudioChanges = true; - } - else if(startsWith(%targetVar, "$pref::Graphics::")) - { - %hasGraphicsChanges = true; - } + %optionsEntry = addOptionEntry(%option); + + if(isObject(%optionsEntry)) + VideoSettingsList.add(%optionsEntry); } } - } - - //If we had keybind changes, go ahead and save those out - if(%hasKeybindChanges) - { - %prefPath = getPrefpath(); - - %actionMapCount = ActionMapGroup.getCount(); - - %actionMapList = ""; - %append = false; - for(%i=0; %i < %actionMapCount; %i++) + else if(%setting.class $= "OptionsSettings") { - %actionMap = ActionMapGroup.getObject(%i); + %optionsEntry = addOptionEntry(%setting); + + if(isObject(%optionsEntry)) + VideoSettingsList.add(%optionsEntry); + } + } + + //Ensure our newly templated options listings are sized right + for(%i=0; %i < VideoSettingsList.getCount(); %i++) + { + %entry = VideoSettingsList.getObject(%i); + %entry.resize(0, 0, VideoSettingsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad + } +} + +//============================================================================== +// This function utilizes the AudioSettingsGroup SimGroup to populate options. +// The object is defined in core/sfx/scripts/audioOptions.tscript +// Similar to the video options, it can be a mix of static and dynamically populated +// option entries, which we then iterate over and populate the entry rows for the menu +function OptionsMenu::populateAudioSettings(%this) +{ + AudioSettingsList.clear(); + AudioSettingsGroup.populateSettings(); + + //Process the lists + for(%i=0; %i < AudioSettingsGroup.getCount(); %i++) + { + %setting = AudioSettingsGroup.getObject(%i); + + if(%setting.class $= "SubOptionsGroup") + { + %entry = addOptionGroup(%setting.displayName); + + if(isObject(%entry)) + AudioSettingsList.add(%entry); - if(%actionMap == GlobalActionMap.getId()) - continue; - - %actionMap.save( %prefPath @ "/keybinds." @ $TorqueScriptFileExtension, %append ); - - if(%append != true) - %append = true; + for(%s=0; %s < %setting.getCount(); %s++) + { + %option = %setting.getObject(%s); + + %optionsEntry = addOptionEntry(%option); + + if(isObject(%optionsEntry)) + AudioSettingsList.add(%optionsEntry); + } + } + else if(%setting.class $= "AudioOptionsSettings") + { + %optionsEntry = addOptionEntry(%setting); + + if(isObject(%optionsEntry)) + AudioSettingsList.add(%optionsEntry); } } - if(%hasPostFXChanges) + AudioSettingsList.add(addOptionGroup("Channel Volume")); + + //Now we'll populate the sliders for the audio channels. + //The defaults of these are defined in core/sfx/scripts/audio.tscript + //These define the MasterVolume channel, as well as several other common defualt ones + //Because it's a variable list, this can be expanded by modules by just upping $AudioChannelCount + //and then defining the $AudioChannelName[x] with the displayed name and + //and the $AudioChannels[x] variable with the SFXSource object defined to it for the given channel + AudioSettingsList.add(addOptionSlider("Master Volume", "", "$pref::SFX::masterVolume", 0, 1, 10)); + + //We init to 1, because 0 is the reserved for the masterVolume in practice + for(%i=1; %i < $AudioChannelCount; %i++) { - updatePostFXSettings(); + AudioSettingsList.add(addOptionSlider($AudioChannelsName[%i] @ " Volume", "", "$pref::SFX::channelVolume" @ %i, 0, 1, 10)); + } + + //Ensure our newly templated options listings are sized right + for(%i=0; %i < AudioSettingsList.getCount(); %i++) + { + %entry = AudioSettingsList.getObject(%i); + %entry.resize(0, 0, AudioSettingsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad + } +} + +function OptionsMenu::populateKBMControls(%this) +{ + %this.populateKeybinds("keyboard", KBMControlsList); + + %this.syncGui(); + + KBMControlsList.syncGui(); +} + +function OptionsMenu::populateGamepadControls(%this) +{ + %this.populateKeybinds("gamepad", GamepadControlsList); + + %this.syncGui(); + + GamepadControlsList.syncGui(); +} + +function OptionsMenu::populateKeybinds(%this, %device, %controlsList) +{ + %controlsList.clear(); + + //build out our list of action maps + %actionMapCount = ActionMapGroup.getCount(); + + %actionMapList = ""; + for(%i=0; %i < %actionMapCount; %i++) + { + %actionMap = ActionMapGroup.getObject(%i); + + if(%actionMap == GlobalActionMap.getId()) + continue; + + %actionMapName = %actionMap.humanReadableName $= "" ? %actionMap.getName() : %actionMap.humanReadableName; + + //see if we have any actual listed remappable keys for this movemap. if so, drop it from the listing + %hasRemaps = false; + for ( %r = 0; %r < $RemapCount; %r++ ) + { + %testMapName = $RemapActionMap[%r].humanReadableName $= "" ? $RemapActionMap[%r].getName() : $RemapActionMap[%r].humanReadableName; + + if(%actionMapName $= %testMapName) + { + //got a match to at least one, so we're ok to continue + %hasRemaps = true; + break; + } + } + + if(!%hasRemaps) + continue; + + if(%actionMapList $= "") + %actionMapList = %actionMapName; + else + %actionMapList = %actionMapList TAB %actionMapName; } - if(%hasVideoChanges) + //If we didn't find any valid actionMaps, then just exit out + if(%actionMapList $= "") + return; + + if($activeRemapControlSet $= "") + $activeRemapControlSet = getField(%actionMapList, 0); + + for(%am = 0; %am < getFieldCount(%actionMapList); %am++) { - updateDisplaySettings(); + %currentActionMap = getField(%actionMapList, %am); + + //only add the group if we've got more than one group, otherwise it's obviously + //part of the single grouping + if(getFieldCount(%actionMapList) > 1) + { + %actionMapGroupEntry = addOptionGroup(%currentActionMap); + %controlsList.add(%actionMapGroupEntry); + } + + for ( %i = 0; %i < $RemapCount; %i++ ) + { + if(%device !$= "" && %device !$= $RemapDevice[%i]) + continue; + + %actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName; + + if(%currentActionMap !$= %actionMapName) + continue; + + %keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device ); + + %description = $RemapDescription[%i]; + + %remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description); + %controlsList.add(%remapEntry); + } } - if(%hasAudioChanges) + //Ensure our newly templated options listings are sized right + for(%i=0; %i < %controlsList.getCount(); %i++) { - updateAudioSettings(); + %entry = %controlsList.getObject(%i); + %entry.resize(0, 0, %controlsList.extent.x - 15, %entry.extent.y); //-10 for the scroll wheel pad + } +} + +//============================================================================== +function tryCloseOptionsMenu(%val) +{ + if(!%val) + return; + + $optionsChangeRequiresRestart = false; + + %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges(); + %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges(); + + //validate audio prefs + if($pref::SFX::masterVolume_tempVar !$= "" && $pref::SFX::masterVolume_tempVar != $pref::SFX::masterVolume) + %unappliedAudioChanges = true; + + for(%i=1; %i < $AudioChannelCount; %i++) + { + %tempVolume = getVariable("$pref::SFX::channelVolume" @ %i @ "_tempVar"); + if(%tempVolume !$= "" && $pref::SFX::channelVolume[ %i ] != %tempVolume) + %unappliedAudioChanges = true; } - if(%hasGraphicsChanges) + if(%unappliedVideoChanges || %unappliedAudioChanges) { - updateGraphicsSettings(); + MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", + "OptionsMenu.applyChangedOptions(); BaseUIBackOut(1);", "BaseUIBackOut(1);", + "Apply", "Discard"); } + else + { + BaseUIBackOut(1); + } +} + +function tryApplyOptions(%val) +{ + if(!%val) + return; + + $optionsChangeRequiresRestart = false; + %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges(); + %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges(); + + if(%unappliedVideoChanges || %unappliedAudioChanges) + OptionsMenu.applyChangedOptions(); +} + +function OptionsMenu::applyChangedOptions(%this) +{ + VideoSettingsList.applyChanges(); + AudioSettingsList.applyChanges(); + + //Process the audio channel tempvars to get their values + //and then apply them to the actual pref variable, as well as the SFXChannelVolume + $pref::SFX::masterVolume = $pref::SFX::masterVolume_tempVar; + sfxSetMasterVolume( $pref::SFX::masterVolume ); + + //0 is always master anyways + for(%i=1; %i < $AudioChannelCount; %i++) + { + %volume = getVariable("$pref::SFX::channelVolume" @ %i @ "_tempVar"); + sfxSetChannelVolume( %i, %volume ); + $pref::SFX::channelVolume[ %i ] = %volume; + } + //Finally, write our prefs to file %prefPath = getPrefpath(); export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false); - - OptionsMenu.unappliedChanges.empty(); + + if($optionsChangeRequiresRestart) + MessageBoxOK("Restart Required", "Some of your changes require the game to be restarted."); } -function OptionsMenu::resetToDefaults(%this) +function doKeyRemap( %optionEntry ) +{ + %name = getField(%optionEntry.keymap,0); + + RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ; + OptRemapInputCtrl.index = %optionEntry.remapIndex; + + $remapListDevice = %optionEntry.device; + + Canvas.pushDialog( RemapDlg ); +} + +function OptionsMenu::resetSettings(%this) { MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", ""); } -function OptionsMenu::refresh(%this) +//============================================================================== +// Option types +function addOptionGroup(%displayName) { - //cache our scroll position so we can ensure we end up back at it after the refresh - %lastScrollPos = OptionsMenuSettingsScroll.getScrollPosition(); + OptionsMenu.optsListCount++; + %group = new GuiTextCtrl() { + text = %displayName; + position = "0 0"; + extent = "500 45"; + profile = "MenuHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + canSave = false; + }; - %cat = %this.currentCategory; - if(%this.currentCategory !$= "") - { - if(!isInt(%this.currentCategory)) - { - %this.currentCategory = getOptionsCategoryIndexByName(%this.currentCategory); - } - - if(%this.currentCategory == -1) - return; - - %category = %this.optionsCategories.getKey(%this.currentCategory); - %command = %this.optionsCategories.getValue(%this.currentCategory); - eval(%command); - } - - //now, because we reconstruct the displayed set, we'll force the mouse(if we're using it as our input) - //to be poked so we can re-track to whatever control, if any, we're over - if($activeControllerType !$= "gamepad") - { - Canvas.setCursorPos(Canvas.getCursorPos()); - } - - //restore scroll position - OptionsMenuSettingsScroll.setScrollPosition(%lastScrollPos.x, %lastScrollPos.y); + return %group; } -function OptionsMenu::getOptionVariableValue(%this, %variableName) +function optionsMenuButton::onHighlighted(%this, %highlighted) { - %unappliedPrefIndex = %this.unappliedChanges.getIndexFromKey(%variableName); - if(%unappliedPrefIndex != -1) - { - %value = %this.unappliedChanges.getValue(%unappliedPrefIndex); - return strreplace(%value, "\"", ""); - } + %container = %this.getParent(); - %sanitizedVar = strReplace(%variableName, "[", ""); - %sanitizedVar = strReplace(%sanitizedVar, "]", ""); - %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); - return getVariable(%sanitizedVar); + %container-->optionName.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText; + %container-->optionDescription.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile; + + %valuesContainer = %container-->valuesContainer; + %valuesContainer-->optionValue.profile = %highlighted ? GuiMenuTextProfileHL : GuiMenuTextProfile; + + OptionsMenuSettingsScroll.scrollToObject(%container); } -function OptionsMenuSelectButton::onVisible(%this, %state) +function addOptionEntry(%optionObj) { - //We're sorta cheating here. - //This button should only be displayed when we're in the categories list - //so whenever the status changes, such as automatically refreshing due to - //navigation events, we'll just do a quick check to ensure we're - //in the right visibility mode - if(%state && OptionsMenuSettingsList.isActiveMenuList()) + OptionsMenu.optsListCount++; + if(!isObject(%optionObj) || (%optionObj.class !$= "OptionsSettings" && %optionObj.class !$= "AudioOptionsSettings")) { - %this.setHidden(true); + error("addOptionsEntry() - attempting to create a new options entry, but was provided an invalid options object"); + return 0; } -} -// -// -// -function populateDisplaySettingsList() -{ - OptionsMenuSettingsList.clear(); - OptionsMenu.currentCategory = "Display"; + %qualityLevel = getCurrentQualityLevel(%optionObj); - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); - - %apiList = ""; - %apiCount = GFXInit::getAdapterCount(); - %apiIdx = 0; - for(%i=0; %i < %apiCount; %i++) + if(isObject(%qualityLevel)) { - %api = GFXInit::getAdapterType(%i); - - if(%api !$= "NullDevice") - { - if(%apiIdx==0) - %apiList = %api; - else - %apiList = %apiList TAB %api; - - %apiIdx++; - } - } - - trim(%apiList); - - %displayDevice = OptionsMenu.getOptionVariableValue("$pref::Video::displayDevice"); - if(%displayDevice $= "") - %displayDevice = getDisplayDeviceType(); - - OptionsMenuSettingsList.addOptionRow("Display API", "$pref::Video::displayDevice", %apiList, false, "", true, "The display API used for rendering.", %displayDevice); - - %numDevices = Canvas.getMonitorCount(); - - %devicesList = getDisplayDeviceList(); - - if($pref::Video::displayDeviceId $= "") - $pref::Video::displayDeviceId = getField(%devicesList, $pref::Video::deviceId); - - OptionsMenuSettingsList.addOptionRow("Display Device", "$pref::Video::displayDeviceId", %devicesList, false, "", true, "The display devices the window should be on."); - - if (%numDevices > 1) - OptionsMenuSettingsList.setRowEnabled(1, true); + %qualityLevelText = %qualityLevel.displayName; + %qualityLevelIndex = %optionObj.getObjectIndex(%qualityLevel); + } else - OptionsMenuSettingsList.setRowEnabled(1, false); - - %mode = OptionsMenu.getOptionVariableValue("$pref::Video::deviceMode"); - if(isInt(%mode)) - %mode = getField($Video::ModeTags, $pref::Video::deviceMode); - OptionsMenuSettingsList.addOptionRow("Window Mode", "$pref::Video::deviceMode", $Video::ModeTags, false, "", true, "", %mode); - - if(%mode !$= "Borderless") { - %resolutionList = getScreenResolutionList($pref::Video::deviceId, $Video::Mode[%mode]); - %resolution = OptionsMenu.getOptionVariableValue("$pref::Video::Resolution"); - if(%resolution $= "") - %resolution = $pref::Video::mode; - - %resolution = _makePrettyResString(%resolution); - - OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "", true, "Resolution of the game window", %resolution); - - // If the requested resolution could not be set, mark the control and pref as changed. - %resControl = OptionsMenuSettingsList.getObject(OptionsMenuSettingsList.getCount()-1); - if (%resControl.getCurrentOption() !$= %resolution) - %resControl.onChange(); + %qualityLevelText = %qualityLevel; + %qualityLevelIndex = %optionObj.getCount(); } - OptionsMenuSettingsList.addOptionBoolRow("VSync", "$pref::Video::enableVerticalSync", $YesNoList, false, "", true, "", ""); - - - %refreshList = getScreenRefreshList($pref::Video::mode); - OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "", true, "", OptionsMenu.getOptionVariableValue("$pref::Video::RefreshRate")); + %optionNameHeight = 20; + if(%optionObj.Description $= "") + %optionNameHeight = 40; - //move to gameplay tab - //OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", ""); - - //OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", ""); - //OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", ""); -} - -// -// -// -function populateGraphicsSettingsList() -{ - OptionsMenuSettingsList.clear(); - - OptionsMenu.currentCategory = "Graphics"; - - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); - - %yesNoList = "No\tYes"; - %onOffList = "Off\tOn"; - %anisoFilter = "Off\t4\t8\t16"; - %aaTypeFilter = "None\tFXAA\tSMAA\tSMAA High"; - OptionsMenuSettingsList.addOptionQualityLevelRow("Lighting Quality", "$pref::Graphics::LightingQuality", - LightingQualityList, false, "", true, "Amount and drawdistance of local lights"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Shadow Quality", "$pref::Graphics::ShadowQuality", - ShadowQualityList, false, "", true, "Shadow revolution quality"); - - %shadowQuality = OptionsMenu.getOptionVariableValue("$pref::Graphics::ShadowQuality"); - if(%shadowQuality !$= "None") - { - OptionsMenuSettingsList.addOptionQualityLevelRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", - SoftShadowList, false, "", true, "Amount of softening applied to shadowmaps"); - } - - OptionsMenuSettingsList.addOptionQualityLevelRow("Mesh Quality", "$pref::Graphics::MeshQuality", - MeshQualityGroup, false, "", true, "Fidelity of rendering of mesh objects"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", - MeshDrawDistQualityGroup, false, "", true, "Dictates if and when static objects fade out in the distance"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Texture Quality", "$pref::Graphics::TextureQuality", - TextureQualityGroup, false, "", true, "Fidelity of textures"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Terrain Quality", "$pref::Graphics::TerrainQuality", - TerrainQualityGroup, false, "", true, "Quality level of terrain objects"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", - DecalLifetimeGroup, false, "", true, "How long decals are rendered"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", - GroundCoverDensityGroup, false, "", true, "Density of ground cover items, such as grass"); - OptionsMenuSettingsList.addOptionQualityLevelRow("Shader Quality", "$pref::Graphics::ShaderQuality", - ShaderQualityGroup, false, "", true, "Dictates the overall shader quality level, adjusting what features are enabled."); - OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "", true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance"); - - OptionsMenuSettingsList.addOptionRow("Anti-Aliasing Type", "$pref::Video::AAMode", %aaTypeFilter, false, "", true, "The Anti-Aliasing Method applied to rendering"); - - OptionsMenuSettingsList.addOptionBoolRow("Parallax", "$pref::Video::enableParallaxMapping", %onOffList, false, "", true, "Whether the surface parallax shader effect is enabled", ""); - OptionsMenuSettingsList.addOptionBoolRow("Water Reflections", "$pref::Water::enableTrueReflections", %onOffList, false, "", true, "Whether water reflections are enabled", ""); - - OptionsMenuSettingsList.addOptionBoolRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "", true, "Whether Screen-Space Ambient Occlusion is enabled"); - OptionsMenuSettingsList.addOptionBoolRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "", true, "Whether the Depth of Field effect is enabled"); - OptionsMenuSettingsList.addOptionBoolRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "", true, "Whether the vignette effect is enabled"); - OptionsMenuSettingsList.addOptionBoolRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "", true, "Whether the light rays effect is enabled"); -} - -function updateGraphicsSettings() -{ - if($pref::Graphics::LightingQuality !$= getCurrentQualityLevel(LightingQualityList)) - LightingQualityList.applySetting($pref::Graphics::LightingQuality); - if($pref::Graphics::ShadowQuality !$= getCurrentQualityLevel(ShadowQualityList)) - ShadowQualityList.applySetting($pref::Graphics::ShadowQuality); - if($pref::Graphics::SoftShadowQuality !$= getCurrentQualityLevel(SoftShadowList)) - SoftShadowList.applySetting($pref::Graphics::SoftShadowQuality); - - if($pref::Graphics::MeshQuality !$= getCurrentQualityLevel(MeshQualityGroup)) - MeshQualityGroup.applySetting($pref::Graphics::MeshQuality); - if($pref::Graphics::ObjectDrawDistance !$= getCurrentQualityLevel(MeshDrawDistQualityGroup)) - MeshDrawDistQualityGroup.applySetting($pref::Graphics::ObjectDrawDistance); - if($pref::Graphics::TextureQuality !$= getCurrentQualityLevel(TextureQualityGroup)) - { - TextureQualityGroup.applySetting($pref::Graphics::TextureQuality); - - reloadTextures(); - } - if($pref::Graphics::TerrainQuality !$= getCurrentQualityLevel(TerrainQualityGroup)) - TerrainQualityGroup.applySetting($pref::Graphics::TerrainQuality); - if($pref::Graphics::DecalLifetime !$= getCurrentQualityLevel(DecalLifetimeGroup)) - DecalLifetimeGroup.applySetting($pref::Graphics::DecalLifetime); - if($pref::Graphics::GroundCoverDensity !$= getCurrentQualityLevel(GroundCoverDensityGroup)) - GroundCoverDensityGroup.applySetting($pref::Graphics::GroundCoverDensity); - if($pref::Graphics::ShaderQuality !$= getCurrentQualityLevel(ShaderQualityGroup)) - { - ShaderQualityGroup.applySetting($pref::Graphics::ShaderQuality); - //this has ties into postFX behaviors, so we'll force an update to it here - updatePostFXSettings(); - } -} - -function updateDisplaySettings() -{ - //Update the display settings now - %deviceName = getDisplayDeviceName(); - %newDeviceID = getWord(%deviceName, 0) - 1; - - if(!isInt($pref::Video::deviceMode)) - { - //probably saved out as the mode name, so just translate it back - for(%i=0; %i < getFieldCount($Video::ModeTags); %i++) - { - if(getField($Video::ModeTags, %i) $= $pref::Video::deviceMode) - { - $pref::Video::deviceMode = %i; - break; - } - } - } - - %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode); - %newDeviceMode = 0; - foreach$(%modeName in $Video::ModeTags) - { - if (%deviceModeName $= %modeName) - break; - else - %newDeviceMode++; - } - - if($pref::Video::deviceMode == $Video::ModeBorderless) - { - //if we're changing to borderless, we swap to the full resolution of the desktop - $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode); - - $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y; - } - - %newRes = $pref::Video::Resolution; - %newBpp = 32; // ... its not 1997 anymore. - %newFullScreen = %deviceModeName $= "Fullscreen" ? true : false; - %newRefresh = $pref::Video::RefreshRate; - %newVsync = $pref::Video::enableVerticalSync; - %newAA = $pref::Video::AA; - - // Build the final mode string. - %newMode = $pref::Video::Resolution SPC %newFullScreen SPC %newBpp SPC %newRefresh SPC %newAA; - - // Change the video mode. - if ( %newMode !$= $pref::Video::mode || %newDeviceID != $pref::Video::deviceId || - %newVsync != $pref::Video::enableVerticalSync || %newDeviceMode != $pref::Video::deviceMode) - { - //****Edge Case Hack - // If we're in fullscreen mode and switching to a different monitor at the - // same resolution and maintaining fullscreen, GFX...WindowTarget::resetMode() - // will early-out because there is no "mode change" and the monitor change - // will not get applied. Instead of modifying platform code, we're going to - // move onto the new monitor in borderless and immediately switch to FS. - if (%newFullScreen && $pref::Video::FullScreen && - ($pref::Video::Resolution $= %newRes) && ($pref::Video::deviceId != %newDeviceID)) - { - $pref::Video::deviceId = %newDeviceID; - $pref::Video::deviceMode = $Video::ModeBorderless; - %tmpModeStr = Canvas.getMonitorMode(%newDeviceID, 0); - Canvas.setVideoMode(%tmpModeStr.x, %tmpModeStr.y, false, 32, getWord(%tmpModeStr, $WORD::REFRESH), %newAA); - } - - $pref::Video::mode = %newMode; - $pref::Video::enableVerticalSync = %newVsync; - $pref::Video::deviceId = %newDeviceID; - $pref::Video::deviceMode = %newDeviceMode; - $pref::Video::Resolution = %newRes; - $pref::Video::FullScreen = %newFullScreen; - $pref::Video::RefreshRate = %newRefresh; - $pref::Video::AA = %newAA; - configureCanvas(); - } -} - -function updatePostFXSettings() -{ - PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO); - PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF); - PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays); - PostFXManager.settingsEffectSetEnabled(vignettePostFX, $pref::PostFX::EnableVignette); -} - -// -// -// -function populateAudioSettingsList() -{ - OptionsMenuSettingsList.clear(); - - OptionsMenu.currentCategory = "Audio"; - - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); - - %buffer = sfxGetAvailableDevices(); - %count = getRecordCount( %buffer ); - %audioDriverList = ""; - %audioProviderList = ""; - %audioDeviceList = ""; - - $currentAudioProvider = $currentAudioProvider $= "" ? $pref::SFX::provider : $currentAudioProvider; - - for(%i = 0; %i < %count; %i++) - { - %record = getRecord(%buffer, %i); - %provider = getField(%record, 0); - %device = getField(%record, 1); - - //When the client is actually running, we don't care about null audo devices - if(%provider $= "null") - continue; - - if(%audioProviderList $= "") - %audioProviderList = %provider; - else - %audioProviderList = %audioProviderList @ "\t" @ %provider; - - if(%provider $= $currentAudioProvider) - { - if(%audioDeviceList $= "") - %audioDeviceList = %device; - else - %audioDeviceList = %audioDeviceList @ "\t" @ %device; - } - } - - OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::provider", %audioProviderList, false, "audioProviderChanged", true, ""); - OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true); - - OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[" @ $GuiAudioType @ "]", 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[" @ $SimAudioType @ "]", 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[" @ $MusicAudioType @ "]", 0.1, "0 1", ""); -} - -function audioProviderChanged() -{ - //Get the option we have set for the provider - %provider = OptionsMenuSettingsList.getCurrentOption(0); - $currentAudioProvider = %provider; - - //And now refresh the list to get the correct devices - populateAudioSettingsList(); -} - -function updateAudioSettings() -{ - //$pref::SFX::masterVolume = OptionsMenuSettingsList.getValue(2); - sfxSetMasterVolume( $pref::SFX::masterVolume ); - - //$pref::SFX::channelVolume[ $GuiAudioType ] = OptionsMenuSettingsList.getValue(3); - //$pref::SFX::channelVolume[ $SimAudioType ] = OptionsMenuSettingsList.getValue(4); - //$pref::SFX::channelVolume[ $MusicAudioType ] = OptionsMenuSettingsList.getValue(5); - - sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] ); - sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] ); - sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] ); - - //$pref::SFX::provider = OptionsMenuSettingsList.getCurrentOption(0); - //$pref::SFX::device = OptionsMenuSettingsList.getCurrentOption(1); - - if ( !sfxCreateDevice( $pref::SFX::provider, - $pref::SFX::device, - $pref::SFX::useHardware, - -1 ) ) - error( "Unable to create SFX device: " @ $pref::SFX::provider - SPC $pref::SFX::device - SPC $pref::SFX::useHardware ); - - if( !isObject( $AudioTestHandle ) ) - { - sfxPlay(menuButtonPressed); - } -} - -// -// -// -function populateKeyboardMouseSettingsList() -{ - OptionsMenuSettingsList.clear(); - - OptionsMenu.currentCategory = "Keyboard & Mouse"; - - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); - - $remapListDevice = "keyboard"; - fillRemapList(); - - //OptionsMenuSettingsList.refresh(); -} - -function populateGamepadSettingsList() -{ - OptionsMenuSettingsList.clear(); - - OptionsMenu.currentCategory = "Gamepad"; - - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); - - $remapListDevice = "gamepad"; - fillRemapList(); - - OptionsMenuSettingsList.updateStack(); -} - -// -// -// -function getDisplayDeviceList() -{ - %numDevices = Canvas.getMonitorCount(); - %devicesList = ""; - for(%i = 0; %i < %numDevices; %i++) - { - %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i); - if(%i==0) - %devicesList = %device; - else - %devicesList = %devicesList @ "\t" @ %device; - } - - return %devicesList; -} - -function getDisplayDeviceId(%displayDeviceName) -{ - %deviceList = getDisplayDeviceList(); - - %deviceCount = getFieldCount(%deviceList); - for(%d = 0; %d < %deviceCount; %d++) - { - %deviceName = getField(%deviceList, %d); - if(%deviceName $= %displayDeviceName) - return %d; - } - - return -1; -} -// -// -// -function OptionsMenuList::activateRow(%this) -{ - //OptionsMenuSettingsList.setFirstResponder(); - OptionsMenuSettingsList.setAsActiveMenuList(); -} - -function OptionsMenuSettingsList::setRowEnabled(%this, %row, %status) -{ - %option = %this.getObject(%row); - if(isObject(%option)) - { - %option.setEnabled(%status); - } -} - -function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue) -{ - if(%enabled $= "") - %enabled = true; - - %optionsRowSize = 30; - %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? - - %option = new GuiGameSettingsCtrl() { - class = "MenuOptionsButton"; - profile = "GuiMenuButtonProfile"; + %entry = new GuiContainer() { + position = "0 0"; + extent = "800 40"; + profile = GuiMenuDefaultProfile; + tooltipProfile = "GuiToolTipProfile"; horizSizing = "width"; vertSizing = "bottom"; - position = "0 0"; - extent = %this.extent.x SPC %optionsRowSize; - columnSplit = %optionColumnWidth; - useMouseEvents = true; - previousBitmapAsset = "UI:previousOption_n_image"; - nextBitmapAsset = "UI:nextOption_n_image"; - }; - - %option.targetPrefVar = %targetPrefVar; //create a var-option association - - if(%defaultValue $= "") - { - %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar); - if(%unappliedPrefIndex != -1) - { - %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex); - %defaultValue = strreplace(%value, "\"", ""); - } - - if(%defaultValue $= "") - { - %sanitizedVar = strReplace(%targetPrefVar, "[", ""); - %sanitizedVar = strReplace(%sanitizedVar, "]", ""); - %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); - %defaultValue = getVariable(%sanitizedVar); - } - } - - /*if(%defaultValue $= "Off" || %defaultValue $= "No") - %defaultValue = "0"; - if(%defaultValue $= "On" || %defaultValue $= "Yes") - %defaultValue = "1";*/ - - %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue); + class = "OptionsListEntry"; + optionsObject = %optionObj; + currentOptionIndex = %qualityLevelIndex; + selectionID = OptionsMenu.optsListCount; + canSave = false; + + new GuiButtonCtrl() { + profile = GuiMenuButtonProfile; + position = "0 0"; + extent = "800 40"; + horizSizing = "width"; + vertSizing = "height"; + internalName = "button"; + class = "optionsMenuButton"; + }; - %this.add(%option); -} - -function OptionsMenuSettingsList::addOptionQualityLevelRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue) -{ - if(%defaultValue $= "") - { - %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar); - if(%unappliedPrefIndex != -1) - { - %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex); - %defaultValue = strreplace(%value, "\"", ""); - } - - if(%defaultValue $= "") - { - %sanitizedVar = strReplace(%targetPrefVar, "[", ""); - %sanitizedVar = strReplace(%sanitizedVar, "]", ""); - %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); - %defaultValue = getVariable(%sanitizedVar); - } + new GuiTextCtrl() { + text = %optionObj.OptionName; + position = $optionsEntryPad SPC -1; + extent = 400 SPC %optionNameHeight; + profile = "MenuSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "optionName"; + }; + new GuiTextCtrl() { + text = %optionObj.Description; + position = $optionsEntryPad SPC 17; + extent = "400 18"; + profile = "GuiMLTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "optionDescription"; + }; + + new GuiContainer() { + position = "400 0"; + extent = "400 40"; + profile = GuiModelessDialogProfile; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "left"; + vertSizing = "height"; + internalName = "valuesContainer"; - if(%defaultValue $= "") - %defaultValue = getCurrentQualityLevel(%qualityLevelList); - } + new GuiButtonCtrl() { + position = "310 0"; + extent = "20 40"; + text = "<"; + profile = GuiMenuButtonProfile; + internalName = "prevValButton"; + command = "$MenuList.listPosition = $thisControl.getParent().getParent().selectionID; OptionMenuPrevSetting(1);"; + }; + + new GuiTextCtrl() { + text = %qualityLevelText; + position = "330 0"; + extent = "50 40"; + profile = "GuiMenuTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "right"; + vertSizing = "center"; + internalName = "optionValue"; + }; + + new GuiButtonCtrl() { + position = "380 0"; + extent = "20 40"; + text = ">"; + profile = GuiMenuButtonProfile; + internalName = "nextValButton"; + command = "$MenuList.listPosition = $thisControl.getParent().getParent().selectionID; OptionMenuNextSetting(1);"; + }; + }; + }; - return %this.addOptionRow(%label, %targetPrefVar, getQualityLevels(%qualityLevelList), - %wrapOptions, %callback, %enabled, %description, %defaultValue); + return %entry; } -function OptionsMenuSettingsList::addOptionBoolRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue, %inverted) +function addOptionSlider(%optionName, %optionDesc, %prefName, %sliderMin, %sliderMax, %sliderTicks) { - if(%defaultValue $= "") - %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar); - - if(%inverted $= "") - %inverted = false; - - //Lame and hacky, but some variables are 'disabled' and some are 'enabled' - if(isInt(%defaultValue) && %inverted) - { - if(%defaultValue == 0) - %defaultValue = 1; - else - %defaultValue = 0; - } + OptionsMenu.optsListCount++; + %currentVal = getVariable(%prefName); - if(%qualityLevelList $= $yesNoList && isInt(%defaultValue)) - { - %defaultValue = convertBoolToYesNo(%defaultValue); - } - else if(%qualityLevelList $= $onOffList && isInt(%defaultValue)) - { - %defaultValue = convertBoolToOnOff(%defaultValue); - } - - return %this.addOptionRow(%label, %targetPrefVar, %qualityLevelList, - %wrapOptions, %callback, %enabled, %description, %defaultValue); -} - -function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %increment, %range, %callback, %enabled, %description, %defaultValue) -{ - if(%enabled $= "") - %enabled = true; + %tempVarName = %prefName @ "_tempVar"; + + if(%currentVal $= "") + %currentVal = %sliderMin; - %optionsRowSize = 30; - %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? + setVariable(%tempVarName, %currentVal); - %option = new GuiGameSettingsCtrl() { - class = "MenuOptionsButton"; - profile = "GuiMenuButtonProfile"; + %optionNameHeight = 20; + if(%optionDesc $= "") + %optionNameHeight = 40; + + %entry = new GuiContainer() { + position = "0 0"; + extent = "800 40"; + profile = GuiMenuDefaultProfile; + tooltipProfile = "GuiToolTipProfile"; horizSizing = "width"; vertSizing = "bottom"; - position = "0 0"; - extent = %this.extent.x SPC %optionsRowSize; - columnSplit = %optionColumnWidth; - useMouseEvents = true; - }; - - %option.targetPrefVar = %targetPrefVar; //create a var-option association - - if(%defaultValue $= "") - %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar); - - %option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description); + class = "OptionsListSliderEntry"; + canSave = false; + + new GuiButtonCtrl() { + profile = GuiMenuButtonProfile; + position = "0 0"; + extent = "800 40"; + horizSizing = "width"; + vertSizing = "height"; + internalName = "button"; + class = "optionsMenuButton"; + }; - %this.add(%option); + new GuiTextCtrl() { + text = %optionName; + position = $optionsEntryPad SPC -1; + extent = 400 SPC %optionNameHeight; + profile = "MenuSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "optionName"; + }; + + new GuiTextCtrl() { + text = %optionDesc; + position = $optionsEntryPad SPC 17; + extent = "400 18"; + profile = "GuiMLTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "optionDescription"; + }; + + new GuiContainer() { + position = "400 0"; + extent = "400 40"; + profile = GuiModelessDialogProfile; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "left"; + vertSizing = "height"; + internalName = "valuesContainer"; + + new GuiSliderCtrl() { + range = %sliderMin SPC %sliderMax; + ticks = %sliderTicks; + snap = "1"; + value = %currentVal; + variable = %tempVarName; + useFillBar = "1"; + fillBarColor = $TextMediumEmphasisColor; + renderTicks = "0"; + position = "0 10"; + extent = "400 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "center"; + profile = GuiMenuButtonProfile; + visible = "1"; + active = "1"; + command = "$thisControl.updateSliderValue();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + class = "OptionsSliderEntrySlider"; + internalName = "slider"; + }; + }; + }; + + return %entry; } -function OptionsMenuSettingsList::addKeybindRow(%this, %label, %bitmapName, %callback, %enabled, %description, %remapIndex) +function OptionsSliderEntrySlider::updateSliderValue(%this) { - if(%enabled $= "") - %enabled = true; - - %optionsRowSize = 40; - %optionColumnWidth = %this.extent.x * 0.5;//todo, calculate off longest option text? - - %option = new GuiGameSettingsCtrl() { - class = "MenuOptionsButton"; - profile = "GuiMenuButtonProfile"; + //update settings value here +} + +function OptionsMenuActionMapButton::onHighlighted(%this, %highlighted) +{ + %container = %this.getParent(); + %container-->actionName.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText; + + OptionsMenuSettingsScroll.scrollToObject(%container); +} + +function addActionMapEntry(%actionMap, %device, %keyMap, %index, %description) +{ + %entry = new GuiContainer() { + position = "0 0"; + extent = "800 40"; + profile = GuiMenuDefaultProfile; + tooltipProfile = "GuiToolTipProfile"; horizSizing = "width"; vertSizing = "bottom"; - position = "0 0"; - extent = %this.extent.x SPC %optionsRowSize; - columnSplit = %optionColumnWidth; - useMouseEvents = true; - }; - - %option.remapIndex = %remapIndex; - - %option.setKeybindSetting(%label, %bitmapName, %callback, %enabled, %description); - - %this.add(%option); -} - -// -function OptionsMenuCategoryList::onNavigate(%this, %index) -{ - OptionsMenu.currentCategory = %index; - %this.getObject(%index).performClick(); -} - -function convertOptionToBool(%val) -{ - if(%val $= "yes" || %val $= "on") - return 1; - else - return 0; -} - -function convertBoolToYesNo(%val) -{ - if(%val == 1) - return "Yes"; - else if(%val == 0) - return "No"; + class = "OptionsKeybindEntry"; + actionMap = %actionMap; + device = %device; + keymap = %keyMap; + remapIndex = %index; + canSave = false; - return %val; -} + new GuiButtonCtrl() { + profile = GuiMenuButtonProfile; + position = "0 0"; + extent = "800 40"; + horizSizing = "width"; + vertSizing = "height"; + internalName = "button"; + class = "OptionsMenuActionMapButton"; + altCommand = "doKeyRemap($thisControl.getParent());"; + }; -function convertBoolToOnOff(%val) -{ - if(%val == 1) - return "On"; - else if(%val == 0) - return "Off"; + new GuiTextCtrl() { + text = getField(%keyMap, 0); + position = $optionsEntryPad SPC -1; + extent = "400 40"; + profile = "MenuSubHeaderText"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "actionName"; + }; - return %val; -} - -function getDisplayDeviceName() -{ - %numDevices = Canvas.getMonitorCount(); - %devicesList = ""; - for(%i = 0; %i < %numDevices; %i++) - { - %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i); - if(%i==0) - %devicesList = %device; - else - %devicesList = %devicesList @ "\t" @ %device; - } - - return getField(%devicesList, $pref::Video::deviceId); -} -// -// -// -function MenuOptionsButton::onMouseEnter(%this) -{ - if(isObject(OptionName)) - OptionName.setText(%this.getLabel()); - if(isObject(OptionDescription)) - OptionDescription.setText(%this.getToolTip()); -} - -function MenuOptionsButton::onMouseLeave(%this) -{ - if(isObject(OptionName)) - OptionName.setText(""); - if(isObject(OptionDescription)) - OptionDescription.setText(""); -} - -function MenuOptionsButton::onHighlighted(%this, %state) -{ - MenuListButton::onHighlighted(%this, %state); -} - -function MenuOptionsButton::onChange(%this) -{ - %optionMode = %this.getMode(); - %optionName = %this.getLabel(); - %tooltipText = %this.getTooltip(); - - %targetVar = %this.targetPrefVar; - - OptionName.setText(%optionName); - OptionDescription.setText(%tooltipText); - - if(%optionMode == 0) - { - %currentValue = %this.getCurrentOption(); - if(%currentValue !$= "") - { - if(%currentValue $= "yes" || %currentValue $= "on") - %saveReadyValue = 1; - else if(%currentValue $= "no" || %currentValue $= "off") - %saveReadyValue = 0; - else - %saveReadyValue = %currentValue; + new GuiContainer() { + position = "400 3"; + extent = "400 34"; + profile = GuiModelessDialogProfile; + tooltipProfile = "GuiToolTipProfile"; + horizSizing = "left"; + vertSizing = "height"; + internalName = "valuesContainer"; - %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar); - if(%prefIndex == -1) - { - echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %saveReadyValue); - OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %saveReadyValue @ "\"" ); - } - else - { - echo("Setting UnappliedChanges via modify: key:" @ %targetVar @", value: " @ %saveReadyValue); - OptionsMenu.unappliedChanges.setValue("\"" @ %saveReadyValue @ "\"", %prefIndex); - } - } - } - else if(%optionMode == 1) - { - %currentValue = %this.getValue(); - - %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar); - if(%prefIndex == -1) - { - echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %currentValue); - OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %currentValue @ "\"" ); - } - else - { - OptionsMenu.unappliedChanges.setValue("\"" @ %currentValue @ "\"", %prefIndex); - } - } + new GuiIconButtonCtrl() { + position = "300 -10"; + extent = "98 45"; + BitmapAsset = ""; + profile = GuiRemapActionMapButtonProfile; + sizeIconToButton = true; + makeIconSquare = true; + iconLocation = "center"; + internalName = "bindButton"; + active = false; + }; + }; + }; - //Update the UI in case there's responsive logic - OptionsMenu.schedule(32, "refresh"); -} - -function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind) -{ - %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%actionMap); - if(%prefIndex == -1) - OptionsMenu.unappliedChanges.add(%actionMap, %keybind); - else - OptionsMenu.unappliedChanges.setValue(%keybind, %prefIndex); -} - -// -// Indicates what category the options item should be added into -// -function addOptionsMenuCategory(%categoryName, %selectCallback) -{ - //Don't add duplicates! - %index = OptionsMenu.optionsCategories.getIndexFromKey(%categoryName); - if(%index == -1) - OptionsMenu.optionsCategories.add(%categoryName, %selectCallback); -} - -function removeOptionsMenuCategory(%categoryName) -{ - %index = OptionsMenu.optionsCategories.getIndexFromKey(%categoryName); - if(%index != -1) - OptionsMenu.optionsCategories.erase(%index); -} - -function getOptionsCategoryIndexByName(%categoryName) -{ - for(%i=0; %i < OptionsMenu.optionsCategories.count(); %i++) - { - if(OptionsMenu.optionsCategories.getKey(%i) $= %categoryName) - return %i; - } - - return -1; -} - -function addListOption(%label, %description, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled) -{ - if(%wrapOptions $= "") - %wrapOptions = false; - - if(%enabled $= "") - %enabled = true; - - OptionsMenuSettingsList.addOptionRow(%label, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled, %description, %targetPrefVar); -} - -function addSliderOption(%label, %description, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled) -{ - if(%enabled $= "") - %enabled = true; - - OptionsMenuSettingsList.addSliderRow(%label, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled, %description); -} - -function addKeybindOption(%label, %description, %bitmapName, %callback, %enabled) -{ - if(%enabled $= "") - %enabled = true; - - OptionsMenuSettingsList.addSliderRow(%label, %bitmapName, %callback, %enabled, %description); -} + return %entry; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/guis/pauseMenu.gui b/Templates/BaseGame/game/data/UI/guis/pauseMenu.gui deleted file mode 100644 index 59d498e28..000000000 --- a/Templates/BaseGame/game/data/UI/guis/pauseMenu.gui +++ /dev/null @@ -1,163 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiControl(PauseMenu) { - extent = "1024 768"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - superClass = "UINavigation"; - canSaveDynamicFields = "1"; - - new GuiChunkedBitmapCtrl(PauseMenuBG) { - BitmapAsset = "UI:hudfill_image"; - extent = "1024 768"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - canSaveDynamicFields = "1"; - }; - new GuiInputCtrl(PauseMenuInputHandler) { - sendAxisEvents = "1"; - sendBreakEvents = "1"; - ignoreMouseEvents = "1"; - position = "-50 0"; - extent = "10 10"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiInputCtrlProfile"; - tooltipProfile = "GuiToolTipProfile"; - class = "MenuInputHandler"; - }; - new GuiControl(PauseMenuButtons) { - position = "162 125"; - extent = "700 518"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - - new GuiStackControl(PauseMenuList) { - padding = "15"; - dynamicSize = "0"; - extent = "700 320"; - horizSizing = "center"; - vertSizing = "center"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - superClass = "MenuList"; - - new GuiButtonCtrl() { - text = "Options"; - extent = "700 55"; - profile = "GuiMenuButtonProfile"; - command = "openPauseMenuOptions();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Exit to Menu"; - position = "0 70"; - extent = "700 55"; - profile = "GuiMenuButtonProfile"; - command = "pauseMenuExitToMenu();"; - tooltipProfile = "GuiToolTipProfile"; - }; - new GuiButtonCtrl() { - text = "Exit to Desktop"; - position = "0 140"; - extent = "700 55"; - profile = "GuiMenuButtonProfile"; - command = "pauseMenuExitToDesktop();"; - tooltipProfile = "GuiToolTipProfile"; - }; - }; - }; - new GuiControl(PauseButtonHolder) { - position = "144 711"; - extent = "736 40"; - horizSizing = "center"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "1"; - class = "MenuInputButtonContainer"; - - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - position = "11 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - visible = "0"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button1"; - class = "MenuInputButton"; - hidden = "1"; - }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - position = "155 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - visible = "0"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button2"; - class = "MenuInputButton"; - hidden = "1"; - }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - position = "299 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - visible = "0"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button3"; - class = "MenuInputButton"; - hidden = "1"; - }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - position = "443 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - visible = "0"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button4"; - class = "MenuInputButton"; - hidden = "1"; - }; - new GuiIconButtonCtrl() { - BitmapAsset = "UI:Keyboard_Black_Return_image"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - position = "587 0"; - extent = "140 40"; - profile = "GuiMenuButtonProfile"; - visible = "0"; - active = "0"; - tooltipProfile = "GuiToolTipProfile"; - internalName = "button5"; - class = "MenuInputButton"; - hidden = "1"; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript b/Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript deleted file mode 100644 index 0c55e625f..000000000 --- a/Templates/BaseGame/game/data/UI/guis/pauseMenu.tscript +++ /dev/null @@ -1,93 +0,0 @@ -function PauseMenu::onWake(%this) -{ - if($Server::ServerType $= "SinglePlayer") - { - $timescale = 0; - - sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] ); - } - - PauseButtonHolder.setActive(); - PauseMenuInputHandler.setFirstResponder(); - - %this.resizePages = true; - - %this.setRootPage(PauseMenuButtons); -} - -function PauseMenuButtons::onOpen(%this) -{ - PauseMenuList.clear(); - - if($Tools::loaded && EditorIsActive()) - { - %this.addPauseMenuButton("Exit Editor", "fastLoadWorldEdit();"); - } - - %this.addPauseMenuButton("Options", "openPauseMenuOptions();"); - %this.addPauseMenuButton("Exit to Menu", "pauseMenuExitToMenu();"); - %this.addPauseMenuButton("Exit to Desktop", "pauseMenuExitToDesktop();"); - - PauseMenuList.setAsActiveMenuList(); - - $activeMenuButtonContainer-->button1.disable(); - $activeMenuButtonContainer-->button2.disable(); - $activeMenuButtonContainer-->button3.disable(); - $activeMenuButtonContainer-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();"); - $activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "Canvas.popDialog();"); -} - -function PauseMenuButtons::addPauseMenuButton(%this, %buttonText, %buttonCallback) -{ - %newButton = new GuiButtonCtrl() { - text = %buttonText; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "0 0"; - extent = "400 55"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = %buttonCallback; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - - PauseMenuList.add(%newButton); -} -function PauseMenu::onSleep(%this) -{ - if($Server::ServerType $= "SinglePlayer") - { - $timescale = 1; - sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] ); - } -} - -function openPauseMenuOptions() -{ - PauseMenu.pushPage(OptionsMenu); -} - -function pauseMenuExitToMenu() -{ - MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", ""); -} - -function pauseMenuExitToDesktop() -{ - MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", ""); -} - -function PauseButtonHolder::onWake(%this) -{ - - -} diff --git a/Templates/BaseGame/game/data/UI/guis/recordingsDlg.asset.taml b/Templates/BaseGame/game/data/UI/guis/recordingsDlg.asset.taml deleted file mode 100644 index 2b0c337b5..000000000 --- a/Templates/BaseGame/game/data/UI/guis/recordingsDlg.asset.taml +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/guis/remapDlg.gui b/Templates/BaseGame/game/data/UI/guis/remapDlg.gui index feef7d938..2ebf9b150 100644 --- a/Templates/BaseGame/game/data/UI/guis/remapDlg.gui +++ b/Templates/BaseGame/game/data/UI/guis/remapDlg.gui @@ -1,6 +1,6 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(RemapDlg) { - extent = "1024 768"; + extent = "1280 720"; minExtent = "8 8"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; @@ -9,7 +9,7 @@ $guiContent = new GuiControl(RemapDlg) { helpTag = "0"; new GuiContainer(RemapPanel) { - position = "162 332"; + position = "290 308"; extent = "700 104"; horizSizing = "center"; vertSizing = "center"; @@ -24,6 +24,7 @@ $guiContent = new GuiControl(RemapDlg) { vertSizing = "height"; profile = "GuiInputCtrlProfile"; tooltipProfile = "GuiToolTipProfile"; + sendAxisEvents = "0"; }; new GuiControl(RemapBoxCtrl) { position = "-1 1"; @@ -34,26 +35,28 @@ $guiContent = new GuiControl(RemapDlg) { tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_image"; - extent = "701 40"; + new GuiBitmapCtrl() { + BitmapAsset = "UI:backdrop_image"; + position = "1 1"; + extent = "701 100"; horizSizing = "width"; + vertSizing = "height"; profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; }; - new GuiBitmapBarCtrl() { - BitmapAsset = "UI:panel_low_image"; - position = "0 40"; - extent = "701 341"; + new GuiPanel() { + position = "38 12"; + extent = "625 80"; horizSizing = "width"; - profile = "GuiDefaultProfile"; + vertSizing = "height"; + profile = "GuiMenuBasePanelProfile"; tooltipProfile = "GuiToolTipProfile"; }; new GuiTextCtrl() { - text = "Press escape to cancel"; + text = "Press escape or start to cancel"; maxLength = "255"; - position = "260 67"; - extent = "181 23"; + position = "252 51"; + extent = "245 23"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; @@ -61,9 +64,9 @@ $guiContent = new GuiControl(RemapDlg) { tooltipProfile = "GuiToolTipProfile"; }; new GuiTextCtrl() { - text = "Re-bind \"Forward\" to..."; + text = "Re-bind \"\" to..."; maxLength = "255"; - position = "259 40"; + position = "251 24"; extent = "184 23"; minExtent = "8 8"; horizSizing = "center"; diff --git a/Templates/BaseGame/game/data/UI/guis/remapDlg.tscript b/Templates/BaseGame/game/data/UI/guis/remapDlg.tscript new file mode 100644 index 000000000..7e4b55906 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/guis/remapDlg.tscript @@ -0,0 +1,112 @@ +function OptRemapInputCtrl::onAxisEvent( %this, %device, %action, %axisVal) +{ + if(%device $= "mouse") + return; + if(!startsWith(%device,$remapListDevice)) + return; + if(%axisVal != 1 && %axisVal != -1) //we want full presses on sticks to be sure + return; + + Canvas.popDialog( RemapDlg ); + + %this.doRemap(%device, %action, %axisVal); +} + +function OptRemapInputCtrl::onInputEvent( %this, %device, %action ) +{ + if(!startsWith(%device,$remapListDevice) && %action !$= "escape" && %action !$= "btn_start") + { + return; + } + else + { + Canvas.popDialog( RemapDlg ); + + if(%action $= "escape" || %action $= "btn_start") + return; + + %this.doRemap(%device, %action, 0); + } +} + +function OptRemapInputCtrl::doRemap(%this, %device, %action, %axisVal) +{ + %cmd = $RemapCmd[%this.index]; + %name = $RemapName[%this.index]; + %actionMap = $RemapActionMap[%this.index]; + + echo("OptRemapInputCtrl::onInputEvent() - remapping details: " @ %cmd @ ", " @ %name @ ", " @ %actionMap @ " remapped to: " @ %device @ ", " @ %action); + + // Grab the friendly display name for this action + // which we'll use when prompting the user below. + %mapName = getMapDisplayName( %device, %action ); + + // Get the current command this action is mapped to. + %prevMap = %actionMap.getCommand( %device, %action ); + + //TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times + unbindExtraActions( %cmd, %actionMap, %device, 0 ); + unbindExtraActions( %cmd, %actionMap, %device, 1 ); + + // If nothing was mapped to the previous command + // mapping then it's easy... just bind it. + // If the previous command is the same as the + // current then they hit the same input as what + // was already assigned. + if ( %prevMap $= "" || %prevMap $= %cmd ) + { + //unbindExtraActions( %cmd, %actionMap, 1 ); + %actionMap.bind( %device, %action, %cmd ); + + OptionsMenu.populateKBMControls(); + OptionsMenu.populateGamepadControls(); + return; + } + + // Look for the index of the previous mapping. + %prevMapIndex = findRemapCmdIndex( %prevMap ); + + // If we get a negative index then the previous + // mapping was to an item that isn't included in + // the mapping list... so we cannot unmap it. + if ( %prevMapIndex == -1 ) + { + MessageBoxOK( "Remap Failed", "\"" @ %mapName @ "\" is already bound to a non-remappable command!" ); + return; + } + + // Setup the forced remapping callback command. + %callback = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ + %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");"; + + // Warn that we're about to remove the old mapping and + // replace it with another. + %prevCmdName = $RemapName[%prevMapIndex]; + //Canvas.pushDialog( RemapConfirmDlg ); + + %remapWarnText = "\"" @ %mapName @ "\" is already bound to \"" @ %prevCmdName @ "\"! Do you wish to replace this mapping?"; + %doRemapCommand = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ + %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");"; + %cancelCommand = ""; + + MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand ); +} + +/// This unbinds actions beyond %count associated to the +/// particular actionMap %commmand. +function unbindExtraActions( %command, %actionMap, %device, %count ) +{ + %temp = %actionMap.getBinding( %command ); + if ( %temp $= "" ) + return; + + %count = getFieldCount( %temp ) - ( %count * 2 ); + for ( %i = 0; %i < %count; %i += 2 ) + { + %amDevice = getField( %temp, %i + 0 ); + %action = getField( %temp, %i + 1 ); + + if(%device !$= "" || %device $= %amDevice) + %actionMap.unbind( %device, %action ); + } +} diff --git a/Templates/BaseGame/game/data/UI/images/backdrop.png b/Templates/BaseGame/game/data/UI/images/backdrop.png new file mode 100644 index 000000000..e645dfe0d Binary files /dev/null and b/Templates/BaseGame/game/data/UI/images/backdrop.png differ diff --git a/Templates/BaseGame/game/data/UI/images/backdrop_image.asset.taml b/Templates/BaseGame/game/data/UI/images/backdrop_image.asset.taml new file mode 100644 index 000000000..fb9f256dc --- /dev/null +++ b/Templates/BaseGame/game/data/UI/images/backdrop_image.asset.taml @@ -0,0 +1,3 @@ + diff --git a/Templates/BaseGame/game/data/UI/images/textEditFrame_image.asset.taml b/Templates/BaseGame/game/data/UI/images/textEditFrame_image.asset.taml new file mode 100644 index 000000000..86a29b170 --- /dev/null +++ b/Templates/BaseGame/game/data/UI/images/textEditFrame_image.asset.taml @@ -0,0 +1,3 @@ + diff --git a/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript b/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript index 95df2cebf..dcf198969 100644 --- a/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript @@ -205,21 +205,6 @@ function controlSetChanged() fillRemapList(); } -function doKeyRemap( %row ) -{ - %rowIndex = %row.remapIndex; - %name = $RemapName[%rowIndex]; - - RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ; - OptRemapInputCtrl.index = %rowIndex; - Canvas.pushDialog( RemapDlg ); - - //Let the options menu know - %actionMap = $RemapActionMap[%rowIndex]; - - OptionsMenu.onKeybindChanged(%actionMap, %name); -} - function ControlsMenuRebindButton::onClick(%this) { %name = $RemapName[%this.keybindIndex]; @@ -230,89 +215,6 @@ function ControlsMenuRebindButton::onClick(%this) Canvas.pushDialog( RemapDlg ); } -function OptRemapInputCtrl::onInputEvent( %this, %device, %action ) -{ - //error( "** onInputEvent called - device = " @ %device @ ", action = " @ %action @ " **" ); - Canvas.popDialog( RemapDlg ); - - // Test for the reserved keystrokes: - if ( %device $= "keyboard" ) - { - // Cancel... - if ( %action $= "escape" ) - { - // Do nothing... - return; - } - } - - %cmd = $RemapCmd[%this.index]; - %name = $RemapName[%this.index]; - %actionMap = $RemapActionMap[%this.index]; - - // Grab the friendly display name for this action - // which we'll use when prompting the user below. - %mapName = getMapDisplayName( %device, %action ); - - // Get the current command this action is mapped to. - %prevMap = %actionMap.getCommand( %device, %action ); - - //TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times - unbindExtraActions( %cmd, %actionMap, 0 ); - unbindExtraActions( %cmd, %actionMap, 1 ); - - // If nothing was mapped to the previous command - // mapping then it's easy... just bind it. - if ( %prevMap $= "" ) - { - //unbindExtraActions( %cmd, %actionMap, 1 ); - %actionMap.bind( %device, %action, %cmd ); - - fillRemapList(); - return; - } - - // If the previous command is the same as the - // current then they hit the same input as what - // was already assigned. - if ( %prevMap $= %cmd ) - { - //unbindExtraActions( %cmd, %actionMap, 0 ); - %actionMap.bind( %device, %action, %cmd ); - - fillRemapList(); - return; - } - - // Look for the index of the previous mapping. - %prevMapIndex = findRemapCmdIndex( %prevMap ); - - // If we get a negative index then the previous - // mapping was to an item that isn't included in - // the mapping list... so we cannot unmap it. - if ( %prevMapIndex == -1 ) - { - MessageBoxOK( "Remap Failed", "\"" @ %mapName @ "\" is already bound to a non-remappable command!" ); - return; - } - - // Setup the forced remapping callback command. - %callback = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ - %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");"; - - // Warn that we're about to remove the old mapping and - // replace it with another. - %prevCmdName = $RemapName[%prevMapIndex]; - Canvas.pushDialog( RemapConfirmDlg ); - - %remapWarnText = "\"" @ %mapName @ "\" is already bound to \"" @ %prevCmdName @ "\"! Do you wish to replace this mapping?"; - %doRemapCommand = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @ - %cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ "); Canvas.popDialog();"; - %cancelCommand = "Canvas.popDialog();"; - - MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand ); -} - function findRemapCmdIndex( %command ) { for ( %i = 0; %i < $RemapCount; %i++ ) @@ -323,23 +225,6 @@ function findRemapCmdIndex( %command ) return( -1 ); } -/// This unbinds actions beyond %count associated to the -/// particular actionMap %commmand. -function unbindExtraActions( %command, %actionMap, %count ) -{ - %temp = %actionMap.getBinding( %command ); - if ( %temp $= "" ) - return; - - %count = getFieldCount( %temp ) - ( %count * 2 ); - for ( %i = 0; %i < %count; %i += 2 ) - { - %device = getField( %temp, %i + 0 ); - %action = getField( %temp, %i + 1 ); - - %actionMap.unbind( %device, %action ); - } -} function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex ) { diff --git a/Templates/BaseGame/game/data/UI/scripts/guiTreeViewCtrl.tscript b/Templates/BaseGame/game/data/UI/scripts/guiTreeViewCtrl.tscript deleted file mode 100644 index bc952dbca..000000000 --- a/Templates/BaseGame/game/data/UI/scripts/guiTreeViewCtrl.tscript +++ /dev/null @@ -1,50 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function GuiTreeViewCtrl::onDefineIcons( %this ) -{ - %icons = "core/art/gui/images/treeview/default:" @ - "core/art/gui/images/treeview/simgroup:" @ - "core/art/gui/images/treeview/simgroup_closed:" @ - "core/art/gui/images/treeview/simgroup_selected:" @ - "core/art/gui/images/treeview/simgroup_selected_closed:" @ - "core/art/gui/images/treeview/hidden:" @ - "core/art/gui/images/treeview/shll_icon_passworded_hi:" @ - "core/art/gui/images/treeview/shll_icon_passworded:" @ - "core/art/gui/images/treeview/default"; - - %this.buildIconTable(%icons); -} - -function GuiTreeViewCtrl::handleRenameObject( %this, %name, %obj ) -{ - %inspector = GuiInspector::findByObject( %obj ); - - if( isObject( %inspector ) ) - { - %field = ( %this.renameInternal ) ? "internalName" : "name"; - %inspector.setObjectField( %field, %name ); - return true; - } - - return false; -} diff --git a/Templates/BaseGame/game/data/UI/scripts/help.tscript b/Templates/BaseGame/game/data/UI/scripts/help.tscript deleted file mode 100644 index a305671af..000000000 --- a/Templates/BaseGame/game/data/UI/scripts/help.tscript +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function HelpDlg::onWake(%this) -{ - HelpFileList.entryCount = 0; - HelpFileList.clear(); - for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl")) - { - HelpFileList.fileName[HelpFileList.entryCount] = %file; - HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file)); - HelpFileList.entryCount++; - } - HelpFileList.sortNumerical(0); - for(%i = 0; %i < HelpFileList.entryCount; %i++) - { - %rowId = HelpFileList.getRowId(%i); - %text = HelpFileList.getRowTextById(%rowId); - %text = %i + 1 @ ". " @ restWords(%text); - HelpFileList.setRowById(%rowId, %text); - } - HelpFileList.setSelectedRow(0); -} - -function HelpFileList::onSelect(%this, %row) -{ - %fo = new FileObject(); - %fo.openForRead(%this.fileName[%row]); - %text = ""; - while(!%fo.isEOF()) - %text = %text @ %fo.readLine() @ "\n"; - - %fo.delete(); - HelpText.setText(%text); -} - -function getHelp(%helpName) -{ - Canvas.pushDialog(HelpDlg); - if(%helpName !$= "") - { - %index = HelpFileList.findTextIndex(%helpName); - HelpFileList.setSelectedRow(%index); - } -} - -function contextHelp() -{ - for(%i = 0; %i < Canvas.getCount(); %i++) - { - if(Canvas.getObject(%i).getName() $= HelpDlg) - { - Canvas.popDialog(HelpDlg); - return; - } - } - %content = Canvas.getContent(); - %helpPage = %content.getHelpPage(); - getHelp(%helpPage); -} - -function GuiControl::getHelpPage(%this) -{ - return %this.helpPage; -} - -function GuiMLTextCtrl::onURL(%this, %url) -{ - gotoWebPage( %url ); -} - diff --git a/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript b/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript deleted file mode 100644 index 36f96568f..000000000 --- a/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript +++ /dev/null @@ -1,729 +0,0 @@ -//============================================================================== -// Menu Input Buttons -// This file manages the Menu Input Buttons stuff -// Any time you have a GUI button that should be clickable AND map to a key input -// such as a gamepad button, or enter, etc, this stuff can be used -//============================================================================== -/* -Gamepad input reference for 360 controller -btn_a = A -btn_b = B -btn_x = X -btn_y = Y -btn_r = Right Bumper -btn_l = Right Bumper -upov = Dpad Up -dpov = Dpad Down -lpov = Dpad Left -rpov = Dpad Right -xaxis = Left Stick | + values = up, - values = down -yaxis = Left Stick | + values = up, - values = down -rxaxis = Right Stick | + values = up, - values = down -ryaxis = Right Stick | + values = up, - values = down -zaxis = Left Trigger -rzaxis = Right Trigger -btn_start = Start -btn_back = Back/Select -*/ - -//============================================================================== -/// Summary: -/// This is used with the main UI menu lists, when a non-axis input event is called -/// such as pressing a button -/// It is called from the engine -/// -/// \param %device (string) The name of the device the input event is coming fromt -/// \param %action (string) The specific key/input action -/// \param %state (bool) The down/up state of the event sent -function UIMenuButtonList::onInputEvent(%this, %device, %action, %state) -{ - if(%state) - $activeMenuButtonContainer.processInputs(%device, %action); -} - -//============================================================================== -/// Summary: -/// This is used with the main UI menu lists, when an axis input event is called -/// such as moving a joystick -/// It is called from the engine -/// -/// \param %device (string) The name of the device the input event is coming fromt -/// \param %action (string) The specific key/input action -/// \param %axisVal (float) The float value of the axis event -function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal) -{ - //Skip out of the value is too low as it could just be noise or miscalibrated defaults - if(%axisVal < 0.02) - return; - - $activeMenuButtonContainer.processAxisEvent(%device, %action); -} - -//============================================================================== -/// Summary: -/// Sets the command and text for the specified button. If %text and %command -/// are left empty, the button will be disabled and hidden. -/// -/// \param %gamepadButton (string) The button to set for when using gamepad input. See the input map reference comment at the top of the file -/// \param %keyboardButton (string) The button to set for when using keyboard/mouse input. -/// \param %text (string) The text to display next to the A button graphic. -/// \param %command (string) The command executed when the A button is pressed. -function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command) -{ - %this.setHidden(false); - - %set = (! ((%text $= "") && (%command $= ""))); - - %this.gamepadButton = %gamepadButton; - %this.keyboardButton = %keyboardButton; - - if(%gamepadButton $= "") - %this.gamepadValid = false; - else - %this.gamepadValid = true; - - if(%keyboardButton $= "") - %this.kbmValid = false; - else - %this.kbmValid = true; - - if((!%this.kbmValid && $activeControllerType !$= "gamepad") || - (!%this.gamepadValid && $activeControllerType $= "gamepad")) - %set = false; - - %this.setText(%text); - %this.Command = %command; - - %this.refresh(); -} - -//============================================================================== -/// Summary: -/// Disables the MenuInputButton, marking it as not to consume inputs or display -function MenuInputButton::disable(%this) -{ - %this.setText(""); - %this.Command = ""; - %this.setActive(false); - %this.setVisible(false); -} - -//============================================================================== -/// Summary: -/// Refreshes the specific button, updating it's visbility status and the displayed input image -function MenuInputButton::refresh(%this) -{ - %set = (! ((%this.text $= "") && (%this.command $= ""))); - - //Do a check so if a MenuInput is selectively bound and we're not using the - //matched input type, then we skip - if((!%this.kbmValid && $activeControllerType !$= "gamepad") || - (!%this.gamepadValid && $activeControllerType $= "gamepad")) - %set = false; - - %this.setActive(%set); - %this.setVisible(%set); - - if(!%this.isActive()) - return; - - if($activeControllerType $= "gamepad") - { - if(%this.gamepadButton !$= "") - { - %assetId = ""; - if($activeControllerName $= "PS4 Controller") - { - %assetId = "UI:PS4_"; - - if(%this.gamepadButton $= "btn_a") - %assetId = %assetId @ "Cross"; - else if(%this.gamepadButton $= "btn_b") - %assetId = %assetId @ "Circle"; - else if(%this.gamepadButton $= "btn_x") - %assetId = %assetId @ "Square"; - else if(%this.gamepadButton $= "btn_y") - %assetId = %assetId @ "Triangle"; - else if(%this.gamepadButton $= "btn_l") - %assetId = %assetId @ "L1"; - else if(%this.gamepadButton $= "zaxis") - %assetId = %assetId @ "L2"; - else if(%this.gamepadButton $= "btn_r") - %assetId = %assetId @ "R1"; - else if(%this.gamepadButton $= "rzaxis") - %assetId = %assetId @ "R2"; - else if(%this.gamepadButton $= "btn_start") - %assetId = %assetId @ "Options"; - else if(%this.gamepadButton $= "btn_back") - %assetId = %assetId @ "Share"; - } - else if($activeControllerName $= "Nintendo Switch Pro Controller") - { - %assetId = "UI:Switch_"; - - if(%this.gamepadButton $= "btn_a") - %assetId = %assetId @ "B"; - else if(%this.gamepadButton $= "btn_b") - %assetId = %assetId @ "A"; - else if(%this.gamepadButton $= "btn_x") - %assetId = %assetId @ "Y"; - else if(%this.gamepadButton $= "btn_y") - %assetId = %assetId @ "X"; - else if(%this.gamepadButton $= "btn_l") - %assetId = %assetId @ "LB"; - else if(%this.gamepadButton $= "zaxis") - %assetId = %assetId @ "LT"; - else if(%this.gamepadButton $= "btn_r") - %assetId = %assetId @ "RB"; - else if(%this.gamepadButton $= "rzaxis") - %assetId = %assetId @ "RT"; - else if(%this.gamepadButton $= "btn_start") - %assetId = %assetId @ "Plus"; - else if(%this.gamepadButton $= "btn_back") - %assetId = %assetId @ "Minus"; - } - else if($activeControllerName !$= "") - { - %assetId = "UI:Xbox_"; - - if(%this.gamepadButton $= "btn_a") - %assetId = %assetId @ "A"; - else if(%this.gamepadButton $= "btn_b") - %assetId = %assetId @ "B"; - else if(%this.gamepadButton $= "btn_x") - %assetId = %assetId @ "X"; - else if(%this.gamepadButton $= "btn_y") - %assetId = %assetId @ "Y"; - else if(%this.gamepadButton $= "btn_l") - %assetId = %assetId @ "LB"; - else if(%this.gamepadButton $= "zaxis") - %assetId = %assetId @ "LT"; - else if(%this.gamepadButton $= "btn_r") - %assetId = %assetId @ "RB"; - else if(%this.gamepadButton $= "rzaxis") - %assetId = %assetId @ "RT"; - else if(%this.gamepadButton $= "btn_start") - %assetId = %assetId @ "Menu"; - else if(%this.gamepadButton $= "btn_back") - %assetId = %assetId @ "Windows"; - } - } - } - else - { - if(%this.keyboardButton !$= "") - { - %assetId = "UI:Keyboard_Black_" @ %this.keyboardButton; - } - } - - %this.setBitmap(%assetId @ "_image"); - - return true; -} - -//============================================================================== -/// Summary: -/// Refreshes a menu input container, updating the buttons inside it -function MenuInputButtonContainer::refresh(%this) -{ - %count = %this.getCount(); - for(%i=0; %i < %count; %i++) - { - %btn = %this.getObject(%i); - - %btn.refresh(); - } -} - -//============================================================================== -/// Summary: -/// Sets the given MenuInputButtonContainer as the active one. This directs input events -/// to it's buttons, ensures it's visible, and auto-hides the old active container if it was set -function MenuInputButtonContainer::setActive(%this) -{ - if(isObject($activeMenuButtonContainer)) - $activeMenuButtonContainer.hidden = true; - - $activeMenuButtonContainer = %this; - $activeMenuButtonContainer.hidden = false; - $activeMenuButtonContainer.refresh(); -} - -//============================================================================== -/// Summary: -/// Checks the input manager for if we have a gamepad active and gets it's name -/// If we have one, also sets the active input type to gamepad -function MenuInputButtonContainer::checkGamepad(%this) -{ - %controllerName = SDLInputManager::JoystickNameForIndex(0); - - $activeControllerName = %controllerName; - - if($activeControllerName $= "") - $activeControllerType = "K&M"; - else - $activeControllerType = "gamepad"; -} - - //============================================================================== -/// Summary: -/// This is called by the earlier inputs callback that comes from the menu list -/// this allows us to first check what the input type is, and if the device is different -/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update -/// the display -/// Then we process the input to see if it matches to any of the button maps for our -/// MenuInputButtons. If we have a match, we execute it's command. -/// -/// \param %device (string) The device that is causing the input event -/// \param %action (string) The name of the input action -function MenuInputButtonContainer::processInputs(%this, %device, %action) -{ - //check to see if our status has changed - %changed = false; - - %oldDevice = $activeControllerName; - - %deviceName = stripTrailingNumber(%device); - - if(%deviceName $= "keyboard" || %deviceName $= "mouse") - { - if($activeControllerName !$= "K&M") - %changed = true; - - $activeControllerName = "K&M"; - $activeControllerType = "K&M"; - Canvas.showCursor(); - } - else - { - if(%this.checkGamepad()) - { - Canvas.hideCursor(); - } - - if($activeControllerType !$= %oldDevice) - %changed = true; - } - - if(%changed) - %this.refresh(); - - //Now process the input for the button accelerator, if applicable - //Set up our basic buttons - for(%i=0; %i < %this.getCount(); %i++) - { - %btn = %this.getObject(%i); - - if(!%btn.isActive()) - continue; - - if($activeControllerType !$= "K&M") - { - if(%btn.gamepadButton $= %action) - { - eval(%btn.command); - } - } - else - { - if(%btn.keyboardButton $= %action) - { - eval(%btn.command); - } - } - } -} - -//============================================================================== -/// Summary: -/// This is called by the earlier inputs callback that comes from the menu list -/// this allows us to first check what the input type is, and if the device is different -/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update -/// the display -/// -/// \param %device (string) The name of the device the input event is coming fromt -/// \param %action (string) The specific key/input action -/// \param %axisVal (float) The float value of the axis event -function MenuInputButtonContainer::processAxisEvent(%this, %device, %action, %axisVal) -{ - //check to see if our status has changed - %changed = false; - - %oldDevice = $activeControllerName; - - %deviceName = stripTrailingNumber(%device); - - if(%deviceName $= "mouse") - { - if($activeControllerName !$= "K&M") - %changed = true; - - $activeControllerName = "K&M"; - $activeControllerType = "K&M"; - Canvas.showCursor(); - } - else - { - if(%this.checkGamepad()) - { - Canvas.hideCursor(); - } - - if($activeControllerType !$= %oldDevice) - %changed = true; - } - - if(%changed) - %this.refresh(); -} - -// -// -function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType) -{ - /*if(GamepadButtonsGui.checkGamepad()) - { - GamepadButtonsGui.hidden = false; - }*/ -} - -function onSDLDeviceDisconnected(%sdlIndex) -{ - /*if(!GamepadButtonsGui.checkGamepad()) - { - GamepadButtonsGui.hidden = true; - }*/ -} - -//============================================================================== -// Menu Input processing -// These functions manage the Menu input processing in general -// Whenever a MenuInputHandler consumes an input event, it'll process them here -// This'll let the active menu list be navigated, as well as buttons be processed -// and ultimately handled by the Input Buttons above -//============================================================================== -//============================================================================== -/// Summary: -/// This is used with the main UI menu lists, when an axis input event is called -/// such as moving a joystick -/// It is called from the engine -/// -/// \param %device (string) The name of the device the input event is coming fromt -/// \param %action (string) The specific key/input action -/// \param %axisVal (float) The float value of the axis event -function MenuInputHandler::onAxisEvent(%this, %device, %action, %value) -{ - //this is to force a refresh of the menu - if(%value == 1 || %value == -1) - $activeMenuButtonContainer.processInputs(%device, %action); - - if(startsWith(%device, "mouse")) - return; - - if((%action $= "upov" && %value > 0) || (%action $= "yaxis" && %value == -1)) - { - $activeMenuList.navigateUp(); - } - - if((%action $= "dpov" && %value > 0) || (%action $= "yaxis" && %value == 1)) - { - $activeMenuList.navigateDown(); - } - - //How we deal with the left and right navigation is dependant on the mode of the - //menu list - if($activeMenuListMode $= "Settings") - { - if((%action $= "lpov" && %value > 0) || (%action $= "xaxis" && %value == -1)) - { - echo("Options menu nudged left!"); - //$activeMenuList.navigateLeft(); - } - - if((%action $= "rpov" && %value > 0) || (%action $= "xaxis" && %value == -1)) - { - echo("Options menu nudged right!"); - //$activeMenuList.navigateRight(); - } - } - else - { - if((%action $= "lpov" && %value > 0) || (%action $= "xaxis" && %value == -1)) - { - $activeMenuList.navigateLeft(); - } - - if((%action $= "rpov" && %value > 0) || (%action $= "xaxis" && %value == -1)) - { - $activeMenuList.navigateRight(); - } - } -} - -//============================================================================== -/// Summary: -/// This is used with the main UI menu lists, when a non-axis input event is called -/// such as pressing a button -/// It is called from the engine -/// -/// \param %device (string) The name of the device the input event is coming fromt -/// \param %action (string) The specific key/input action -/// \param %state (bool) The down/up state of the event sent -function MenuInputHandler::onInputEvent(%this, %device, %action, %state) -{ - if(%action $= "upov" || %action $= "dpov" || %action $= "lpov" || %action $= "rpov") - { - %this.onAxisEvent(%device, %action, %state); - return; - } - - if(%state) - $activeMenuButtonContainer.processInputs(%device, %action); -} - -//============================================================================== -// Menu List processing -// These functions manage the navigation and activation of the Menu Lists -//============================================================================== -//============================================================================== -/// Summary: -/// Is the GUIContainer with this MenuList namespace the 'active' menulist as far -/// as UI interfaces is concerned? -function MenuList::isActiveMenuList(%this) -{ - if($activeMenuList == %this) - return true; - - return false; -} - -//============================================================================== -/// Summary: -/// Sets the GUIContainer with this MenuList namespace as the active menulist. -/// This means that any input events caught in MenuInputHandlers is directed at -/// this menu list to navigate it -/// -/// \param %startPosition (Point2F) The X and Y starting positions of the selection for this menuList -/// \param %menuMode (string) Indicates the mode/type of menuList, allowing for special behaviors depending on type -function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode) -{ - if(%startPosition $= "") - %startPosition = "0 0"; - - if(%menuMode $= "") - %menuMode = "Menu"; - - $activeMenuList = %this; - $activeMenuList.hidden = false; - $activeMenuList.ListPosition = %startPosition; - $activeMenuListMode = %menuMode; - - %this.refresh(); -} - -//============================================================================== -/// Summary: -/// Activates the currently highlighted child object -function MenuList::activate(%this) -{ - //check for a highlighted element - if($activeMenuList.ListPosition.y > -1 && $activeMenuList.ListPosition < $activeMenuList.getCount()) - { - %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y); - %btn.performClick(); - } -} - -//============================================================================== -/// Summary: -/// refreshes the menuList, updating children highlight status and if there is -/// a button pointer control defined on our list, we update it's position as -/// needed -function MenuList::refresh(%this) -{ - %selectedObject = -1; - for(%i=0; %i < $activeMenuList.getCount(); %i++) - { - %btn = $activeMenuList.getObject(%i); - - %isSelected = %i == $activeMenuList.ListPosition.y; - - %btn.setHighlighted(%isSelected); - - if(%isSelected) - %selectedObject = %i; - } - - if(isObject(%this.buttonPointerCtrl)) - { - if(%selectedObject != -1) - { - %this.buttonPointerCtrl.setHidden(false); - - %buttonCenter = $activeMenuList.getObject(%selectedObject).getGlobalCenter(); - - if(%this.centerButtonPointerCtrl) - { - %this.buttonPointerCtrl.setCenter(%buttonCenter.x, %buttonCenter.y); - } - else - { - //if we're not centering, then left-justify - %this.buttonPointerCtrl.setCenter(%buttonCenter.x - $activeMenuList.getObject(%selectedObject).extent.x / 2, %buttonCenter.y); - } - } - else - { - %this.buttonPointerCtrl.setHidden(true); - } - } - - if($activeMenuList.isMethod("onNavigate")) - $activeMenuList.onNavigate($activeMenuList.ListPosition.y); - - %parent = $activeMenuList.getParent(); - if(%parent.getClassName() $= "GuiScrollCtrl") - { - %parent.scrollToObject(%selectedObject); - } -} - -//============================================================================== -/// Summary: -/// Selects the next 'up' child item in the menuList. If the current is the topmost -/// then nothing happens -function MenuList::navigateUp(%this) -{ - $activeMenuList.ListPosition.y -= 1; - if($activeMenuList.ListPosition.y < 0) - $activeMenuList.ListPosition.y = 0; - - %this.refresh(); -} - -//============================================================================== -/// Summary: -/// Selects the next 'down' child item in the menuList. If the current is the bottommost -/// then nothing happens -function MenuList::navigateDown(%this) -{ - $activeMenuList.ListPosition.y += 1; - if($activeMenuList.ListPosition.y >= $activeMenuList.getCount()) - $activeMenuList.ListPosition.y = $activeMenuList.getCount()-1; - - %this.refresh(); -} - -//============================================================================== -/// Summary: -/// Selects the next 'left' child item in the menuList. If the current item is the leftmost -/// then nothing happens -function MenuList::navigateLeft() -{ - //Atm, we're only handling specific control types, namely options entries, but - //this could readily be expanded upon to handle grids like for inventory screens - //or the like - - %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y); - if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled()) - { - %mode = %btn.getMode(); - if(%mode == 0) //options list - { - %optionId = %btn.getCurrentOptionIndex() - 1; - %btn.selectOptionByIndex(%optionId); - %btn.onChange(); - } - else if(%mode == 1) //slider - { - %value = %btn.getValue(); - %adjustedValue = %value - %btn.getIncrement(); - %minValue = %btn.getRange().x; - if(%adjustedValue < %minValue) - %adjustedValue = %minValue; - - %btn.setValue(%adjustedValue); - %btn.onChange(); - } - } -} - -//============================================================================== -/// Summary: -/// Selects the next 'right' child item in the menuList. If the current item is the rightmost -/// then nothing happens -function MenuList::navigateRight() -{ - %btn = $activeMenuList.getObject($activeMenuList.ListPosition.y); - if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled()) - { - %mode = %btn.getMode(); - if(%mode == 0) //options list - { - %optionId = %btn.getCurrentOptionIndex() + 1; - %btn.selectOptionByIndex(%optionId); - %btn.onChange(); - } - else if(%mode == 1) //slider - { - %value = %btn.getValue(); - %adjustedValue = %value + %btn.getIncrement(); - %maxValue = %btn.getRange().y; - if(%adjustedValue > %maxValue) - %adjustedValue = %maxValue; - - %btn.setValue(%adjustedValue); - %btn.onChange(); - } - } -} - -//============================================================================== -/// Summary: -/// Gets the current vertical positionally selected child object -function MenuList::getActiveRow(%this) -{ - return $activeMenuList.ListPosition.y; -} - -//============================================================================== -/// Summary: -/// Called from the engine when a GUIButtonBase-derived class with MenuListButton namespace class -/// has its highlighting status changed. Allows us to react to this change of state and trigger refreshse -/// or other events to keep the navigation tracking up to date -/// -/// \param %state (bool) The on/off state of the button being highlighted -function MenuListButton::onHighlighted(%this, %state) -{ - echo("MenuListButton::onHighlighted() - " @ %this.internalName @ " was " @ %state @ " highlighted"); - %parentContainer = %this.getParent(); - if(%parentContainer.class $= "MenuList" || %parentContainer.superClass $= "MenuList") - { - if(isObject(%parentContainer.buttonPointerCtrl)) - { - if(%state) - { - %parentContainer.buttonPointerCtrl.setHidden(false); - - %buttonCenter = %this.getGlobalCenter(); - echo(" - button center:" @ %buttonCenter); - - if(%parentContainer.centerButtonPointerCtrl) - { - %parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x, %buttonCenter.y); - } - else - { - //if we're not centering, then left-justify - %parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x - %this.extent.x / 2, %buttonCenter.y); - } - echo(" - pointer position:" @ %parentContainer.buttonPointerCtrl.getPosition()); - } - /*else - { - %parentContainer.buttonPointerCtrl.setHidden(true); - }*/ - } - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript b/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript deleted file mode 100644 index 20ff05ff7..000000000 --- a/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript +++ /dev/null @@ -1,308 +0,0 @@ -//============================================================================== -/// Summary: -/// This function sets the root page for the navigation stack. The root page is 'below' -/// all other normal pages and cannot be popped like a normal page. -/// When we set a new root page, we first check if we have an existing root page. -/// If we do, we run the usual canClose() then onClose() function pair, then we -/// set it and call the onOpen() for the new root page. -/// -/// \param %rootPage (guiControl) The new guiControl that is being set as the root page of the navigation stack -function UINavigation::setRootPage(%this, %rootPage) -{ - if(!isObject(%this.pageStack)) - { - %this.pageStack = new ArrayObject(); - } - - if(%this.rootPage $= %rootPage) - return; - - if(isObject(%this.rootPage)) - { - %canClose = true; - if(%this.rootPage.isMethod("canClose")) - %canClose = %this.rootPage.call("canClose"); - - if(!%canClose) - return; //if we're not allowed to close, just bail out wholesale because clearly - //something is blocking changes to pages - - %this.remove(%this.rootPage); - if(%this.rootPage.isMethod("onClose")) - %this.rootPage.call("onClose"); - - %this.rootPage.navigation = ""; - } - - %this.rootPage = %rootPage; - - %this.add(%rootPage); - if(%this.resizePages) - { - %rootPage.resize(%this.position.x, %this.position.y, - %this.extent.x, %this.extent.y); - } - %rootPage.navigation = %this; - - if(%rootPage.isMethod("onOpen")) - %rootPage.call("onOpen"); -} - -//============================================================================== -/// Summary: -/// This function pushes a page onto the given UINavigation-classed GUIContainer's stack -/// The order of operations is thus: -/// 1) check to see if the new page being pushed says it can open via the canOpen() function. -/// If this method is not defined, it defaults to true, as there's no impediment to continuing -/// If this check returns false, the pushPage event cancels. -/// 2) check to see if the current page on the stack says it can close. Similar to -/// the canOpen() check on the new page, we default to true -/// If this check returns false, the pushPage event cancels. -/// 3) Call - if defined - onClose() on the current top page of the stack -/// 4) Add the new page onto the stack -/// 5) Call - if defined - onOpen() on the new page -/// 6) Finally, if we defined a callback, call that. -/// With this all run, the previous top page has done any cleanup work it needed to -/// and the new top page has been opened successfully. -/// -/// \param %newPage (guiControl) The new guiControl that is being added onto the page stack -/// \param %callback[optional]: (Evaluable string) A evalable statement to invoke when the push has been completed -function UINavigation::pushPage(%this, %newPage, %callback) -{ - if(!isObject(%this.pageStack)) - { - %this.pageStack = new ArrayObject(); - } - - //don't re-add pages - if(%this.getPageCount() != 0 && - %this.pageStack.getIndexFromKey(%newPage) != -1) - return; - - %canChange = true; - if(%newPage.isMethod("canOpen")) - %canChange = %newPage.call("canOpen"); - - if(!%canChange) - return; - - %currentPage = %this.getCurrentPage(); - if(isObject(%currentPage)) - { - if(%currentPage.isMethod("canClose")) - %canChange = %currentPage.call("canClose"); - - if(!%canChange) - return; - - if(%currentPage.isMethod("onClose")) - %currentPage.call("onClose"); - } - - %this.pageStack.push_back(%newPage); - %this.add(%newPage); - if(%this.resizePages) - { - %newPage.resize(%this.position.x, %this.position.y, - %this.extent.x, %this.extent.y); - } - - if(%newPage.isMethod("onOpen")) - %newPage.call("onOpen"); - - %newPage.navigation = %this; - - if(%callback !$= "") - eval(%callback); -} - -//============================================================================== -/// Summary: -/// This function pops the topmost page off the given UINavigation-classed GUIContainer's stack -/// The order of operations is thus: -/// 1) check to see if the top page being popped says it can close via the canClose() function. -/// If this method is not defined, it defaults to true, as there's no impediment to continuing -/// If this check returns false, the popPage event cancels. -/// 2) check to see if the previous page on the stack says it can open. Similar to -/// the canClose() check on the new page, we default to true -/// If this check returns false, the popPage event cancels. -/// 3) Call - if defined - onClose() on the current top page of the stack -/// 4) Remove the top page -/// 5) Call - if defined - onOpen() on the now topmost page -/// 6) Finally, if we defined a callback, call that. -/// With this all run, the previous top page has done any cleanup work it needed to -/// and the new top page has been opened successfully. -/// -/// \param %callback[optional] (Evaluable string) A evalable statement to invoke when the pop has been completed -function UINavigation::popPage(%this, %callback) -{ - if(%this.pageStack.count() == 0) - return; - - %currentPage = %this.getCurrentPage(); - if(isObject(%currentPage)) - { - %canChange = true; - if(%currentPage.isMethod("canClose")) - %canChange = %currentPage.call("canClose"); - - if(!%canChange) - return; - } - - %prevPage = %this.getPreviousPage(); - if(isObject(%prevPage)) - { - %canChange = true; - if(%prevPage.isMethod("canOpen")) - %canChange = %prevPage.call("canOpen"); - - if(!%canChange) - return; - } - - if(isObject(%currentPage)) - { - if(%currentPage.isMethod("onClose")) - { - %currentPage.call("onClose"); - } - - %this.pageStack.pop_back(); - %this.remove(%currentPage); - - %currentPage.navigation = ""; - } - - %newTopPage = %this.getCurrentPage(); - if(isObject(%newTopPage)) - { - if(%newTopPage.isMethod("onOpen")) - %newTopPage.call("onOpen"); - } - - if(%callback !$= "") - eval(%callback); -} - -//============================================================================== -/// Summary: -/// In order tops the topmost page in a loop until it has closed the entire stack, -/// leaving only the root page -/// -/// \param %callback[optional] (Evaluable String) A evalable statement to invoke when the pop has been completed -function UINavigation::popToRoot(%this, %callback) -{ - %pageChanged = false; - while(%this.getPageCount() != 0) - { - %currentPage = %this.getCurrentPage(); - if(isObject(%currentPage)) - { - if(%currentPage.isMethod("canClose")) - %canChange = %currentPage.call("canClose"); - - if(!%canChange) - return; - } - - %prevPage = %this.getPreviousPage(); - if(isObject(%prevPage)) - { - if(%prevPage.isMethod("canOpen")) - %canChange = %prevPage.call("canOpen"); - - if(!%canChange) - return; - } - - if(isObject(%currentPage)) - { - if(%currentPage.isMethod("onClose")) - { - %currentPage.call("onClose"); - } - - %this.pageStack.pop_back(); - %this.remove(%currentPage); - - %currentPage.navigation = ""; - } - - %newTopPage = %this.getCurrentPage(); - if(%newTopPage.isMethod("onOpen")) - %newTopPage.call("onOpen"); - - %pageChanged = true; - } - - if(%pageChanged && %callback !$= "") - eval(%callback); -} - -//============================================================================== -/// Summary: -/// Gets the current, topmost page on the stack. If no non-root pages are on the stack -/// the root page is returned -function UINavigation::getCurrentPage(%this) -{ - if(isObject(%this.pageStack) && %this.pageStack.count() != 0) - { - return %this.pageStack.getKey(%this.pageStack.count()-1); - } - else - { - if(isObject(%this.rootPage)) - return %this.rootPage; - } - - return 0; -} - -//============================================================================== -/// Summary: -/// Gets the page just under the topmost page in the stack. If there is no previous page -/// then the root page is returned -function UINavigation::getPreviousPage(%this) -{ - if(isObject(%this.pageStack) && %this.pageStack.count() > 1) - { - return %this.pageStack.getKey(%this.pageStack.count()-2); - } - else - { - if(isObject(%this.rootPage)) - return %this.rootPage; - } - - return 0; -} - -//============================================================================== -/// Summary: -/// Gets the number of pages on the stack. -function UINavigation::getPageCount(%this) -{ - %count = 0; - if(isObject(%this.pageStack)) - %count = %this.pageStack.count(); - - if(isObject(%this.rootPage)) - %count++; - - return %count; -} - -//============================================================================== -/// Summary: -/// Force the page to reprocess to ensure it's status is up to date -function UINavigation::refreshPage(%this) -{ - %page = %this.getCurrentPage(); - if(!isObject(%page)) - return; - - if(%page.isMethod("onOpen")) - %page.call("onOpen"); -} - diff --git a/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript b/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript deleted file mode 100644 index f1c3db40e..000000000 --- a/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript +++ /dev/null @@ -1,341 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// -------------------------------------------------------------------- -// Message Sound -// -------------------------------------------------------------------- -/*new SFXDescription(MessageBoxAudioDescription) -{ - volume = 1.0; - isLooping = false; - is3D = false; - channel = $GuiAudioType; -}; - -new SFXProfile(messageBoxBeep) -{ - filename = "./messageBoxSound"; - description = MessageBoxAudioDescription; - preload = true; -};*/ - -//--------------------------------------------------------------------------------------------- -// messageCallback -// Calls a callback passed to a message box. -//--------------------------------------------------------------------------------------------- -function messageCallback(%dlg, %callback) -{ - Canvas.popDialog(%dlg); - eval(%callback); -} - -//--------------------------------------------------------------------------------------------- -// MBSetText -// Sets the text of a message box and resizes it to accomodate the new string. -//--------------------------------------------------------------------------------------------- -function MBSetText(%text, %frame, %msg) -{ - // Get the extent of the text box. - %ext = %text.getExtent(); - // Set the text in the center of the text box. - %text.setText("" @ %msg); - // Force the textbox to resize itself vertically. - %text.forceReflow(); - // Grab the new extent of the text box. - %newExtent = %text.getExtent(); - - // Get the vertical change in extent. - %deltaY = getWord(%newExtent, 1) - getWord(%ext, 1); - - // Resize the window housing the text box. - %windowPos = %frame.getPosition(); - %windowExt = %frame.getExtent(); - %frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2), - getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY); - - %frame.canMove = "0"; - //%frame.canClose = "0"; - %frame.resizeWidth = "0"; - %frame.resizeHeight = "0"; - %frame.canMinimize = "0"; - %frame.canMaximize = "0"; - - //sfxPlayOnce( messageBoxBeep ); -} - -function MessageBoxCtrl::onWake(%this) -{ -} - -//--------------------------------------------------------------------------------------------- -// Various message box display functions. Each one takes a window title, a message, and a -// callback for each button. -//--------------------------------------------------------------------------------------------- - -//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\""); -function MessageBoxOK(%title, %message, %callback) -{ - Canvas.pushDialog(MessageBoxDlg); - MessageBoxTitleText.text = %title; - - MessageBoxOCButtonHolder.hidden = true; - MessageBoxYNCButtonHolder.hidden = true; - MessageBoxOKButtonHolder.hidden = false; - - MessageBoxOKButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - - MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; - MessageBoxOKButtonHolder.setActive(); - - MBSetText(MessageBoxText, MessageBoxCtrl, %message); - MessageBoxDlg.callback = %callback; -} - -function MessageBoxOKDlg::onSleep( %this ) -{ - %this.callback = ""; - MessageBoxCtrl.originalMenuInputContainer.setActive(); -} - -function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride) -{ - Canvas.pushDialog(MessageBoxDlg); - MessageBoxTitleText.text = %title; - - MessageBoxOCButtonHolder.hidden = false; - MessageBoxYNCButtonHolder.hidden = true; - MessageBoxOKButtonHolder.hidden = true; - - if(%okLabelOverride $= "") - %okLabel = "OK"; - else - %okLabel = %okLabelOverride; - - if(%cancelLabelOverride $= "") - %cancelLabel = "Cancel"; - else - %cancelLabel = %cancelLabelOverride; - - MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", %okLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", %cancelLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); - - MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; - MessageBoxOCButtonHolder.setActive(); - - MBSetText(MessageBoxText, MessageBoxCtrl, %message); - MessageBoxDlg.callback = %callback; - MessageBoxDlg.cancelCallback = %cancelCallback; -} - -function MessageBoxOKCancelDlg::onSleep( %this ) -{ - %this.callback = ""; - MessageBoxCtrl.originalMenuInputContainer.setActive(); -} - -function MessageBoxOKCancelDetails(%title, %message, %details, %callback, %cancelCallback) -{ - if(%details $= "") - { - MBOKCancelDetailsButton.setVisible(false); - } - - MBOKCancelDetailsScroll.setVisible(false); - - MBOKCancelDetailsFrame.setText( %title ); - - Canvas.pushDialog(MessageBoxOKCancelDetailsDlg); - MBSetText(MBOKCancelDetailsText, MBOKCancelDetailsFrame, %message); - MBOKCancelDetailsInfoText.setText(%details); - - %textExtent = MBOKCancelDetailsText.getExtent(); - %textExtentY = getWord(%textExtent, 1); - %textPos = MBOKCancelDetailsText.getPosition(); - %textPosY = getWord(%textPos, 1); - - %extentY = %textPosY + %textExtentY + 65; - - MBOKCancelDetailsInfoText.setExtent(285, 128); - - MBOKCancelDetailsFrame.setExtent(300, %extentY); - - MessageBoxOKCancelDetailsDlg.callback = %callback; - MessageBoxOKCancelDetailsDlg.cancelCallback = %cancelCallback; - - MBOKCancelDetailsFrame.defaultExtent = MBOKCancelDetailsFrame.getExtent(); -} - -function MBOKCancelDetailsToggleInfoFrame() -{ - if(!MBOKCancelDetailsScroll.isVisible()) - { - MBOKCancelDetailsScroll.setVisible(true); - MBOKCancelDetailsText.forceReflow(); - %textExtent = MBOKCancelDetailsText.getExtent(); - %textExtentY = getWord(%textExtent, 1); - %textPos = MBOKCancelDetailsText.getPosition(); - %textPosY = getWord(%textPos, 1); - - %verticalStretch = %textExtentY; - - if((%verticalStretch > 260) || (%verticalStretch < 0)) - %verticalStretch = 260; - - %extent = MBOKCancelDetailsFrame.defaultExtent; - %height = getWord(%extent, 1); - - %posY = %textPosY + %textExtentY + 10; - %posX = getWord(MBOKCancelDetailsScroll.getPosition(), 0); - MBOKCancelDetailsScroll.setPosition(%posX, %posY); - MBOKCancelDetailsScroll.setExtent(getWord(MBOKCancelDetailsScroll.getExtent(), 0), %verticalStretch); - MBOKCancelDetailsFrame.setExtent(300, %height + %verticalStretch + 10); - } else - { - %extent = MBOKCancelDetailsFrame.defaultExtent; - %width = getWord(%extent, 0); - %height = getWord(%extent, 1); - MBOKCancelDetailsFrame.setExtent(%width, %height); - MBOKCancelDetailsScroll.setVisible(false); - } -} - -function MessageBoxOKCancelDetailsDlg::onSleep( %this ) -{ - %this.callback = ""; - MessageBoxCtrl.originalMenuInputContainer.setActive(); -} - -function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback) -{ - Canvas.pushDialog(MessageBoxDlg); - MessageBoxTitleText.text = %title; - - MessageBoxOCButtonHolder.hidden = false; - MessageBoxYNCButtonHolder.hidden = true; - MessageBoxOKButtonHolder.hidden = true; - - MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); - MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); - - MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; - MessageBoxOCButtonHolder.setActive(); - - MBSetText(MessageBoxText, MessageBoxCtrl, %message); - MessageBoxDlg.yesCallBack = %yesCallback; - MessageBoxDlg.noCallback = %noCallback; -} - -function MessageBoxYesNoCancel(%title, %message, %yesCallback, %noCallback, %cancelCallback) -{ - Canvas.pushDialog(MessageBoxDlg); - MessageBoxTitleText.text = %title; - - MessageBoxOCButtonHolder.hidden = true; - MessageBoxYNCButtonHolder.hidden = false; - MessageBoxOKButtonHolder.hidden = true; - - MessageBoxYNCButtonHolder-->yesButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); - MessageBoxYNCButtonHolder-->noButton.set("btn_x", "backspace", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); - MessageBoxYNCButtonHolder-->cancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); - - MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; - MessageBoxYNCButtonHolder.setActive(); - - MBSetText(MessageBoxText, MessageBoxCtrl, %message); - MessageBoxDlg.yesCallBack = %yesCallback; - MessageBoxDlg.noCallback = %noCallback; - MessageBoxDlg.cancelCallback = %cancelCallback; -} - -function MessageBoxDlg::onSleep( %this ) -{ - %this.callback = ""; - %this.cancelCallback = ""; - %this.yesCallback = ""; - %this.noCallback = ""; - %this.cancelCallback = ""; - MessageBoxCtrl.originalMenuInputContainer.setActive(); -} - -//--------------------------------------------------------------------------------------------- -// MessagePopup -// Displays a message box with no buttons. Disappears after %delay milliseconds. -//--------------------------------------------------------------------------------------------- -function MessagePopup(%title, %message, %delay) -{ - Canvas.pushDialog(MessageBoxDlg); - MessageBoxTitleText.text = %title; - MBSetText(MessageBoxText, MessageBoxCtrl, %message); - - if (%delay !$= "") - schedule(%delay, 0, CloseMessagePopup); -} - -function CloseMessagePopup() -{ - Canvas.popDialog(MessageBoxDlg); -} - -//--------------------------------------------------------------------------------------------- -// IODropdown -// By passing in a simgroup or simset, the user will be able to choose a child of that group -// through a guiPopupMenuCtrl -//--------------------------------------------------------------------------------------------- - -function IODropdown(%title, %message, %simgroup, %callback, %cancelCallback) -{ - IODropdownFrame.text = %title; - Canvas.pushDialog(IODropdownDlg); - MBSetText(IODropdownText, IODropdownFrame, %message); - - if(isObject(%simgroup)) - { - for(%i = 0; %i < %simgroup.getCount(); %i++) - IODropdownMenu.add(%simgroup.getObject(%i).getName()); - - } - - IODropdownMenu.sort(); - IODropdownMenu.setFirstSelected(0); - - IODropdownDlg.callback = %callback; - IODropdownDlg.cancelCallback = %cancelCallback; -} - -function IODropdownDlg::onSleep( %this ) -{ - %this.callback = ""; - %this.cancelCallback = ""; - IODropdownMenu.clear(); -} - -//The # in the function passed replaced with the output -//of the preset menu. -function IOCallback(%dlg, %callback) -{ - %id = IODropdownMenu.getSelected(); - %text = IODropdownMenu.getTextById(%id); - %callback = strreplace(%callback, "#", %text); - eval(%callback); - - Canvas.popDialog(%dlg); -} diff --git a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript index 16d2caa45..9b9b1490c 100644 --- a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript @@ -1,74 +1,94 @@ $TextMediumEmphasisColor = "200 200 200"; +$TextMediumEmphasisColorHL = "0 0 0"; $TextHighEmphasisColor = "224 224 224"; +$TextHighEmphasisColorHL = "0 0 0"; $TextDisabledColor = "108 108 108"; -new GuiGameListMenuProfile(DefaultListMenuProfile) +// --------------------------------------------------------------------------- +// Defaults +// --------------------------------------------------------------------------- +singleton GuiControlProfile( GuiMenuDefaultProfile ) +{ + opaque = false; + fillColor = "0 0 0 0"; + category = "BaseUI"; +}; + +singleton GuiControlProfile( GuiModelessDialogProfile : GuiMenuDefaultProfile ) +{ + modal = false; +}; + +singleton GuiControlProfile(GuiMenuBackgroundProfile) +{ + category = "BaseUI"; + opaque = true; + fillcolor = "34 34 34 255"; +}; + +singleton GuiControlProfile(GuiMenuPanelProfile) +{ + category = "BaseUI"; + opaque = true; + fillcolor = "15 15 15 255"; +}; + +singleton GuiControlProfile(GuiMenuBasePanelProfile) +{ + category = "BaseUI"; + opaque = true; + fillcolor = "40 40 40 255"; +}; + +// --------------------------------------------------------------------------- +// Text +// --------------------------------------------------------------------------- +singleton GuiControlProfile(MenuHeaderText) { fontType = "Arial Bold"; - fontSize = 20; - fontColor = $TextMediumEmphasisColor; - fontColorSEL = $TextMediumEmphasisColor; - fontColorNA = $TextDisabledColor; - fontColorHL = $TextMediumEmphasisColor; - - fillColor = "108 108 108"; - fillColorHL = "140 140 140"; - fillColorSEL = "180 180 180"; - - HitAreaUpperLeft = "16 20"; - HitAreaLowerRight = "503 74"; - IconOffset = "40 0"; - TextOffset = "100 0"; - RowSize = "500 90"; - ColumnSplit = "250"; - RightPad = "20"; - bitmap = "UI:listMenuArray_image"; - canKeyFocus = true; -}; - -new GuiControlProfile(GamepadDefaultProfile) -{ - border = 0; -}; - -new GuiControlProfile(GamepadButtonTextLeft) -{ - fontType = "Arial Bold"; - fontSize = 20; - fontColor = "255 255 255"; - justify = "left"; -}; - -new GuiControlProfile(GamepadButtonTextRight : GamepadButtonTextLeft) -{ - justify = "right"; -}; - -new GuiControlProfile(MenuHeaderText) -{ - fontType = "Arial Bold"; - fontSize = 30; + fontSize = 36; fontColor = $TextHighEmphasisColor; justify = "left"; + modal = false; + category = "BaseUI"; }; -new GuiControlProfile(MenuHeaderTextCenter) +singleton GuiControlProfile(MenuHeaderTextHighlighted : MenuHeaderText) +{ + fontColor = $TextHighEmphasisColorHL; +}; + +singleton GuiControlProfile(MenuHeaderTextCenter : MenuHeaderText) { - fontType = "Arial Bold"; - fontSize = 30; - fontColor = $TextHighEmphasisColor; justify = "center"; }; -new GuiControlProfile(MenuSubHeaderText) +singleton GuiControlProfile(MenuSubHeaderText) { fontType = "Arial Bold"; - fontSize = 20; + fontSize = 24; fontColor = $TextMediumEmphasisColor; justify = "left"; + modal = false; + category = "BaseUI"; }; -new GuiControlProfile(MenuMLSubHeaderText) +singleton GuiControlProfile(MenuSubHeaderTextHighlighted : MenuSubHeaderText) +{ + fontColor = $TextMediumEmphasisColorHL; +}; + +singleton GuiControlProfile(MenuSubHeaderCenteredText : MenuSubHeaderText) +{ + justify = "center"; +}; + +singleton GuiControlProfile(MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText) +{ + fontColor = $TextMediumEmphasisColorHL; +}; + +singleton GuiControlProfile(MenuMLSubHeaderText) { fontType = "Arial Bold"; fontSize = 20; @@ -76,482 +96,134 @@ new GuiControlProfile(MenuMLSubHeaderText) justify = "left"; autoSizeWidth = true; autoSizeHeight = true; -}; - -new GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText) -{ - justify = "center"; -}; - -if( !isObject( GuiMenuButtonProfile ) ) -new GuiControlProfile( GuiMenuButtonProfile ) -{ - opaque = true; - border = true; - fontSize = 18; - fontType = "Arial Bold"; - fontColor = $TextMediumEmphasisColor; - fontColorHL = $TextMediumEmphasisColor; - fontColorNA = $TextDisabledColor; - fontColorSEL = $TextMediumEmphasisColor; - fillColor = "40 40 40"; - fillColorHL = "49 34 37"; - fillColorNA = "40 40 40"; - borderColor = "87 87 87"; - borderColorNA = "0 0 0"; - borderColorHL = "194 64 64"; - fixedExtent = false; - justify = "center"; - canKeyFocus = false; - //bitmapAsset = "UI:menu_button_image"; - hasBitmapArray = false; - soundButtonDown = "UI:buttonClick"; - soundButtonOver = "UI:buttonHover"; - category = "Core"; -}; - -if( !isObject( GuiHighlightMenuButtonProfile ) ) -new GuiControlProfile( GuiHighlightMenuButtonProfile ) -{ - opaque = true; - border = false; - fontSize = 18; - fontType = "Arial Bold"; - fontColor = "240 240 240"; - fontColorHL = "0 0 0"; - fontColorNA = "125 125 125"; - //fontColorSEL ="0 0 0"; - fixedExtent = false; - justify = "center"; - canKeyFocus = false; - bitmapAsset = "UI:selector_button_highlight_only_image"; - hasBitmapArray = false; - category = "Core"; -}; - -if( !isObject( GuiBlankMenuButtonProfile ) ) -new GuiControlProfile( GuiBlankMenuButtonProfile ) -{ - opaque = true; - border = false; - fontSize = 18; - fontType = "Arial Bold"; - fontColor = "220 220 220"; - fontColorHL = "255 255 255"; - fontColorNA = "200 200 200"; - //fontColorSEL ="0 0 0"; - fixedExtent = false; - justify = "center"; - canKeyFocus = false; - bitmapAsset = "UI:selector_button_blank_image"; - hasBitmapArray = false; - soundButtonDown = menuButtonPressed; - soundButtonOver = menuButtonHover; - category = "Core"; -}; - -if( !isObject( GuiJoinServerButtonProfile ) ) -new GuiControlProfile( GuiJoinServerButtonProfile : GuiMenuButtonProfile ) -{ - justify = "left"; -}; - -if( !isObject( GuiMenuTextProfile ) ) -new GuiControlProfile( GuiMenuTextProfile ) -{ - opaque = true; - border = false; - fontSize = 18; - fontType = "Arial Bold"; - fontColor = "240 240 240"; - fontColorHL = "0 0 0"; - fontColorNA = "125 125 125"; - fixedExtent = false; - justify = "center"; - category = "Core"; -}; - -if( !isObject( GuiSolidDefaultProfile ) ) -new GuiControlProfile (GuiSolidDefaultProfile) -{ - opaque = true; - border = true; - category = "Core"; -}; - -if( !isObject( GuiTransparentProfile ) ) -new GuiControlProfile (GuiTransparentProfile) -{ - opaque = false; - border = false; - category = "Core"; -}; - -if( !isObject( GuiGroupBorderProfile ) ) -new GuiControlProfile( GuiGroupBorderProfile ) -{ - border = false; - opaque = false; - hasBitmapArray = true; - bitmapAsset = "UI:group_border_image"; - category = "Core"; -}; - -if( !isObject( GuiTabBorderProfile ) ) -new GuiControlProfile( GuiTabBorderProfile ) -{ - border = false; - opaque = false; - hasBitmapArray = true; - bitmapAsset = "UI:tab_border_image"; - category = "Core"; -}; - -if( !isObject( GuiModelessDialogProfile ) ) -new GuiControlProfile( GuiModelessDialogProfile ) -{ modal = false; - category = "Core"; + category = "BaseUI"; }; -if( !isObject( GuiFrameSetProfile ) ) -new GuiControlProfile (GuiFrameSetProfile) +singleton GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText) +{ + justify = "center"; +}; + +singleton GuiControlProfile( GuiMenuTextProfile ) { - fillcolor = "255 255 255"; - borderColor = "246 245 244"; - border = 1; opaque = true; - border = true; - category = "Core"; + border = false; + fontSize = 18; + fontType = "Arial Bold"; + fontColor = "240 240 240"; + fontColorHL = "0 0 0"; + fontColorNA = "125 125 125"; + fixedExtent = false; + justify = "center"; + category = "BaseUI"; + modal = false; }; -if( !isObject( GuiInputCtrlProfile ) ) -new GuiControlProfile( GuiInputCtrlProfile ) -{ - tab = true; - canKeyFocus = true; - category = "Core"; -}; - -if( !isObject( GuiTextProfile ) ) -new GuiControlProfile (GuiTextProfile) -{ - justify = "left"; - fontColor = "20 20 20"; - category = "Core"; -}; - -if( !isObject( GuiTextRightProfile ) ) -new GuiControlProfile (GuiTextRightProfile : GuiTextProfile) -{ - justify = "right"; - category = "Core"; -}; - -if( !isObject( GuiAutoSizeTextProfile ) ) -new GuiControlProfile (GuiAutoSizeTextProfile) +singleton GuiControlProfile( GuiMenuTextProfileHL : GuiMenuTextProfile ) { fontColor = "0 0 0"; - autoSizeWidth = true; - autoSizeHeight = true; - category = "Core"; }; -if( !isObject( GuiMediumTextProfile ) ) -new GuiControlProfile( GuiMediumTextProfile : GuiTextProfile ) -{ - fontSize = 24; - category = "Core"; -}; - -if( !isObject( GuiBigTextProfile ) ) -new GuiControlProfile( GuiBigTextProfile : GuiTextProfile ) -{ - fontSize = 36; - category = "Core"; -}; - -if( !isObject( GuiMLTextProfile ) ) -new GuiControlProfile( GuiMLTextProfile ) +singleton GuiControlProfile( GuiMLTextProfile ) { fontColor = $TextMediumEmphasisColor; fontColorHL = $TextMediumEmphasisColor; fontColorSEL = $TextMediumEmphasisColor; fontColorNA = $TextDisabledColor; + fontSize = 20; fontColorLink = "100 100 100"; fontColorLinkHL = $TextMediumEmphasisColor; autoSizeWidth = true; autoSizeHeight = true; border = false; - category = "Core"; + modal = false; + category = "BaseUI"; }; -if( !isObject( GuiMLWhiteTextProfile ) ) -new GuiControlProfile( GuiMLWhiteTextProfile ) +singleton GuiControlProfile( GuiMLTextProfileHighlighted : GuiMLTextProfile ) { - fontColor = "220 220 220"; - fontColorHL = $TextMediumEmphasisColor; - autoSizeWidth = true; - autoSizeHeight = true; - border = false; - category = "Core"; + fontColor = $TextMediumEmphasisColorHL; }; -if( !isObject( GuiTextArrayProfile ) ) -new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile ) -{ - fontColor = $TextMediumEmphasisColor; - fontColorHL = $TextMediumEmphasisColor; - fontColorSEL = $TextMediumEmphasisColor; - fontColorNA = $TextDisabledColor; - - fillColor = "22 22 22 255"; - fillColorHL = "22 22 22 255"; - fillColorSEL = "56 56 56 255"; - - border = true; - borderColor ="87 87 87"; - borderColorHL = "87 87 87"; - borderColorSEL = "255 255 255"; - - category = "Core"; - canKeyFocus = true; -}; - -if( !isObject( GuiMenuTextEditProfile ) ) -new GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile ) -{ - fontColor = $TextMediumEmphasisColor; - fontColorHL = $TextMediumEmphasisColor; - fontColorSEL = $TextMediumEmphasisColor; - fontColorNA = $TextDisabledColor; - - fillColor = "22 22 22 255"; - fillColorHL = "22 22 22 255"; - - border = true; - borderColor ="87 87 87"; - borderColorHL = "87 87 87"; - borderColorSEL = "255 255 255"; - - category = "Core"; -}; - -// ---------------------------------------------------------------------------- -// TODO: Revisit Popupmenu -// ---------------------------------------------------------------------------- - -if( !isObject( GuiPopupMenuItemBorder ) ) -new GuiControlProfile( GuiPopupMenuItemBorder : GuiButtonProfile ) +// --------------------------------------------------------------------------- +// Interactive Controls +// --------------------------------------------------------------------------- +singleton GuiControlProfile( GuiMenuButtonProfile ) { opaque = true; - border = true; - fontColor = "0 0 0"; - fontColorHL = "0 0 0"; - fontColorNA = "255 255 255"; - fixedExtent = false; + border = false; + fontSize = 24; + fontType = "Arial Bold"; + fontColor = "200 200 200 255"; + fontColorHL = "0 0 0 255"; + fontColorNA = "108 108 108 255"; + fontColorSEL = "200 200 200 255"; + fillColor = "0 0 0 0"; + fillColorHL = "255 255 255 255"; + fillColorNA = "40 40 40"; + borderColor = "87 87 87"; + borderColorNA = "0 0 0"; + borderColorHL = "194 64 64"; + fixedExtent = 0; justify = "center"; canKeyFocus = false; - bitmapAsset = "UI:menubutton_image"; - category = "Core"; + hasBitmapArray = false; + soundButtonDown = "UI:buttonClick"; + soundButtonOver = "UI:buttonHover"; + category = "BaseUI"; + fontColors[0] = "200 200 200 255"; + fontColors[2] = "108 108 108 255"; + fontColors[3] = "200 200 200 255"; }; -if( !isObject( GuiPopUpMenuDefault ) ) -new GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile ) +singleton GuiControlProfile( GuiMenuButtonLeftJustProfile : GuiMenuButtonProfile ) { - opaque = true; - mouseOverSelected = true; - textOffset = "3 3"; - border = 0; - borderThickness = 0; - fixedExtent = true; - hasBitmapArray = true; - - fillColor = EditorSettings.value("Theme/fieldBGColor");//"255 255 255";//100 - fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");//"91 101 116"; - fillColorSEL = EditorSettings.value("Theme/fieldBGSELColor");//"91 101 116"; - fontColor = EditorSettings.value("Theme/fieldTextColor");//"215 215 215"; - fontColorHL = EditorSettings.value("Theme/fieldTextHLColor");//"215 215 215"; - fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor");//"215 215 215"; - fontColorNA = EditorSettings.value("Theme/fieldTextColor");//"215 215 215"; - borderColor = EditorSettings.value("Theme/dividerDarkColor"); - profileForChildren = GuiPopupMenuItemBorder; - category = "Core"; + justify = "Left"; }; -if( !isObject( GuiPopUpMenuProfile ) ) -new GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault ) +singleton GuiControlProfile( GuiRemapActionMapButtonProfile : GuiMenuButtonProfile ) { - textOffset = "6 4"; - bitmapAsset = "UI:dropDown_image"; - hasBitmapArray = true; - border = 1; - profileForChildren = GuiPopUpMenuDefault; - category = "Core"; + fillColor = "18 18 18 255"; + fillColorHL = "0 0 0 255"; + modal = false; }; -if( !isObject( GuiTabBookProfile ) ) -new GuiControlProfile( GuiTabBookProfile ) -{ - fillColorHL = "100 100 100"; - fillColorNA = "150 150 150"; - fontColor = "30 30 30"; - fontColorHL = "0 0 0"; - fontColorNA = "50 50 50"; - fontType = "Arial"; - fontSize = 14; - justify = "center"; - bitmapAsset = "UI:tab_image"; - tabWidth = 64; - tabHeight = 24; - tabPosition = "Top"; - tabRotation = "Horizontal"; - textOffset = "0 -3"; - tab = true; - cankeyfocus = true; - category = "Core"; -}; - -if( !isObject( GuiTabPageProfile ) ) -new GuiControlProfile( GuiTabPageProfile : GuiDefaultProfile ) -{ - fontType = "Arial"; - fontSize = 10; - justify = "center"; - bitmapAsset = "UI:tab_image"; - opaque = false; - fillColor = "240 239 238"; - category = "Core"; -}; - -if( !isObject( GuiConsoleProfile ) ) -new GuiControlProfile( GuiConsoleProfile ) -{ - fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console"; - fontSize = ($platform $= "macos") ? 13 : 12; - fontColor = "255 255 255"; - fontColorHL = "0 255 255"; - fontColorNA = "255 0 0"; - fontColors[6] = "100 100 100"; - fontColors[7] = "100 100 0"; - fontColors[8] = "0 0 100"; - fontColors[9] = "0 100 0"; - category = "Core"; -}; - -if( !isObject( GuiConsoleTextProfile ) ) -new GuiControlProfile( GuiConsoleTextProfile ) -{ - fontColor = "0 0 0"; - autoSizeWidth = true; - autoSizeHeight = true; - textOffset = "2 2"; - opaque = true; - fillColor = "255 255 255"; - border = true; - borderThickness = 1; - borderColor = "0 0 0"; - category = "Core"; -}; - -$ConsoleDefaultFillColor = "0 0 0 175"; - -if( !isObject( ConsoleScrollProfile ) ) -new GuiControlProfile( ConsoleScrollProfile : GuiScrollProfile ) -{ - opaque = true; - fillColor = $ConsoleDefaultFillColor; - border = 1; - //borderThickness = 0; - borderColor = "0 0 0"; - category = "Core"; -}; - -if( !isObject( ConsoleTextEditProfile ) ) -new GuiControlProfile( ConsoleTextEditProfile : GuiTextEditProfile ) -{ - fillColor = "242 241 240 255"; - fillColorHL = "255 255 255"; - category = "Core"; -}; - -//----------------------------------------------------------------------------- -// Center and bottom print -//----------------------------------------------------------------------------- - -if( !isObject( CenterPrintProfile ) ) -new GuiControlProfile ( CenterPrintProfile ) +singleton GuiControlProfile(GuiMenuScrollProfile) { opaque = false; - fillColor = "128 128 128"; - fontColor = "0 255 0"; - border = true; - borderColor = "0 255 0"; - category = "Core"; -}; - -if( !isObject( CenterPrintTextProfile ) ) -new GuiControlProfile ( CenterPrintTextProfile ) -{ - opaque = false; - fontType = "Arial"; - fontSize = 12; - fontColor = "0 255 0"; - category = "Core"; -}; - -// ---------------------------------------------------------------------------- -// Radio button control -// ---------------------------------------------------------------------------- - -if( !isObject( GuiRadioProfile ) ) -new GuiControlProfile( GuiRadioProfile ) -{ - fontSize = 14; - fillColor = "232 232 232"; - fontColor = "20 20 20"; - fontColorHL = "80 80 80"; - fixedExtent = true; - bitmapAsset = "UI:radioButton_image"; - hasBitmapArray = true; - category = "Core"; -}; - -// -// Scroll Profile -// -if(!isObject(GuiMenuScrollProfile)) -new GuiControlProfile(GuiMenuScrollProfile) -{ - opaque = false; - fillcolor = "22 22 22"; + fillcolor = "0 0 0 0"; fontColor = "200 200 200"; fontColorHL = "250 250 250"; border = false; bitmapAsset = "UI:scrollBar_image"; hasBitmapArray = true; - category = "Core"; + category = "BaseUI"; }; -// Scroll -if(!isObject(GuiMenuScrollProfile)) -new GuiControlProfile(GuiMenuScrollProfile) +new GuiControlProfile(MenuTextEditprofile) { opaque = true; - fillcolor = "128 128 128"; - fontColor = "0 0 0"; - fontColorHL = "150 150 150"; - border = true; - bitmapAsset = "UI:scrollBar_image"; - hasBitmapArray = true; - category = "Core"; -}; - -singleton GuiControlProfile(SliderBitmapGUIProfile) -{ - bitmapAsset = "UI:optionsMenuSliderBitmapArray_image"; - hasBitmapArray = true; - opaque = false; - borderColor = "0 0 0 255"; + fillColor = "10 10 10 255"; + fillColorHL = "10 10 10 255"; + fontColor = "240 240 240"; + fontColorHL = "10 10 10 255"; + fontColorSEL = "255 255 255 255"; + fontColorNA = "200 200 200"; + textOffset = "4 2"; + autoSizeWidth = false; + autoSizeHeight = true; + justify = "left"; + tab = true; + canKeyFocus = true; + category = "BaseUI"; + borderColorSEL = "0 0 0 0"; + fontColors[0] = "240 240 240 255"; + fontColors[1] = "10 10 10 255"; + fontColors[2] = "200 200 200 255"; + fontColors[3] = "255 255 255 255"; + fillColorSEL = "10 10 10 255"; + fontSize = "18"; + cursorColor = "255 255 255 255"; }; diff --git a/Templates/BaseGame/game/data/UI/scripts/utility.tscript b/Templates/BaseGame/game/data/UI/scripts/utility.tscript index 4245651f0..e5eeac2de 100644 --- a/Templates/BaseGame/game/data/UI/scripts/utility.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/utility.tscript @@ -1,3 +1,25 @@ +function ActionMap::getCommandButtonBitmap(%this, %device, %command) +{ + %binding = %this.getBinding(%command); + + if(%device $= "mouse" || %device $= "") + %device = "keyboard"; + + %bindingCount = getFieldCount(%binding); + for(%i=0; %i < %bindingCount; %i+=2) + { + %mapDevice = stripTrailingNumber(getField(%binding, %i)); + if(%mapDevice $= %device) + { + %button = getField(%binding, %i+1); + break; + } + } + + %assetId = getButtonBitmap(%device, %button); + return %assetId; +} + function getButtonBitmap(%device, %button) { if(%device $= "gamepad") @@ -23,13 +45,13 @@ function getButtonBitmap(%device, %button) %assetId = %assetId @ "Square"; else if(%button $= "Y" || %button $= "btn_y") %assetId = %assetId @ "Triangle"; - else if(%button $= "LB") + else if(%button $= "LB" || %button $= "btn_l") %assetId = %assetId @ "L1"; - else if(%button $= "LT") + else if(%button $= "LT" || %button $= "btn_lt") %assetId = %assetId @ "L2"; - else if(%button $= "RB") + else if(%button $= "RB" || %button $= "btn_r") %assetId = %assetId @ "R1"; - else if(%button $= "RT") + else if(%button $= "RT" || %button $= "btn_rt") %assetId = %assetId @ "R2"; else if(%button $= "thumbrx" || %button $= "thumbry") %assetId = %assetId @ "Right_Stick"; @@ -62,13 +84,13 @@ function getButtonBitmap(%device, %button) %assetId = %assetId @ "Y"; else if(%button $= "Y" || %button $= "btn_y") %assetId = %assetId @ "X"; - else if(%button $= "LB") + else if(%button $= "LB" || %button $= "btn_l") %assetId = %assetId @ "LB"; - else if(%button $= "LT") + else if(%button $= "LT" || %button $= "btn_lt") %assetId = %assetId @ "LT"; - else if(%button $= "RB") + else if(%button $= "RB" || %button $= "btn_r") %assetId = %assetId @ "RB"; - else if(%button $= "RT") + else if(%button $= "RT" || %button $= "btn_rt") %assetId = %assetId @ "RT"; else if(%button $= "thumbrx" || %button $= "thumbry") %assetId = %assetId @ "Right_Stick"; @@ -91,6 +113,9 @@ function getButtonBitmap(%device, %button) } else if(%device $= "Keyboard" || %device $= "Mouse") { + if(%button $= "lshift" || %button $= "rshift") + %button = "shift"; + %assetId = "UI:Keyboard_Black_" @ %button @ "_image"; } else if(%device !$= "") @@ -98,13 +123,21 @@ function getButtonBitmap(%device, %button) %assetId = "UI:Xbox_"; if(%button $= "btn_a") - %assetId = %assetId @ "B"; - else if(%button $= "btn_b") %assetId = %assetId @ "A"; + else if(%button $= "btn_b") + %assetId = %assetId @ "B"; else if(%button $= "btn_x") - %assetId = %assetId @ "Y"; - else if(%button $= "btn_y") %assetId = %assetId @ "X"; + else if(%button $= "btn_y") + %assetId = %assetId @ "Y"; + else if(%button $= "LB" || %button $= "btn_l") + %assetId = %assetId @ "LB"; + else if(%button $= "LT" || %button $= "btn_lt") + %assetId = %assetId @ "LT"; + else if(%button $= "RB" || %button $= "btn_r") + %assetId = %assetId @ "RB"; + else if(%button $= "RT" || %button $= "btn_rt") + %assetId = %assetId @ "RT"; else if(%button $= "thumbrx" || %button $= "thumbry") %assetId = %assetId @ "Right_Stick"; else if(%button $= "thumblx" || %button $= "thumbly") diff --git a/Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui b/Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui deleted file mode 100644 index 6d40a9164..000000000 --- a/Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui +++ /dev/null @@ -1,485 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -$guiContent = new GuiContainer(NewEditorGui) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1920 1080"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - enabled = "1"; - - new GuiSplitContainer(NewEditorGuiLayout) { - orientation = "Vertical"; - splitterSize = "2"; - splitPoint = "1661 100"; - fixedPanel = "None"; - useMinExtent="0"; - fixedSize = "260"; - docking = "None"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1921 1081"; - minExtent = "64 64"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiPanel() { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1659 1081"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Panel1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiSplitContainer(Editor_ToolsMainSplit) { - orientation = "Vertical"; - splitterSize = "2"; - splitPoint = "230 100"; - fixedPanel = "None"; - useMinExtent="0"; - fixedSize = "1429"; - docking = "None"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1659 1081"; - minExtent = "64 64"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiPanel(Editor_ToolSidebarPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "228 1081"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Panel1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiWindowCtrl(Editor_ToolsSidebarWindow) { - text = "Tool Settings"; - resizeWidth = "0"; - resizeHeight = "0"; - canMove = "0"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - canCollapse = "0"; - edgeSnap = "1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "228 1081"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiWindowProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiPanel(Editor_MainWindowPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "232 0"; - extent = "1427 1081"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "panel2"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiSplitContainer(Editor_MainViewSplit) { - orientation = "Horizontal"; - splitterSize = "2"; - splitPoint = "182 745"; - fixedPanel = "None"; - useMinExtent="0"; - fixedSize = "273"; - docking = "None"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1427 1081"; - minExtent = "64 64"; - horizSizing = "width"; - vertSizing = "height"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiPanel(Editor_MainViewPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1427 743"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Panel1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTabBookCtrl(Editor_MainViewTabBook) { - tabPosition = "Top"; - tabMargin = "7"; - minTabWidth = "64"; - tabHeight = "20"; - allowReorder = "0"; - defaultPage = "-1"; - selectedPage = "-1"; - frontTabPadding = "0"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1427 743"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "height"; - profile = "ToolsGuiTabBookProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl(Editor_InspectorSidebarButton) { - bitmap = "tools/gui/images/iconAdd.png"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "1411 61"; - extent = "15 15"; - minExtent = "8 2"; - horizSizing = "left"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl(Editor_ToolsSidebarButton) { - bitmap = "tools/gui/images/iconAdd.png"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "0 61"; - extent = "15 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl(Editor_AssetBrowserButton) { - bitmap = "tools/gui/images/iconAdd.png"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "1411 725"; - extent = "15 15"; - minExtent = "8 2"; - horizSizing = "left"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiBitmapButtonCtrl(Editor_VisibilityOptionsButton) { - bitmap = "tools/gui/images/visible"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "16 30"; - extent = "18 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiPanel(Editor_AssetBrowserPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 747"; - extent = "1427 334"; - minExtent = "16 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "panel2"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - }; - }; - }; - new GuiPanel(Editor_InspectorPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1663 0"; - extent = "258 1081"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "panel2"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiSplitContainer() { - orientation = "Horizontal"; - splitterSize = "2"; - splitPoint = "182 556"; - fixedPanel = "None"; - useMinExtent="0"; - fixedSize = "100"; - docking = "None"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "258 1081"; - minExtent = "64 64"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiPanel(Editor_SceneTreePanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "258 554"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Panel1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiPanel(Editor_PropertiesPanel) { - docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 558"; - extent = "258 523"; - minExtent = "0 0"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "panel2"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - }; - }; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui b/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui index b6315df53..e48614c5a 100644 --- a/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui +++ b/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui @@ -302,7 +302,7 @@ new VPathEditor(EVPathEditor) { }; new GuiPopUpMenuCtrl(EPathEditorNodeOrientationMode){ internalName = "weight"; - Profile = "GuiPopUpMenuProfile"; + Profile = "ToolsGuiPopUpMenuProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "57 84"; @@ -385,7 +385,7 @@ new VPathEditor(EVPathEditor) { canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "GuiTransparentProfile"; + Profile = "ToolsGuiTransparentProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "1 1"; diff --git a/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditorToolbar.gui b/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditorToolbar.gui index 57651df52..5a1f0a808 100644 --- a/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditorToolbar.gui +++ b/Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditorToolbar.gui @@ -30,7 +30,7 @@ $guiContent = new GuiControl(VPathEditorToolbar) new GuiTextCtrl() { internalName = "ToolbarLabel"; - profile = "GuiTextProfile"; + profile = "ToolsGuiTextProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "2 7"; @@ -48,7 +48,7 @@ $guiContent = new GuiControl(VPathEditorToolbar) internalName = "PathTypeMenu"; Enabled = "1"; isContainer = "0"; - Profile = "GuiPopUpMenuProfile"; + Profile = "ToolsGuiPopUpMenuProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "85 7"; diff --git a/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript b/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript index 0705216ed..67ea3c5c6 100644 --- a/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript +++ b/Templates/BaseGame/game/tools/VPathEditor/Scripts/Plugin.tscript @@ -18,7 +18,7 @@ function VPathEditorPlugin::onWorldEditorStartup( %this ) // //---------------------------------------------------------------------- - EditorGui.add( EVPathEditor ); + MainSceneTabPanel.add( EVPathEditor ); EVPathEditor.setVisible( false ); %this.EditorMap = new ActionMap(); diff --git a/Templates/BaseGame/game/tools/VerveEditor/GUI/GuiProfiles.tscript b/Templates/BaseGame/game/tools/VerveEditor/GUI/GuiProfiles.tscript index ada3b1a08..457e0fae2 100644 --- a/Templates/BaseGame/game/tools/VerveEditor/GUI/GuiProfiles.tscript +++ b/Templates/BaseGame/game/tools/VerveEditor/GUI/GuiProfiles.tscript @@ -79,7 +79,7 @@ singleton GuiControlProfile( VEditorTextEditProfile : VEditorDefaultProfile ) canKeyFocus = true; }; -singleton GuiControlProfile( VEditorPopupMenuProfile : GuiPopUpMenuProfile ) +singleton GuiControlProfile( VEditorPopupMenuProfile : ToolsGuiPopUpMenuProfile ) { FillColorHL = "90 90 90"; FillColorSEL = "0 0 0"; @@ -204,7 +204,7 @@ singleton GuiControlProfile( VEditorPropertyLabelProfile : VEditorTextProfile ) //----------------------------------------------------------------------------- -singleton GuiControlProfile( VEditorPreferenceLabelProfile : GuiTextProfile ) +singleton GuiControlProfile( VEditorPreferenceLabelProfile : ToolsGuiTextProfile ) { opaque = true; fillColor = "242 241 240"; diff --git a/Templates/BaseGame/game/tools/VerveEditor/main.tscript b/Templates/BaseGame/game/tools/VerveEditor/main.tscript index d65cd2651..b6b2006bc 100644 --- a/Templates/BaseGame/game/tools/VerveEditor/main.tscript +++ b/Templates/BaseGame/game/tools/VerveEditor/main.tscript @@ -90,7 +90,7 @@ function VerveEditor::LaunchEditor() { %mainScreen.add(VerveEditorGUI); VerveEditorGUI.position.y = VerveEditorGUI.Position.y + 20; - EditorGUI.add(%mainScreen); + MainSceneTabPanel.add(%mainScreen); } // Clear History. diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui index 735275523..f64982991 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -1105,7 +1105,7 @@ $guiContent = new GuiControl(AssetBrowser) { groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "120 340"; + position = getWord($pref::Video::mode, 0) - 420 SPC 340; extent = "53 19"; minExtent = "8 2"; horizSizing = "left"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 1216eaab6..9d04721c6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -2420,7 +2420,7 @@ function AssetBrowserPreviewButton::onMouseDragged(%this) %ctrl = new GuiDragAndDropControl() { canSaveDynamicFields = "0"; - Profile = "GuiSolidDefaultProfile"; + Profile = "ToolsGuiSolidDefaultProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = %xPos SPC %yPos; @@ -2582,12 +2582,24 @@ function GuiEditor::onControlDropped(%this, %payload, %position) //dealing with an actual asset, so build the assetName %assetId = %payload.moduleName @ ":" @ %payload.assetName; %assetType = AssetDatabase.getAssetType(%assetId); - - if(%assetType $= "ImageAsset") + + if(AssetBrowser.isMethod("on" @ %assetType @ "GUIEditorDropped")) { - %cmd = "return new guiBitmapCtrl();"; - %ctrl = eval( %cmd ); - %ctrl.bitmap = %assetId; + %module = %payload.moduleName; + %asset = %payload.assetName; + %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); + %buildCommand = AssetBrowser @ ".on" @ %assetType @ "GUIEditorDropped(" @ %assetDef @ ",\"" @ %pos @ "\");"; + eval(%buildCommand); + } + else + { + //fallback example + if(%assetType $= "ImageAsset") + { + %cmd = "return new guiBitmapCtrl();"; + %ctrl = eval( %cmd ); + %ctrl.bitmap = %assetId; + } } } else diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript index cbf40f97f..da45e2059 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript @@ -24,7 +24,7 @@ function AssetBrowser::buildCppAssetPreview(%this, %assetDef, %previewData) %previewData.tooltip = %assetDef.assetName; } -function AssetBrowser::createCpp(%this) +function AssetBrowser::createCppAsset(%this) { %moduleName = AssetBrowser.newAssetSettings.moduleName; %modulePath = "data/" @ %moduleName; @@ -170,12 +170,12 @@ function AssetBrowser::createCpp(%this) return ""; } -function AssetBrowser::editCpp(%this, %assetDef) +function AssetBrowser::editCppAsset(%this, %assetDef) { } //Renames the asset -function AssetBrowser::renameCpp(%this, %assetDef, %newAssetName) +function AssetBrowser::renameCppAsset(%this, %assetDef, %newAssetName) { %newCodeLooseFilename = renameAssetLooseFile(%assetDef.codefile, %newAssetName); @@ -195,13 +195,13 @@ function AssetBrowser::renameCpp(%this, %assetDef, %newAssetName) } //Deletes the asset -function AssetBrowser::deleteCpp(%this, %assetDef) +function AssetBrowser::deleteCppAsset(%this, %assetDef) { AssetDatabase.deleteAsset(%assetDef.getAssetId(), true); } //Moves the asset to a new path/module -function AssetBrowser::moveCpp(%this, %assetDef, %destination) +function AssetBrowser::moveCppAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript index 8064c070f..f5a072d5b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript @@ -91,6 +91,17 @@ function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position) } +function AssetBrowser::onSoundAssetGUIEditorDropped(%this, %assetDef, %position) +{ + %assetId = %assetDef.getAssetId(); + %cmd = "new GuiAudioCtrl(){"; + %cmd = %cmd @ "SoundAsset =\""@ %assetId @"\";"; + %cmd = %cmd @ "position =\""@ %position @"\";"; + %cmd = %cmd @ "};"; + %ctrl = GuiEditCanvas.createObject(%cmd); + echo(%ctrl SPC "created"); +} + function GuiInspectorTypeSoundAssetPtr::onControlDropped( %this, %payload, %position ) { Canvas.popDialog(EditorDragAndDropLayer); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript index 55c5b8308..226635dba 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript @@ -9,6 +9,8 @@ function AssetBrowser_editAsset::saveAsset(%this) %assetType = AssetDatabase.getAssetType(%this.editedAssetId); %assetDef = AssetDatabase.acquireAsset(%this.editedAssetId); + %assetDef.refreshAsset(); + AssetBrowser.call("on" @ %assetType @ "Changed", %assetDef); AssetDatabase.releaseAsset(%this.editedAssetId); diff --git a/Templates/BaseGame/game/tools/convexEditor/main.tscript b/Templates/BaseGame/game/tools/convexEditor/main.tscript index 7d04d55c8..86e09c7f6 100644 --- a/Templates/BaseGame/game/tools/convexEditor/main.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/main.tscript @@ -36,10 +36,10 @@ function initializeConvexEditor() ConvexEditorOptionsWindow.setVisible( false ); - EditorGui.add( ConvexEditorGui ); - EditorGui.add( ConvexEditorOptionsWindow ); - EditorGui.add( ConvexEditorTreeWindow ); - EditorGui.add( ConvexEditorOptionsWindow ); + MainSceneTabPanel.add( ConvexEditorGui ); + MainSceneTabPanel.add( ConvexEditorOptionsWindow ); + MainSceneTabPanel.add( ConvexEditorTreeWindow ); + MainSceneTabPanel.add( ConvexEditorOptionsWindow ); new ScriptObject( ConvexEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/datablockEditor/main.tscript b/Templates/BaseGame/game/tools/datablockEditor/main.tscript index f577263cf..7bae6fb03 100644 --- a/Templates/BaseGame/game/tools/datablockEditor/main.tscript +++ b/Templates/BaseGame/game/tools/datablockEditor/main.tscript @@ -37,8 +37,8 @@ function initializeDatablockEditor() DatablockEditorInspectorWindow.setVisible( false ); DatablockEditorTreeWindow.setVisible( false ); - EditorGui.add( DatablockEditorInspectorWindow ); - EditorGui.add( DatablockEditorTreeWindow ); + MainSceneTabPanel.add( DatablockEditorInspectorWindow ); + MainSceneTabPanel.add( DatablockEditorTreeWindow ); new ScriptObject( DatablockEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/decalEditor/main.tscript b/Templates/BaseGame/game/tools/decalEditor/main.tscript index 58b3201ec..27a34e665 100644 --- a/Templates/BaseGame/game/tools/decalEditor/main.tscript +++ b/Templates/BaseGame/game/tools/decalEditor/main.tscript @@ -35,9 +35,9 @@ function initializeDecalEditor() DecalEditorGui.setVisible( false ); DecalPreviewWindow.setVisible( false ); DecalEditorWindow.setVisible( false ); - EditorGui.add( DecalEditorGui ); - EditorGui.add( DecalEditorWindow ); - EditorGui.add( DecalPreviewWindow ); + MainSceneTabPanel.add( DecalEditorGui ); + MainSceneTabPanel.add( DecalEditorWindow ); + MainSceneTabPanel.add( DecalPreviewWindow ); DecalEditorTabBook.selectPage( 0 ); new ScriptObject( DecalEditorPlugin ) diff --git a/Templates/BaseGame/game/tools/editorCore/editorCore.module b/Templates/BaseGame/game/tools/editorCore/editorCore.module new file mode 100644 index 000000000..2c107aea5 --- /dev/null +++ b/Templates/BaseGame/game/tools/editorCore/editorCore.module @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/editorCore/editorCore.tscript b/Templates/BaseGame/game/tools/editorCore/editorCore.tscript new file mode 100644 index 000000000..3a63b6a5d --- /dev/null +++ b/Templates/BaseGame/game/tools/editorCore/editorCore.tscript @@ -0,0 +1,12 @@ + +function EditorCore::onCreate(%this) +{ + exec("./scripts/menuBar/menuBuilder.ed.tscript"); + + MenuBuilder::init(); +} + +function EditorCore::onDestroy(%this) +{ + MenuBuilder::clearMenus(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.tscript b/Templates/BaseGame/game/tools/editorCore/scripts/menuBar/menuBuilder.ed.tscript similarity index 67% rename from Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.tscript rename to Templates/BaseGame/game/tools/editorCore/scripts/menuBar/menuBuilder.ed.tscript index 883c32bf9..ce563a76e 100644 --- a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.tscript +++ b/Templates/BaseGame/game/tools/editorCore/scripts/menuBar/menuBuilder.ed.tscript @@ -104,8 +104,206 @@ /// /// @see PopupMenu /// -//----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +//============================================================================== +// Static functions for managing the menus + +// Static function +function MenuBuilder::init() +{ + new ArrayObject(MenuBuilderMenuList){}; +} + +// Static function +function MenuBuilder::clearMenus() +{ + MenuBuilderMenuList.empty(); +} + +// Static function +function MenuBuilder::addMenuToMenubar(%menuBar, %menu, %pos) +{ + if(%pos $= "") + %pos = -1; //if we don't specify, throw it on the end + + %menuBar.insert(%menu, %pos); +} + +// Static function +function MenuBuilder::newMenu(%title, %className) +{ + if(%title $= "") + { + error("MenuBuilder::newMenu() - menu requires title!"); + return 0; + } + + if(%className $= "") + %className = "EditorWorldMenu"; + + %newMenu = new PopupMenu() { + superClass = "MenuBuilder"; + class = %className; + barTitle = %title; + + numItems = 0; + isSubmenu = false; + }; + + MenuBuilderMenuList.add(%newMenu); + + return %newMenu; +} + +function MenuBuilder::newItem(%this, %itemLabel, %command, %accelerator, %pos, %icon) +{ + if(isObject(%command)) + %item = %itemLabel TAB %command; + else + %item = %itemLabel TAB %accelerator TAB %command TAB %icon; + + %this.setItemPosition(%item, %pos); +} + +function MenuBuilder::newSubmenu(%this, %title, %className, %pos) +{ + if(%title $= "") + { + error("MenuBuilder::newSubmenu() - menu requires title!"); + return 0; + } + + if(%pos < 0) + { + error("MenuBuilder::newSubmenu() - position must be greater than 0!"); + return; + } + + if(%className $= "") + %className = "EditorWorldMenu"; + + %newMenu = new PopupMenu() { + superClass = "MenuBuilder"; + class = %className; + barTitle = %title; + + numItems = 0; + isSubmenu = true; + }; + + if(%pos $= "") + %pos = %this.numItems; + + if(%this.setItemPosition(%title TAB %newMenu, %pos)) + { + return %newMenu; + } + + return 0; +} + +function MenuBuilder::newSeparator(%this, %pos) +{ + %item = "-"; + + %this.setItemPosition(%item, %pos); +} + +function MenuBuilder::setItemPosition(%this, %item, %pos) +{ + if(%pos < 0) + { + error("MenuBuilder::setItemPosition() - position must be greater than 0!"); + return false; + } + + if(%pos $= "") + { + %pos = %this.numItems; + } + else + { + //ok, we need to nudge all indexed items up from the insert position and up + for(%i = %this.numItems; %i > %pos; %i--) + { + %this.item[%i+1] = %this.item[%i]; + } + } + + %this.item[%pos] = %item; + + %this.numItems++; + %this.reloadItems(); + + return true; +} + +// Static function +function MenuBuilder::findMenu(%title, %recurse) +{ + if(%recurse $= "") + %recurse = false; + + for(%i=0; %i < MenuBuilderMenuList.count(); %i++) + { + %menu = MenuBuilderMenuList.getObject(%i); + + if(%menu.barTitle $= %title) + { + return %menu; + } + else if(%recurse) + { + %subMenu = %menu.findMenu(%title, %recurse); + if(isObject(%submenu)) + return %subMenu; + } + } + + return 0; +} + +function MenuBuilder::findMenu(%this, %title, %recurse) +{ + if(%recurse $= "") + %recurse = false; + + for(%i=0; %i < %this.numItems; %i++) + { + %item = %this.item[%i]; + %menu = getField(%item, 1); + if(isObject(%menu)) + { + if(%menu.barTitle $= %title) + { + return %menu; + } + else if(%recurse) + { + %subMenu = %menu.findMenu(%title, %recurse); + if(isObject(%submenu)) + return %subMenu; + } + } + } + + return 0; +} + +function MenuBuilder::findItem(%this, %itemLabel) +{ + for(%i=0; %i < %this.numItems; %i++) + { + %item = %this.item[%i]; + if(getField(%item, 0) $= %itemLabel) + return %i; + } + + return -1; +} +//============================================================================== +//============================================================================== // Adds one item to the menu. // if %item is skipped or "", we will use %item[#], which was set when the menu was created. // if %item is provided, then we update %item[#]. diff --git a/Templates/BaseGame/game/tools/forestEditor/main.tscript b/Templates/BaseGame/game/tools/forestEditor/main.tscript index faeb2b12a..15bb273af 100644 --- a/Templates/BaseGame/game/tools/forestEditor/main.tscript +++ b/Templates/BaseGame/game/tools/forestEditor/main.tscript @@ -35,9 +35,9 @@ function initializeForestEditor() ForestEditorPalleteWindow.setVisible( false ); ForestEditorPropertiesWindow.setVisible( false ); - EditorGui.add( ForestEditorGui ); - EditorGui.add( ForestEditorPalleteWindow ); - EditorGui.add( ForestEditorPropertiesWindow ); + MainSceneTabPanel.add( ForestEditorGui ); + MainSceneTabPanel.add( ForestEditorPalleteWindow ); + MainSceneTabPanel.add( ForestEditorPropertiesWindow ); new ScriptObject( ForestEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/gui/messageBoxes/IODropdownDlg.ed.gui b/Templates/BaseGame/game/tools/gui/messageBoxes/IODropdownDlg.ed.gui index e62771773..dda5498a0 100644 --- a/Templates/BaseGame/game/tools/gui/messageBoxes/IODropdownDlg.ed.gui +++ b/Templates/BaseGame/game/tools/gui/messageBoxes/IODropdownDlg.ed.gui @@ -54,7 +54,7 @@ $guiContent = new GuiControl(IODropdownDlg) { }; new GuiBitmapBorderCtrl() { isContainer = "0"; - profile = "GuiGroupBorderProfile"; + profile = "ToolsGuiGroupBorderProfile"; horizSizing = "width"; vertSizing = "bottom"; position = "7 51"; diff --git a/Templates/BaseGame/game/tools/gui/renderTargetVisualizer.ed.gui b/Templates/BaseGame/game/tools/gui/renderTargetVisualizer.ed.gui index 79007fda4..9c6b5fa15 100644 --- a/Templates/BaseGame/game/tools/gui/renderTargetVisualizer.ed.gui +++ b/Templates/BaseGame/game/tools/gui/renderTargetVisualizer.ed.gui @@ -5,7 +5,7 @@ $guiContent = new GuiControl(RenderTargetVisualizer) { minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiModelessDialogProfile"; + profile = "ToolsGuiModelessDialogProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -79,7 +79,7 @@ $guiContent = new GuiControl(RenderTargetVisualizer) { minExtent = "8 2"; horizSizing = "width"; vertSizing = "bottom"; - profile = "GuiPopUpMenuProfile"; + profile = "ToolsGuiPopUpMenuProfile"; visible = "1"; active = "1"; command = "RenderTargetsList.updateTarget();"; diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript index 0c50b1c59..41ce1989f 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript @@ -211,6 +211,8 @@ function GuiEditCanvas::onCreateMenu(%this) }; }; + %this.buildAddMenu(); + // Workaround (for some reason it doesn't size to the width of the canvas) // TODO: After a canvas resize it still messes up the width %position = %this.menubar.position.x SPC %this.menubar.position.y; @@ -220,6 +222,88 @@ function GuiEditCanvas::onCreateMenu(%this) %this.menuBar.attachToCanvas( Canvas, 0 ); } +function GuiEditCanvas::buildAddMenu(%this) +{ + %addMenu = MenuBuilder::newMenu("Add"); + + %enumeratedClasses = enumerateConsoleClasses("GuiControl"); + for(%c=0; %c < getFieldCount(%enumeratedClasses); %c++) + { + %class = getField(%enumeratedClasses, %c); + + if( GuiEditor.isFilteredClass( %class ) + || !isMemberOfClass( %class, "GuiControl" ) ) + continue; + + %category = getCategoryOfClass(%class); + + if(%category $= "") + { + error("Attempted to fetch category of class " @ %class @ " but none were found."); + continue; + } + + %parentMenu = %addMenu; //start at the top + for(%cat=0; %cat < getFieldCount(%category); %cat++) + { + %subCat = getField(%category, %cat); + %targetSubmenu = %parentMenu.findMenu(%subCat); + if(!isObject(%targetSubmenu)) + { + %targetSubmenu = %parentMenu.newSubmenu(%subCat); + } + + %parentMenu = %targetSubmenu; + } + + %buildfunc = ""; + %class = %class; + %method = "build" @ %buildfunc; + if( !GuiEditCanvas.isMethod( %method ) ) + %method = "build" @ %class; + + if( !GuiEditCanvas.isMethod( %method ) ) + %cmd = "return new " @ %class @ "();"; + else + %cmd = "GuiEditCanvas." @ %method @ "();"; + + %createCmd = "GuiEditCanvas.newObjectCallback = \"GuiEditCanvas.onFinishCreateObject\"; GuiEditCanvas.createObject( \"" @ %cmd @ "\" );"; + + %targetSubmenu.newItem(%class, %createCmd, ""); + } + + MenuBuilder::addMenuToMenubar(%this.menubar, %addMenu, 4); +} + +function GuiEditCanvas::createObject( %this, %cmd ) +{ + if(startsWith(%cmd, "return ")) + %objId = eval(%cmd); + else + %objId = eval("return " @ %cmd); + + if( isObject( %objId ) ) + %this.onFinishCreateObject( %objId ); + + return %objId; +} + +function GuiEditCanvas::onFinishCreateObject( %this, %objId ) +{ + GuiEditor.getCurrentAddSet().add( %objId ); + %this.onObjectCreated( %objId ); +} + +function GuiEditCanvas::onObjectCreated( %this, %objId ) +{ + // Can we submit an undo action? + if ( isObject( %objId ) ) + GuiEditor.onAddNewCtrl( %objId ); + + GuiEditorTreeView.clearSelection(); + GuiEditor.select(%objId); +} + $GUI_EDITOR_MENU_EDGESNAP_INDEX = 0; $GUI_EDITOR_MENU_CENTERSNAP_INDEX = 1; $GUI_EDITOR_MENU_GUIDESNAP_INDEX = 3; diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript index ba75ee7a0..23c51ebdc 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript @@ -20,6 +20,8 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//command variable feilds. do not trip them by unsetting or resetting these +$undoIgnoreList = "docsURL EditPosOffset Bake EditPostEffects selectAll sync Prototype"; //--------------------------------------------------------------------------------------------- @@ -126,6 +128,8 @@ function UndoActionAddDelete::trashObjects(%this) if( isObject( %this.tree ) ) %this.tree.update(); + + GuiEditor.clearSelection(); } function UndoActionAddDelete::restoreObjects(%this) @@ -451,6 +455,15 @@ function GenericUndoAction::undo(%this) for(%j = 0; %j < getWordCount(%fieldNames); %j++) { %field = getWord(%fieldNames, %j); + %skip = false; + for(%k = 0; %k < getWordCount($undoIgnoreList); %k++) + { + if(%field $= getWord(%fieldNames, %k)) //specialty field, we can't 'undo' it + %skip = true; + } + if (%skip) + continue; + %object.setFieldValue(%field, %this.fieldValues[%object, %field]); } // null out the fields in the null list @@ -469,7 +482,6 @@ function GenericUndoAction::undo(%this) function GenericUndoAction::redo(%this) { - // set the objects to the new values // set the objects to the new values // scan through our objects %objectList = %this.objectIdList; @@ -481,6 +493,15 @@ function GenericUndoAction::redo(%this) for(%j = 0; %j < getWordCount(%fieldNames); %j++) { %field = getWord(%fieldNames, %j); + %skip = false; + for(%k = 0; %k < getWordCount($undoIgnoreList); %k++) + { + if(%field $= getWord(%fieldNames, %k)) //specialty field, we can't 'redo' it + %skip = true; + } + if (%skip) + continue; + %object.setFieldValue(%field, %this.newFieldValues[%object, %field]); } // null out the fields in the null list diff --git a/Templates/BaseGame/game/tools/levels/DefaultEditorLevel.asset.taml b/Templates/BaseGame/game/tools/levels/DefaultEditorLevel.asset.taml index 5fdb84bfc..9b3fe43b3 100644 --- a/Templates/BaseGame/game/tools/levels/DefaultEditorLevel.asset.taml +++ b/Templates/BaseGame/game/tools/levels/DefaultEditorLevel.asset.taml @@ -1,10 +1,7 @@ + VersionId="1"/> diff --git a/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui b/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui index 39c431697..6f7640ea1 100644 --- a/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui +++ b/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui @@ -2619,7 +2619,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { hovertime = "1000"; new GuiContainer(){ // enable/disable - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -2652,7 +2652,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; new GuiContainer(){ // scale - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -2735,7 +2735,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; new GuiContainer(){ // direction - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -2817,7 +2817,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; }; new GuiContainer(){ // strength - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -2899,7 +2899,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; }; new GuiContainer(){ // coverage - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -2981,7 +2981,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; }; new GuiContainer(){ // specular - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 24"; @@ -3063,7 +3063,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { }; }; new GuiContainer(){ // empty space - profile="GuiTransparentProfile"; + profile="ToolsGuiTransparentProfile"; isContainer = "1"; position = "0 0"; Extent = "300 10"; diff --git a/Templates/BaseGame/game/tools/materialEditor/main.tscript b/Templates/BaseGame/game/tools/materialEditor/main.tscript index 7f50b9329..9ff894266 100644 --- a/Templates/BaseGame/game/tools/materialEditor/main.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/main.tscript @@ -46,10 +46,10 @@ function initializeMaterialEditor() matEd_addCubemapWindow.setVisible( false ); MaterialEditorPropertiesWindow.setVisible( false ); - EditorGui.add( MaterialEditorPreviewWindow ); - EditorGui.add( matEd_cubemapEditor ); - EditorGui.add( matEd_addCubemapWindow ); - EditorGui.add( MaterialEditorPropertiesWindow ); + MainSceneTabPanel.add( MaterialEditorPreviewWindow ); + MainSceneTabPanel.add( matEd_cubemapEditor ); + MainSceneTabPanel.add( matEd_addCubemapWindow ); + MainSceneTabPanel.add( MaterialEditorPropertiesWindow ); } function destroyMaterialEditor() diff --git a/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript b/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript index 1ff15ebde..4a17c29e7 100644 --- a/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript +++ b/Templates/BaseGame/game/tools/meshRoadEditor/main.tscript @@ -33,9 +33,9 @@ function initializeMeshRoadEditor() MeshRoadEditorOptionsWindow.setVisible( false ); MeshRoadEditorTreeWindow.setVisible( false ); - EditorGui.add( MeshRoadEditorGui ); - EditorGui.add( MeshRoadEditorOptionsWindow ); - EditorGui.add( MeshRoadEditorTreeWindow ); + MainSceneTabPanel.add( MeshRoadEditorGui ); + MainSceneTabPanel.add( MeshRoadEditorOptionsWindow ); + MainSceneTabPanel.add( MeshRoadEditorTreeWindow ); new ScriptObject( MeshRoadEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/missionAreaEditor/main.tscript b/Templates/BaseGame/game/tools/missionAreaEditor/main.tscript index bb69b4b35..1877f425c 100644 --- a/Templates/BaseGame/game/tools/missionAreaEditor/main.tscript +++ b/Templates/BaseGame/game/tools/missionAreaEditor/main.tscript @@ -33,9 +33,9 @@ function initializeMissionAreaEditor() MissionAreaEditorTerrainWindow.setVisible( false ); MissionAreaEditorPropertiesWindow.setVisible( false ); - EditorGui.add( MissionAreaEditorGui ); - EditorGui.add( MissionAreaEditorTerrainWindow ); - EditorGui.add( MissionAreaEditorPropertiesWindow ); + MainSceneTabPanel.add( MissionAreaEditorGui ); + MainSceneTabPanel.add( MissionAreaEditorTerrainWindow ); + MainSceneTabPanel.add( MissionAreaEditorPropertiesWindow ); new ScriptObject( MissionAreaEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/navEditor/NavEditorGui.gui b/Templates/BaseGame/game/tools/navEditor/NavEditorGui.gui index cb0b0f098..a512eb327 100644 --- a/Templates/BaseGame/game/tools/navEditor/NavEditorGui.gui +++ b/Templates/BaseGame/game/tools/navEditor/NavEditorGui.gui @@ -549,7 +549,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) { canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "GuiTransparentProfile"; + Profile = "ToolsGuiTransparentProfile"; HorizSizing = "width"; VertSizing = "height"; Position = "1 1"; diff --git a/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui b/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui index 9aafcd0b9..6cc6cbb71 100644 --- a/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui +++ b/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui @@ -14,7 +14,7 @@ $guiContent = new GuiTabPageCtrl(ENavEditorSettingsPage) { minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiSolidDefaultProfile"; + profile = "ToolsGuiSolidDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/navEditor/main.tscript b/Templates/BaseGame/game/tools/navEditor/main.tscript index 28303a576..73b97d58d 100644 --- a/Templates/BaseGame/game/tools/navEditor/main.tscript +++ b/Templates/BaseGame/game/tools/navEditor/main.tscript @@ -46,10 +46,10 @@ function initializeNavEditor() NavEditorTreeWindow.setVisible(false); NavEditorConsoleDlg.setVisible(false); - EditorGui.add(NavEditorGui); - EditorGui.add(NavEditorOptionsWindow); - EditorGui.add(NavEditorTreeWindow); - EditorGui.add(NavEditorConsoleDlg); + MainSceneTabPanel.add(NavEditorGui); + MainSceneTabPanel.add(NavEditorOptionsWindow); + MainSceneTabPanel.add(NavEditorTreeWindow); + MainSceneTabPanel.add(NavEditorConsoleDlg); new ScriptObject(NavEditorPlugin) { diff --git a/Templates/BaseGame/game/tools/particleEditor/main.tscript b/Templates/BaseGame/game/tools/particleEditor/main.tscript index f09f2f747..a0c350060 100644 --- a/Templates/BaseGame/game/tools/particleEditor/main.tscript +++ b/Templates/BaseGame/game/tools/particleEditor/main.tscript @@ -36,7 +36,7 @@ function initializeParticleEditor() exec( "./particleParticleEditor.ed." @ $TorqueScriptFileExtension ); PE_Window.setVisible( false ); - EditorGui.add( PE_Window ); + MainSceneTabPanel.add( PE_Window ); new ScriptObject( ParticleEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/particleEditor/particleEditor.ed.tscript b/Templates/BaseGame/game/tools/particleEditor/particleEditor.ed.tscript index eb9cb23bc..99a9024fd 100644 --- a/Templates/BaseGame/game/tools/particleEditor/particleEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/particleEditor/particleEditor.ed.tscript @@ -222,6 +222,13 @@ function ParticleEditor::resetEmitterNode( %this ) ParticleEditor.updateEmitterNode(); } + if (EWorldEditor.getSelectionSize()>0) + { + %obj = EWorldEditor.getSelectedObject(0); + if (%obj.isMemberOfClass("ParticleEmitterNode")) + $ParticleEditor::emitterNode.sethidden(true); + } + } //--------------------------------------------------------------------------------------------- diff --git a/Templates/BaseGame/game/tools/riverEditor/main.tscript b/Templates/BaseGame/game/tools/riverEditor/main.tscript index 3911b048c..a6d59e8ea 100644 --- a/Templates/BaseGame/game/tools/riverEditor/main.tscript +++ b/Templates/BaseGame/game/tools/riverEditor/main.tscript @@ -34,9 +34,9 @@ function initializeRiverEditor() RiverEditorOptionsWindow.setVisible( false ); RiverEditorTreeWindow.setVisible( false ); - EditorGui.add( RiverEditorGui ); - EditorGui.add( RiverEditorOptionsWindow ); - EditorGui.add( RiverEditorTreeWindow ); + MainSceneTabPanel.add( RiverEditorGui ); + MainSceneTabPanel.add( RiverEditorOptionsWindow ); + MainSceneTabPanel.add( RiverEditorTreeWindow ); new ScriptObject( RiverEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/roadEditor/main.tscript b/Templates/BaseGame/game/tools/roadEditor/main.tscript index 2583ab305..38cfc9252 100644 --- a/Templates/BaseGame/game/tools/roadEditor/main.tscript +++ b/Templates/BaseGame/game/tools/roadEditor/main.tscript @@ -34,9 +34,9 @@ function initializeRoadEditor() RoadEditorOptionsWindow.setVisible( false ); RoadEditorTreeWindow.setVisible( false ); - EditorGui.add( RoadEditorGui ); - EditorGui.add( RoadEditorOptionsWindow ); - EditorGui.add( RoadEditorTreeWindow ); + MainSceneTabPanel.add( RoadEditorGui ); + MainSceneTabPanel.add( RoadEditorOptionsWindow ); + MainSceneTabPanel.add( RoadEditorTreeWindow ); new ScriptObject( RoadEditorPlugin ) { diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index efec48b49..4960ec633 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -41,7 +41,7 @@ Edit Asset 0 1047 2200 360 + name="LastPosExt">0 976 2200 360 1 tools/RPGDialogEditor/gui 1024 768 + name="previewResolution">1280 720 ../../../Documentation/Torque 3D - Script Manual.chm http://www.garagegames.com/products/torque-3d/documentation/user - - - Categorized + name="documentationURL">https://docs.torque3d.org @@ -410,9 +405,9 @@ ../../../Documentation/Torque 3D - Script Manual.chm http://www.garagegames.com/products/torque-3d/documentation/user + name="documentationURL">https://docs.torque3d.org http://www.garagegames.com/products/torque-3d/forums + name="forumURL">https://torque3d.org/ diff --git a/Templates/BaseGame/game/tools/shapeEditor/main.tscript b/Templates/BaseGame/game/tools/shapeEditor/main.tscript index ad64611cb..35969608d 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/main.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/main.tscript @@ -48,12 +48,12 @@ function initializeShapeEditor() ShapeEdSelectWindow.setVisible(false); ShapeEdPropWindow.setVisible(false); - EditorGui.add(ShapeEdPreviewGui); - EditorGui.add(ShapeEdAnimWindow); - EditorGui.add(ShapeEdAdvancedWindow); + MainSceneTabPanel.add(ShapeEdPreviewGui); + MainSceneTabPanel.add(ShapeEdAnimWindow); + MainSceneTabPanel.add(ShapeEdAdvancedWindow); - EditorGui.add(ShapeEdSelectWindow); - EditorGui.add(ShapeEdPropWindow); + MainSceneTabPanel.add(ShapeEdSelectWindow); + MainSceneTabPanel.add(ShapeEdPropWindow); new ScriptObject(ShapeEditorPlugin) { @@ -186,7 +186,7 @@ function ShapeEditorPlugin::open(%this, %shapeAsset) ShapeEdPropWindow.setVisible(true); ShapeEdAnimWindow.setVisible(true); ShapeEdAdvancedWindow.setVisible(ShapeEditorToolbar-->showAdvanced.getValue()); - EditorGui.bringToFront(ShapeEdPreviewGui); + MainSceneTabPanel.bringToFront(ShapeEdPreviewGui); ToolsPaletteArray->WorldEditorMove.performClick(); %this.map.push(); diff --git a/Templates/BaseGame/game/tools/tools.tscript b/Templates/BaseGame/game/tools/tools.tscript index c9e0e01f5..47101f55a 100644 --- a/Templates/BaseGame/game/tools/tools.tscript +++ b/Templates/BaseGame/game/tools/tools.tscript @@ -16,7 +16,7 @@ function ToolsModule::onCreate(%this) // to find exactly which subsystems should be readied before kicking things off. // ---------------------------------------------------------------------------- - //ModuleDatabase.LoadExplicit( "MainEditor" ); + ModuleDatabase.LoadExplicit( "EditorCore" ); //ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui index 4f5891b93..4c8feacfa 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui @@ -19,363 +19,963 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) { AnchorLeft = "1"; AnchorRight = "0"; - new GuiContainer(EditorGuiToolbar) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsMenubarProfile"; - HorizSizing = "width"; - VertSizing = "bottom"; - Position = "0 6"; - Extent = "800 37"; - MinExtent = "8 8"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - - new GuiBitmapButtonCtrl(EHLogo) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "center"; - Position = "8 0"; - Extent = "24 24"; - MinExtent = "24 24"; - canSave = "1"; - Visible = "1"; - Command = ""; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Torque3D"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:menu_logo"; - groupNum = "0"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - - new GuiStackControl(EditorGuiToolbarStack) { - stackingType = "Horizontal"; - horizStacking = "Left to Right"; - vertStacking = "Top to Bottom"; - padding = "0"; - dynamicSize = "1"; - dynamicNonStackExtent = "0"; - dynamicPos = "0"; - changeChildSizeToFit = "0"; - changeChildPosition = "1"; - position = "36 4"; - extent = "885 36"; - minExtent = "16 16"; - horizSizing = "right"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; + new GuiTabBookCtrl(EditorGuiMainTabBook) { + tabHeight = "20"; + selectedPage = "0"; + position = "0 5"; + extent = "800 595"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiTabBookProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiTabPageCtrl(MainSceneEditorTab) { + text = "Main Scene"; + position = 0 SPC 20; + extent = 800 SPC 580; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiTabPageProfile"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "9 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl(WorldSaveBtn) { + new GuiContainer(MainSceneTabPanel) { + HorizSizing = "width"; + VertSizing = "height"; + Position = "0 0"; + Extent = "800 580"; + + new WorldEditor(EWorldEditor) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "WorldEditorProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Position = "0 0"; + Extent = "800 580"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Docking = "None"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "0"; + AnchorBottom = "0"; + AnchorLeft = "0"; + AnchorRight = "0"; + cameraZRot = "0"; + forceFOV = "0"; + renderMissionArea = "0"; + missionAreaFillColor = "255 0 0 20"; + missionAreaFrameColor = "255 0 0 128"; + allowBorderMove = "0"; + borderMovePixelSize = "20"; + borderMoveSpeed = "0.1"; + consoleFrameColor = "255 0 0 255"; + consoleFillColor = "0 0 0 0"; + consoleSphereLevel = "1"; + consoleCircleSegments = "32"; + consoleLineWidth = "1"; + GizmoProfile = "GlobalGizmoProfile"; + isDirty = "0"; + stickToGround = "0"; + dropAtBounds = "1"; + dropBelowCameraOffset = "15"; + dropType = "screenCenter"; + boundingBoxCollision = "1"; + renderPopupBackground = "1"; + popupBackgroundColor = "100 100 100 255"; + popupTextColor = "255 255 0 255"; + objectTextColor = "255 255 255 255"; + objectsUseBoxCenter = "1"; + objSelectColor = "255 0 0 255"; + objMouseOverSelectColor = "0 0 255 255"; + objMouseOverColor = "0 255 0 255"; + showMousePopupInfo = "1"; + dragRectColor = "255 255 0 255"; + renderObjText = "1"; + renderObjHandle = "1"; + objTextFormat = "$name|class$"; + faceSelectColor = "0 0 100 100"; + renderSelectionBox = "1"; + selectionBoxColor = "255 255 0 255"; + selectionLocked = "0"; + toggleIgnoreList = "0"; + selectHandle = "ToolsModule:SelectHandle_image"; + defaultHandle = "ToolsModule:DefaultHandle_image"; + lockedHandleAsset = "ToolsModule:LockedHandle_image"; + }; + new TerrainEditor(ETerrainEditor) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "WorldEditorProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Position = "0 0"; + Extent = "800 580"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "0"; + hovertime = "1000"; + Docking = "None"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "0"; + AnchorBottom = "0"; + AnchorLeft = "0"; + AnchorRight = "0"; + cameraZRot = "0"; + forceFOV = "0"; + renderMissionArea = "0"; + missionAreaFillColor = "0 0 0 20";//"255 0 0 20"; + missionAreaFrameColor = "0 0 0 128";//"255 0 0 128"; + allowBorderMove = "0"; + borderMovePixelSize = "20"; + borderMoveSpeed = "0.1"; + consoleFrameColor = "0 0 0 255"; + consoleFillColor = "0 0 0 0"; + consoleSphereLevel = "1"; + consoleCircleSegments = "32"; + consoleLineWidth = "1"; + GizmoProfile = "GlobalGizmoProfile"; + isDirty = "0"; + isMissionDirty = "0"; + renderBorder = "1"; + borderHeight = "10"; + borderFillColor = "0 255 0 20"; + borderFrameColor = "0 255 0 128"; + borderLineMode = "0"; + selectionHidden = "1"; + renderVertexSelection = "1"; + processUsesBrush = "0"; + maxBrushSize = "256 256"; + adjustHeightVal = "10"; + setHeightVal = "100"; + scaleVal = "1"; + smoothFactor = "0.1"; + materialGroup = "0"; + softSelectRadius = "50"; + softSelectFilter = "1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000"; + softSelectDefaultFilter = "1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000"; + adjustHeightMouseScale = "0.1"; + paintIndex = "-1"; + + new GuiTextCtrl(TESelectionInfo) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "EditorTextProfile"; + HorizSizing = "right"; + VertSizing = "top"; + Position = "288 549"; + Extent = "120 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = " (Selection) #: 0 avg: 0"; + maxLength = "255"; + }; + new GuiTextCtrl(TEMouseBrushInfo) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "EditorTextProfile"; + HorizSizing = "right"; + VertSizing = "top"; + Position = "40 549"; + Extent = "107 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = " (Mouse) #: 0 avg: 0"; + maxLength = "255"; + }; + new GuiTextCtrl(TESelectionInfo1) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "EditorTextProfileWhite"; + HorizSizing = "right"; + VertSizing = "top"; + Position = "289 550"; + Extent = "120 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = " (Selection) #: 0 avg: 0"; + maxLength = "255"; + }; + new GuiTextCtrl(TEMouseBrushInfo1) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "EditorTextProfileWhite"; + HorizSizing = "right"; + VertSizing = "top"; + Position = "41 550"; + Extent = "107 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = " (Mouse) #: 0 avg: 0"; + maxLength = "255"; + }; + }; + }; + + new GuiContainer(EditorGuiToolbar) { canSaveDynamicFields = "0"; Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; + isContainer = "1"; + Profile = "ToolsMenubarProfile"; + HorizSizing = "width"; VertSizing = "bottom"; - Position = "4 3"; - Extent = "29 27"; + Position = "0 0"; + Extent = "800 37"; MinExtent = "8 8"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; canSave = "1"; Visible = "1"; - Command = "EditorSaveMissionMenu();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Save the Level"; hovertime = "1000"; - bitmapAsset = "ToolsModule:save_n_image"; - groupNum = "0"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "2 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl(EHWorldEditor) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "4 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = ""; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Open the WorldEditor"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:world_n_image"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - - new GuiBitmapButtonCtrl(EHGuiEditor) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "34 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "toggleGuiEditor(true); $GuiEditorBtnPressed = true;"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Open the GuiEditor"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:gui_n_image"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 0"; - Extent = "9 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl(AssetBrowserBtn) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "0 0"; - Extent = "29 27"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - active = "1"; - Command = "AssetBrowser.toggleDialog();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - tooltip = "Open the Asset Browser"; - hovertime = "750"; - bitmapAsset = "ToolsModule:assetBrowser_n_image"; - buttonType = "PushButton"; - useStates = "1"; - groupNum = "0"; - useMouseEvents = "0"; - internalName = "AssetBrowserBtn"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "9 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "2 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "0 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "Editor.close(ProjectSettings.value(\"UI/playGUIName\"));"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Play Game"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:playbutton_n_image"; - groupNum = "0"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "9 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl() { - BitmapAsset = "ToolsModule:settings_n_image"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "574 0"; - extent = "29 27"; - minExtent = "8 8"; - horizSizing = "right"; - VertSizing = "bottom"; - profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; - command = "ESettingsWindow.toggleEditorSettings();"; - tooltipProfile = "ToolsGuiToolTipProfile"; - tooltip = "Open Editor Settings"; - hovertime = "1000"; - isContainer = "0"; - internalName = "editorSettingsBtn"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - - new GuiBitmapButtonCtrl(windowConsoleBtn) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "0 0"; - Extent = "29 27"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - active = "1"; - Command = "windowConsoleDlg.showWindow();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - tooltip = "Open the Console in a window"; - hovertime = "750"; - bitmapAsset = "ToolsModule:console_n_image"; - buttonType = "PushButton"; - useStates = "1"; - groupNum = "0"; - useMouseEvents = "0"; - internalName = "windowConsoleBtn"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "0 3"; - Extent = "9 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_xt_h_image"; - horizSizing = "right"; - vertSizing = "bottom"; - }; - - new GuiBitmapButtonCtrl(EWorldEditorToggleCamera) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "102 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Toggle Camera Modes"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:player_n_image"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - + + new GuiBitmapButtonCtrl(EHLogo) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "center"; + Position = "8 0"; + Extent = "24 24"; + MinExtent = "24 24"; + canSave = "1"; + Visible = "1"; + Command = ""; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Torque3D"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:menu_logo"; + groupNum = "0"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + + new GuiStackControl(EditorGuiToolbarStack) { + stackingType = "Horizontal"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "36 4"; + extent = "885 36"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "9 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl(WorldSaveBtn) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "4 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "EditorSaveMissionMenu();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Save the Level"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:save_n_image"; + groupNum = "0"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl(EHWorldEditor) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "4 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = ""; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Open the WorldEditor"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:world_n_image"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + + new GuiBitmapButtonCtrl(EHGuiEditor) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "34 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "toggleGuiEditor(true); $GuiEditorBtnPressed = true;"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Open the GuiEditor"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:gui_n_image"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 0"; + Extent = "9 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl(AssetBrowserBtn) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "0 0"; + Extent = "29 27"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + active = "1"; + Command = "AssetBrowser.toggleDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + tooltip = "Open the Asset Browser"; + hovertime = "750"; + bitmapAsset = "ToolsModule:assetBrowser_n_image"; + buttonType = "PushButton"; + useStates = "1"; + groupNum = "0"; + useMouseEvents = "0"; + internalName = "AssetBrowserBtn"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "9 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "Editor.close(ProjectSettings.value(\"UI/playGUIName\"));"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Play Game"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:playbutton_n_image"; + groupNum = "0"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "9 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl() { + BitmapAsset = "ToolsModule:settings_n_image"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "574 0"; + extent = "29 27"; + minExtent = "8 8"; + horizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ESettingsWindow.toggleEditorSettings();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + tooltip = "Open Editor Settings"; + hovertime = "1000"; + isContainer = "0"; + internalName = "editorSettingsBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiBitmapButtonCtrl(windowConsoleBtn) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "0 0"; + Extent = "29 27"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + active = "1"; + Command = "windowConsoleDlg.showWindow();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + tooltip = "Open the Console in a window"; + hovertime = "750"; + bitmapAsset = "ToolsModule:console_n_image"; + buttonType = "PushButton"; + useStates = "1"; + groupNum = "0"; + useMouseEvents = "0"; + internalName = "windowConsoleBtn"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "0 3"; + Extent = "9 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_xt_h_image"; + horizSizing = "right"; + vertSizing = "bottom"; + }; + + new GuiBitmapButtonCtrl(EWorldEditorToggleCamera) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "102 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Toggle Camera Modes"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:player_n_image"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + + new GuiBitmapCtrl() { + HorizSizing = "left"; + VertSizing = "top"; + Position = getWord(EWorldEditorToggleCamera.extent, 0)-6 SPC getWord(EWorldEditorToggleCamera.extent, 1)-6; + Extent = "4 4"; + MinExtent = "4 4"; + bitmapAsset = "ToolsModule:dropdown_button_arrow_image"; + }; + }; + + new GuiControl(CameraSpeedDropdownContainer, EditorGuiGroup) { + canSaveDynamicFields = "0"; + isContainer = "1"; + Profile = "ToolsGuiTransparentProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "136 5"; + Extent = "136 27"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + + new GuiTextCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiTextRightProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "0 6"; + Extent = "72 10"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = "Cam Speed: "; + maxLength = "1024"; + }; + + new GuiTextEditCtrl(EWorldEditorCameraSpeed) { + canSaveDynamicFields = "0"; + internalName = "textEdit"; + isContainer = "0"; + profile="ToolsGuiNumericDropSliderTextProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "78 2"; + Extent = "42 16"; + MinExtent = "8 16"; + canSave = "1"; + Visible = "1"; + Command = "EWorldEditorCameraSpeed.updateMenuBar( $ThisControl );"; + hovertime = "1000"; + text = "100"; + maxLength = "4"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + + new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "112 2"; + Extent = "18 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "Canvas.pushDialog(CameraSpeedDropdownCtrlContainer);"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Changes the Camera Speed"; + hovertime = "750"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + bitmapAsset = "ToolsModule:dropslider_n_image"; + }; + }; + + /*new GuiPopUpMenuCtrl(EWorldEditorCameraSpeed) { + canSaveDynamicFields = "0"; + internalName = "CameraSpeedDropdown"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "136 7"; + Extent = "130 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + maxLength = "1024"; + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + };*/ + + new GuiBitmapButtonCtrl(visibilityToggleBtn) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "270 3"; + Extent = "29 27"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "VisibilityDropdownToggle();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Toggle Visibility Modes (ALT V)"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:visibility_toggle_n_image"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + + new GuiBitmapCtrl(){ + HorizSizing = "left"; + VertSizing = "top"; + Position = getWord(visibilityToggleBtn.extent, 0)-6 SPC getWord(visibilityToggleBtn.extent, 1)-6; + Extent = "4 4"; + MinExtent = "4 4"; + bitmapAsset = "ToolsModule:dropdown_button_arrow_image"; + }; + }; + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + position = "303 3"; + Extent = "2 26"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + VertSizing = "bottom"; + }; + + new GuiPopUpMenuCtrl(EWorldEditorAlignPopup) { + canSaveDynamicFields = "0"; + internalName = ""; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "439 2"; + Extent = "70 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "0"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + maxLength = "1024"; + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + }; + }; + }; + new GuiContainer(EditorGuiStatusBar) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsMenubarProfile"; + HorizSizing = "width"; + VertSizing = "top"; + Position = "0 578"; + Extent = "800 35"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Docking = "Bottom"; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "14 7"; + Extent = "20 20"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:mission_file_image"; + }; + + new GuiMLTextCtrl(EWorldEditorStatusBarInfo) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiMLTextProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = "40 10"; + Extent = "450 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = "Current Tool"; + maxLength = "255"; + allowColorChars = "1"; + + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; HorizSizing = "left"; - VertSizing = "top"; - Position = getWord(EWorldEditorToggleCamera.extent, 0)-6 SPC getWord(EWorldEditorToggleCamera.extent, 1)-6; - Extent = "4 4"; - MinExtent = "4 4"; - bitmapAsset = "ToolsModule:dropdown_button_arrow_image"; + VertSizing = "bottom"; + position = "465 8"; + Extent = "2 18"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + }; + + new GuiTextCtrl(EWorldEditorStatusBarSelection) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiTextProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + Position = "485 8"; + Extent = "180 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = "Ready."; + maxLength = "255"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = "645 8"; + Extent = "2 18"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; + }; + + new GuiPopUpMenuCtrl(EWorldEditorStatusBarCamera) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + Position = "665 8"; + Extent = "120 18"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + }; + + new GuiBitmapCtrl() { + Enabled = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + position = "800 2"; + Extent = "2 18"; + MinExtent = "1 1"; + bitmapAsset = "ToolsModule:separator_h_image"; }; }; - new GuiControl(CameraSpeedDropdownContainer, EditorGuiGroup) { + new GuiControl(RelightStatus) { canSaveDynamicFields = "0"; + Enabled = "1"; isContainer = "1"; - Profile = "ToolsGuiTransparentProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "136 5"; - Extent = "136 27"; + Profile = "ToolsGuiSolidDefaultProfile"; + HorizSizing = "center"; + VertSizing = "center"; + Position = "223 277"; + Extent = "353 45"; MinExtent = "8 2"; canSave = "1"; - Visible = "1"; + Visible = "0"; + hovertime = "1000"; + + + new GuiProgressBitmapCtrl(RelightProgress) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiRLProgressBitmapProfile"; + HorizSizing = "center"; + VertSizing = "center"; + position = "5 0"; + Extent = "440 24"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + maxLength = "1024"; + + }; + new GuiTextCtrl(RelightProgressTxt) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiProgressTextProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "5 20"; + Extent = "440 20"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + text = "Loading Mission"; + maxLength = "255"; + }; + }; + new GuiControl(RelightMessage) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiSolidDefaultProfile"; + HorizSizing = "width"; + VertSizing = "top"; + Position = "19 570"; + Extent = "583 23"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "0"; hovertime = "1000"; new GuiTextCtrl() { canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "0"; - Profile = "ToolsGuiTextRightProfile"; - HorizSizing = "right"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "width"; VertSizing = "bottom"; - position = "0 6"; - Extent = "72 10"; + Position = "5 1"; + Extent = "449 18"; MinExtent = "8 2"; canSave = "1"; Visible = "1"; @@ -386,957 +986,74 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) { AnchorBottom = "0"; AnchorLeft = "1"; AnchorRight = "0"; - text = "Cam Speed: "; - maxLength = "1024"; + text = "A lightmapped object has been altered; relight the scene!"; + maxLength = "255"; }; - - new GuiTextEditCtrl(EWorldEditorCameraSpeed) { - canSaveDynamicFields = "0"; - internalName = "textEdit"; - isContainer = "0"; - profile="ToolsGuiNumericDropSliderTextProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "78 2"; - Extent = "42 16"; - MinExtent = "8 16"; - canSave = "1"; - Visible = "1"; - Command = "EWorldEditorCameraSpeed.updateMenuBar( $ThisControl );"; - hovertime = "1000"; - text = "100"; - maxLength = "4"; - historySize = "0"; - password = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - }; - - new GuiBitmapButtonCtrl() { + new GuiButtonCtrl() { canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "0"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "right"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "left"; VertSizing = "bottom"; - Position = "112 2"; - Extent = "18 18"; + Position = "468 2"; + Extent = "75 18"; MinExtent = "8 2"; canSave = "1"; Visible = "1"; - Command = "Canvas.pushDialog(CameraSpeedDropdownCtrlContainer);"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Changes the Camera Speed"; - hovertime = "750"; + Command = "Editor.lightScene(\"\", forceAlways); RelightMessage.visible = false;"; + hovertime = "1000"; + text = "Relight Scene"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + new GuiButtonCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + Position = "548 2"; + Extent = "32 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "RelightMessage.visible = false;"; + hovertime = "1000"; + text = "Hide"; groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - bitmapAsset = "ToolsModule:dropslider_n_image"; }; }; - - /*new GuiPopUpMenuCtrl(EWorldEditorCameraSpeed) { + new GuiControl(PhysicsEditMessage) { canSaveDynamicFields = "0"; - internalName = "CameraSpeedDropdown"; Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiPopUpMenuProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "136 7"; - Extent = "130 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - maxLength = "1024"; - maxPopupHeight = "200"; - sbUsesNAColor = "0"; - reverseTextList = "0"; - bitmapBounds = "16 16"; - };*/ - - new GuiBitmapButtonCtrl(visibilityToggleBtn) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "270 3"; - Extent = "29 27"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "VisibilityDropdownToggle();"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Toggle Visibility Modes (ALT V)"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:visibility_toggle_n_image"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - - new GuiBitmapCtrl(){ - HorizSizing = "left"; + isContainer = "1"; + Profile = "ToolsGuiSolidDefaultProfile"; + HorizSizing = "center"; VertSizing = "top"; - Position = getWord(visibilityToggleBtn.extent, 0)-6 SPC getWord(visibilityToggleBtn.extent, 1)-6; - Extent = "4 4"; - MinExtent = "4 4"; - bitmapAsset = "ToolsModule:dropdown_button_arrow_image"; - }; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - position = "303 3"; - Extent = "2 26"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_h_image"; - VertSizing = "bottom"; - }; - - new GuiPopUpMenuCtrl(EWorldEditorAlignPopup) { - canSaveDynamicFields = "0"; - internalName = ""; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiPopUpMenuProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "439 2"; - Extent = "70 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - maxLength = "1024"; - maxPopupHeight = "200"; - sbUsesNAColor = "0"; - reverseTextList = "0"; - bitmapBounds = "16 16"; - }; - }; - }; - - new GuiContainer(EditorGuiStatusBar) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsMenubarProfile"; - HorizSizing = "width"; - VertSizing = "top"; - Position = "0 578"; - Extent = "800 35"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Docking = "Bottom"; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "14 7"; - Extent = "20 20"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:mission_file_image"; - }; - - new GuiMLTextCtrl(EWorldEditorStatusBarInfo) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiMLTextProfile"; - HorizSizing = "width"; - VertSizing = "bottom"; - Position = "40 10"; - Extent = "450 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = "Current Tool"; - maxLength = "255"; - allowColorChars = "1"; - - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - position = "465 8"; - Extent = "2 18"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_h_image"; - }; - - new GuiTextCtrl(EWorldEditorStatusBarSelection) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiTextProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "485 8"; - Extent = "180 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = "Ready."; - maxLength = "255"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - position = "645 8"; - Extent = "2 18"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_h_image"; - }; - - new GuiPopUpMenuCtrl(EWorldEditorStatusBarCamera) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiPopUpMenuProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "665 8"; - Extent = "120 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - }; - - new GuiBitmapCtrl() { - Enabled = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - position = "800 2"; - Extent = "2 18"; - MinExtent = "1 1"; - bitmapAsset = "ToolsModule:separator_h_image"; - }; - }; - - new WorldEditor(EWorldEditor) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "WorldEditorProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Position = "0 0"; - Extent = "800 600"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Docking = "None"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "0"; - AnchorBottom = "0"; - AnchorLeft = "0"; - AnchorRight = "0"; - cameraZRot = "0"; - forceFOV = "0"; - renderMissionArea = "0"; - missionAreaFillColor = "255 0 0 20"; - missionAreaFrameColor = "255 0 0 128"; - allowBorderMove = "0"; - borderMovePixelSize = "20"; - borderMoveSpeed = "0.1"; - consoleFrameColor = "255 0 0 255"; - consoleFillColor = "0 0 0 0"; - consoleSphereLevel = "1"; - consoleCircleSegments = "32"; - consoleLineWidth = "1"; - GizmoProfile = "GlobalGizmoProfile"; - isDirty = "0"; - stickToGround = "0"; - dropAtBounds = "1"; - dropBelowCameraOffset = "15"; - dropType = "screenCenter"; - boundingBoxCollision = "1"; - renderPopupBackground = "1"; - popupBackgroundColor = "100 100 100 255"; - popupTextColor = "255 255 0 255"; - objectTextColor = "255 255 255 255"; - objectsUseBoxCenter = "1"; - objSelectColor = "255 0 0 255"; - objMouseOverSelectColor = "0 0 255 255"; - objMouseOverColor = "0 255 0 255"; - showMousePopupInfo = "1"; - dragRectColor = "255 255 0 255"; - renderObjText = "1"; - renderObjHandle = "1"; - objTextFormat = "$name|class$"; - faceSelectColor = "0 0 100 100"; - renderSelectionBox = "1"; - selectionBoxColor = "255 255 0 255"; - selectionLocked = "0"; - toggleIgnoreList = "0"; - selectHandle = "ToolsModule:SelectHandle_image"; - defaultHandle = "ToolsModule:DefaultHandle_image"; - lockedHandleAsset = "ToolsModule:LockedHandle_image"; - }; - new TerrainEditor(ETerrainEditor) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "WorldEditorProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Position = "0 0"; - Extent = "800 600"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - Docking = "None"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "0"; - AnchorBottom = "0"; - AnchorLeft = "0"; - AnchorRight = "0"; - cameraZRot = "0"; - forceFOV = "0"; - renderMissionArea = "0"; - missionAreaFillColor = "0 0 0 20";//"255 0 0 20"; - missionAreaFrameColor = "0 0 0 128";//"255 0 0 128"; - allowBorderMove = "0"; - borderMovePixelSize = "20"; - borderMoveSpeed = "0.1"; - consoleFrameColor = "0 0 0 255"; - consoleFillColor = "0 0 0 0"; - consoleSphereLevel = "1"; - consoleCircleSegments = "32"; - consoleLineWidth = "1"; - GizmoProfile = "GlobalGizmoProfile"; - isDirty = "0"; - isMissionDirty = "0"; - renderBorder = "1"; - borderHeight = "10"; - borderFillColor = "0 255 0 20"; - borderFrameColor = "0 255 0 128"; - borderLineMode = "0"; - selectionHidden = "1"; - renderVertexSelection = "1"; - processUsesBrush = "0"; - maxBrushSize = "256 256"; - adjustHeightVal = "10"; - setHeightVal = "100"; - scaleVal = "1"; - smoothFactor = "0.1"; - materialGroup = "0"; - softSelectRadius = "50"; - softSelectFilter = "1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000"; - softSelectDefaultFilter = "1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000"; - adjustHeightMouseScale = "0.1"; - paintIndex = "-1"; - - new GuiTextCtrl(TESelectionInfo) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "EditorTextProfile"; - HorizSizing = "right"; - VertSizing = "top"; - Position = "288 549"; - Extent = "120 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = " (Selection) #: 0 avg: 0"; - maxLength = "255"; - }; - new GuiTextCtrl(TEMouseBrushInfo) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "EditorTextProfile"; - HorizSizing = "right"; - VertSizing = "top"; - Position = "40 549"; - Extent = "107 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = " (Mouse) #: 0 avg: 0"; - maxLength = "255"; - }; - new GuiTextCtrl(TESelectionInfo1) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "EditorTextProfileWhite"; - HorizSizing = "right"; - VertSizing = "top"; - Position = "289 550"; - Extent = "120 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = " (Selection) #: 0 avg: 0"; - maxLength = "255"; - }; - new GuiTextCtrl(TEMouseBrushInfo1) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "EditorTextProfileWhite"; - HorizSizing = "right"; - VertSizing = "top"; - Position = "41 550"; - Extent = "107 18"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = " (Mouse) #: 0 avg: 0"; - maxLength = "255"; - }; - }; - - new GuiControl(RelightStatus) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiSolidDefaultProfile"; - HorizSizing = "center"; - VertSizing = "center"; - Position = "223 277"; - Extent = "353 45"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - - - new GuiProgressBitmapCtrl(RelightProgress) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiRLProgressBitmapProfile"; - HorizSizing = "center"; - VertSizing = "center"; - position = "5 0"; - Extent = "440 24"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - maxLength = "1024"; - - }; - new GuiTextCtrl(RelightProgressTxt) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiProgressTextProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "5 20"; - Extent = "440 20"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = "Loading Mission"; - maxLength = "255"; - }; - }; - new GuiControl(RelightMessage) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiSolidDefaultProfile"; - HorizSizing = "width"; - VertSizing = "top"; - Position = "19 570"; - Extent = "583 23"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - - new GuiTextCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "width"; - VertSizing = "bottom"; - Position = "5 1"; - Extent = "449 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = "A lightmapped object has been altered; relight the scene!"; - maxLength = "255"; - }; - new GuiButtonCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "468 2"; - Extent = "75 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "Editor.lightScene(\"\", forceAlways); RelightMessage.visible = false;"; - hovertime = "1000"; - text = "Relight Scene"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiButtonCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "548 2"; - Extent = "32 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "RelightMessage.visible = false;"; - hovertime = "1000"; - text = "Hide"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - }; - new GuiControl(PhysicsEditMessage) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiSolidDefaultProfile"; - HorizSizing = "center"; - VertSizing = "top"; - Position = "180 560"; - Extent = "440 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - - new GuiTextCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "EditorTextProfile"; - HorizSizing = "width"; - VertSizing = "center"; - Position = "5 0"; - Extent = "238 18"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - text = "PHYSICS SIMULATION PAUSED FOR EDITING..."; - maxLength = "255"; - }; - new GuiButtonCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "337 3"; - Extent = "43 26"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "physicsStart(); PhysicsEditMessage.visible = false;"; - hovertime = "1000"; - text = "Start"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiButtonCtrl() { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "left"; - VertSizing = "bottom"; - Position = "392 3"; - Extent = "43 26"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "PhysicsEditMessage.visible = false;"; - hovertime = "1000"; - text = "Hide"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - }; - new GuiContainer(CameraTypesDropdown){ - Profile = "IconDropdownProfile"; - Position = getWord(EWorldEditorToggleCamera.position, 0)-5 SPC getWord(EditorGuiToolbar.extent, 1)-1; - Extent = "137" SPC ((6*28)+6);//97"; - isContainer = "1"; - visible = "0"; - - new GuiDynamicCtrlArrayControl(cameraDropdownArray) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiSolidDefaultProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Position = "5 5"; - Extent = "132" SPC getWord(CameraTypesDropdown.extent, 1)-5; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - colCount = "1"; - colSize = "127"; - rowCount = "0"; - RowSize = "64"; - rowSpacing = "3"; - colSpacing = "3"; - autoCellSize = "1"; - fillRowFirst = "0"; - - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "StandardCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 5"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Standard Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Free Camera"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:camera_n_image"; - groupNum = "0"; - text="Free Camera"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "OrbitCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 32"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Orbit Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Toggle Orbit Cam"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:orbit_cam_n_image"; - groupNum = "0"; - text="Orbit Camera"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "PlayerCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 5"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"1st Person Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Player Camera"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:player_n_image"; - groupNum = "0"; - text="Player Camera"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "trdPersonCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 5"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"3rd Person Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "3rd Person Camera"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:3rd_person_camera_n_image"; - groupNum = "0"; - text="3rd Person Cam"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "NewtonianCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 64"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Smooth Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Toggle Newtonian Cam"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:smooth_cam_n_image"; - groupNum = "0"; - text="Smooth Camera"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - new GuiIconButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = "NewtonianRotationCamera"; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiIconButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - Position = "5 64"; - Extent = "127 25"; - MinExtent = "8 8"; - canSave = "1"; - Visible = "1"; - Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = "Toggle Smooth Camera with Smooth Rotation"; - hovertime = "1000"; - bitmapAsset = "ToolsModule:smooth_cam_rot_n_image"; - groupNum = "0"; - text="Smooth Rotate"; - buttonMargin = "0 4"; - textMargin = "38"; - groupNum = "0"; - buttonType = "RadioButton"; - useMouseEvents = "0"; - }; - }; - - new GuiDecoyCtrl(CameraTypesDropdownDecoy) { - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = getWord(CameraTypesDropdown.extent, 0) SPC getWord(CameraTypesDropdown.extent, 1); - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; - useMouseEvents = "1"; - isDecoy = "1"; - }; - - }; - new GuiContainer(VisibilityDropdown){ - Profile = "IconDropdownProfile"; - Position = getWord(visibilityToggleBtn.position, 0)-5 SPC getWord(EditorGuiToolbar.extent, 1)-1; - Extent = "159 261"; //SPC ((6*28)+6);//97"; - isContainer = "1"; - visible = "0"; - - new GuiTabBookCtrl() { - canSaveDynamicFields = "0"; - Profile = "ToolsGuiTabBookProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Docking = "Client"; - Margin = "3 3 3 3"; - Position = "5 24"; - Extent = "170 226"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - TabPosition = "Top"; - TabHeight = "22"; - TabMargin = "7"; - MinTabWidth = "64"; - - new GuiTabPageCtrl() { - canSaveDynamicFields = "0"; - Profile = "ToolsGuiTabPageProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Docking = "Client"; - Margin = "-1 0 0 0"; - Position = "0 14"; - Extent = "164 220"; + Position = "180 560"; + Extent = "440 32"; MinExtent = "8 2"; canSave = "1"; Visible = "0"; hovertime = "1000"; - text = "Viz Toggles"; - maxLength = "255"; - - new GuiScrollCtrl() { + + new GuiTextCtrl() { canSaveDynamicFields = "0"; Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiScrollProfile"; + isContainer = "0"; + Profile = "EditorTextProfile"; HorizSizing = "width"; - VertSizing = "height"; - Docking = "Client"; - Position = "4 12"; - Extent = "156 190"; + VertSizing = "center"; + Position = "5 0"; + Extent = "238 18"; MinExtent = "8 2"; canSave = "1"; - isDecoy = "0"; Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; hovertime = "1000"; Margin = "0 0 0 0"; Padding = "0 0 0 0"; @@ -1344,194 +1061,501 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) { AnchorBottom = "0"; AnchorLeft = "1"; AnchorRight = "0"; - willFirstRespond = "1"; - hScrollBar = "alwaysOff"; - vScrollBar = "dynamic"; - lockHorizScroll = "true"; - lockVertScroll = "false"; - constantThumbHeight = "0"; - childMargin = "2 0"; - - new GuiStackControl() { - StackingType = "Vertical"; - HorizStacking = "Left to Right"; - VertStacking = "Top to Bottom"; - Padding = "-2"; - canSaveDynamicFields = "0"; - internalName = "theVisOptionsList"; - Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "width"; - VertSizing = "bottom"; - Position = "1 0"; - Extent = "156 16"; - MinExtent = "16 16"; - canSave = "1"; - isDecoy = "0"; - Visible = "1"; - tooltipprofile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - }; + text = "PHYSICS SIMULATION PAUSED FOR EDITING..."; + maxLength = "255"; }; - }; - new GuiTabPageCtrl() { - canSaveDynamicFields = "0"; - Profile = "ToolsGuiTabPageProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Docking = "Client"; - Margin = "-1 0 0 0"; - Position = "0 14"; - Extent = "164 220"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "0"; - hovertime = "1000"; - text = "Class Toggles"; - maxLength = "255"; - - new GuiScrollCtrl() { + new GuiButtonCtrl() { canSaveDynamicFields = "0"; Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiScrollProfile"; - HorizSizing = "width"; - VertSizing = "height"; - Docking = "Client"; - Position = "4 12"; - Extent = "156 190"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + Position = "337 3"; + Extent = "43 26"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "physicsStart(); PhysicsEditMessage.visible = false;"; + hovertime = "1000"; + text = "Start"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + new GuiButtonCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "left"; + VertSizing = "bottom"; + Position = "392 3"; + Extent = "43 26"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "PhysicsEditMessage.visible = false;"; + hovertime = "1000"; + text = "Hide"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + }; + }; + new GuiContainer(CameraTypesDropdown){ + Profile = "IconDropdownProfile"; + Position = getWord(EWorldEditorToggleCamera.position, 0)-5 SPC getWord(EditorGuiToolbar.extent, 1)-1; + Extent = "137" SPC ((6*28)+6);//97"; + isContainer = "1"; + visible = "0"; + + new GuiDynamicCtrlArrayControl(cameraDropdownArray) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiSolidDefaultProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Position = "5 5"; + Extent = "132" SPC getWord(CameraTypesDropdown.extent, 1)-5; MinExtent = "8 2"; canSave = "1"; - isDecoy = "0"; Visible = "1"; tooltipprofile = "ToolsGuiToolTipProfile"; hovertime = "1000"; - Margin = "0 0 0 0"; - Padding = "0 0 0 0"; - AnchorTop = "1"; - AnchorBottom = "0"; - AnchorLeft = "1"; - AnchorRight = "0"; - willFirstRespond = "1"; - hScrollBar = "alwaysOff"; - vScrollBar = "dynamic"; - lockHorizScroll = "true"; - lockVertScroll = "false"; - constantThumbHeight = "0"; - childMargin = "2 0"; - - new GuiStackControl() { - StackingType = "Vertical"; - HorizStacking = "Left to Right"; - VertStacking = "Top to Bottom"; - Padding = "-2"; + colCount = "1"; + colSize = "127"; + rowCount = "0"; + RowSize = "64"; + rowSpacing = "3"; + colSpacing = "3"; + autoCellSize = "1"; + fillRowFirst = "0"; + + new GuiIconButtonCtrl() { canSaveDynamicFields = "0"; - internalName = "theClassVisList"; + internalName = "StandardCamera"; Enabled = "1"; - isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "width"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; VertSizing = "bottom"; - Position = "1 0"; - Extent = "156 16"; - MinExtent = "16 16"; + Position = "5 5"; + Extent = "127 25"; + MinExtent = "8 8"; canSave = "1"; - isDecoy = "0"; Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Standard Camera\");"; tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Free Camera"; hovertime = "1000"; + bitmapAsset = "ToolsModule:camera_n_image"; + groupNum = "0"; + text="Free Camera"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + new GuiIconButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = "OrbitCamera"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "5 32"; + Extent = "127 25"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Orbit Camera\");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Toggle Orbit Cam"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:orbit_cam_n_image"; + groupNum = "0"; + text="Orbit Camera"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + + new GuiIconButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = "PlayerCamera"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "5 5"; + Extent = "127 25"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"1st Person Camera\");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Player Camera"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:player_n_image"; + groupNum = "0"; + text="Player Camera"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + new GuiIconButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = "trdPersonCamera"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "5 5"; + Extent = "127 25"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"3rd Person Camera\");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "3rd Person Camera"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:3rd_person_camera_n_image"; + groupNum = "0"; + text="3rd Person Cam"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + new GuiIconButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = "NewtonianCamera"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "5 64"; + Extent = "127 25"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Smooth Camera\");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Toggle Newtonian Cam"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:smooth_cam_n_image"; + groupNum = "0"; + text="Smooth Camera"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + new GuiIconButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = "NewtonianRotationCamera"; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiIconButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "5 64"; + Extent = "127 25"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + Command = "CameraTypesDropdownToggle(); EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Toggle Smooth Camera with Smooth Rotation"; + hovertime = "1000"; + bitmapAsset = "ToolsModule:smooth_cam_rot_n_image"; + groupNum = "0"; + text="Smooth Rotate"; + buttonMargin = "0 4"; + textMargin = "38"; + groupNum = "0"; + buttonType = "RadioButton"; + useMouseEvents = "0"; + }; + }; + + new GuiDecoyCtrl(CameraTypesDropdownDecoy) { + profile = "ToolsGuiDefaultProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 0"; + extent = getWord(CameraTypesDropdown.extent, 0) SPC getWord(CameraTypesDropdown.extent, 1); + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + useMouseEvents = "1"; + isDecoy = "1"; + }; + + }; + new GuiContainer(VisibilityDropdown){ + Profile = "IconDropdownProfile"; + Position = getWord(visibilityToggleBtn.position, 0)-5 SPC getWord(EditorGuiToolbar.extent, 1)-1; + Extent = "159 261"; //SPC ((6*28)+6);//97"; + isContainer = "1"; + visible = "0"; + + new GuiTabBookCtrl() { + canSaveDynamicFields = "0"; + Profile = "ToolsGuiTabBookProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Docking = "Client"; + Margin = "3 3 3 3"; + Position = "5 24"; + Extent = "170 226"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + TabPosition = "Top"; + TabHeight = "22"; + TabMargin = "7"; + MinTabWidth = "64"; + + new GuiTabPageCtrl() { + canSaveDynamicFields = "0"; + Profile = "ToolsGuiTabPageProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Docking = "Client"; + Margin = "-1 0 0 0"; + Position = "0 14"; + Extent = "164 220"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "0"; + hovertime = "1000"; + text = "Viz Toggles"; + maxLength = "255"; + + new GuiScrollCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiScrollProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Docking = "Client"; + Position = "4 12"; + Extent = "156 190"; + MinExtent = "8 2"; + canSave = "1"; + isDecoy = "0"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "true"; + lockVertScroll = "false"; + constantThumbHeight = "0"; + childMargin = "2 0"; + + new GuiStackControl() { + StackingType = "Vertical"; + HorizStacking = "Left to Right"; + VertStacking = "Top to Bottom"; + Padding = "-2"; + canSaveDynamicFields = "0"; + internalName = "theVisOptionsList"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = "1 0"; + Extent = "156 16"; + MinExtent = "16 16"; + canSave = "1"; + isDecoy = "0"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + }; + }; + }; + new GuiTabPageCtrl() { + canSaveDynamicFields = "0"; + Profile = "ToolsGuiTabPageProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Docking = "Client"; + Margin = "-1 0 0 0"; + Position = "0 14"; + Extent = "164 220"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "0"; + hovertime = "1000"; + text = "Class Toggles"; + maxLength = "255"; + + new GuiScrollCtrl() { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiScrollProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Docking = "Client"; + Position = "4 12"; + Extent = "156 190"; + MinExtent = "8 2"; + canSave = "1"; + isDecoy = "0"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "true"; + lockVertScroll = "false"; + constantThumbHeight = "0"; + childMargin = "2 0"; + + new GuiStackControl() { + StackingType = "Vertical"; + HorizStacking = "Left to Right"; + VertStacking = "Top to Bottom"; + Padding = "-2"; + canSaveDynamicFields = "0"; + internalName = "theClassVisList"; + Enabled = "1"; + isContainer = "1"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "width"; + VertSizing = "bottom"; + Position = "1 0"; + Extent = "156 16"; + MinExtent = "16 16"; + canSave = "1"; + isDecoy = "0"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + }; + }; }; }; }; - }; - }; -}; - - - - -new GuiMouseEventCtrl(CameraSpeedDropdownCtrlContainer, EditorGuiGroup) { - internalName = "AggregateControl"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = "1024 768"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; - class = "EditorDropdownSliderContainer"; - - new GuiContainer(){ - position = firstWord(CameraSpeedDropdownContainer.position) + firstWord(EditorGuiToolbar.position) + -6 SPC - (getWord(CameraSpeedDropdownContainer, 1)) + 31; - extent = "146 39"; - isContainer = "1"; - Profile = "IconDropdownProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - new GuiBitmapCtrl(){ // Fast - position = "105 15"; - extent = "2 8"; - bitmapAsset = "ToolsModule:separator_h_image"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - }; - new GuiBitmapCtrl(){ // normal - position = "73 15"; - extent = "2 8"; - bitmapAsset = "ToolsModule:separator_h_image"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - }; - new GuiBitmapCtrl(){ // slow - position = "41 15"; - extent = "2 8"; - bitmapAsset = "ToolsModule:separator_h_image"; - Profile = "ToolsGuiDefaultProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - }; - - new GuiSliderCtrl(){ //camera speed slider - internalName = "slider"; - position = "9 17"; - extent = "129 15"; - bitmap = "tools/gui/images/separator-h.png"; - HorizSizing = "width"; - VertSizing = "bottom"; - range = "1 200"; - ticks = "0"; - value = "100"; - AltCommand = "EWorldEditorCameraSpeed.updateMenuBar( $ThisControl );"; + new GuiMouseEventCtrl(CameraSpeedDropdownCtrlContainer, EditorGuiGroup) { + internalName = "AggregateControl"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 60"; + extent = "1024 768"; + minExtent = "8 8"; + visible = "0"; + helpTag = "0"; + class = "EditorDropdownSliderContainer"; + + new GuiContainer(){ + position = firstWord(CameraSpeedDropdownContainer.position) + firstWord(EditorGuiToolbar.position) + -6 SPC + (getWord(CameraSpeedDropdownContainer, 1)) + 31; + extent = "146 39"; + isContainer = "1"; + Profile = "IconDropdownProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + + new GuiBitmapCtrl(){ // Fast + position = "105 15"; + extent = "2 8"; + bitmapAsset = "ToolsModule:separator_h_image"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + new GuiBitmapCtrl(){ // normal + position = "73 15"; + extent = "2 8"; + bitmapAsset = "ToolsModule:separator_h_image"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + new GuiBitmapCtrl(){ // slow + position = "41 15"; + extent = "2 8"; + bitmapAsset = "ToolsModule:separator_h_image"; + Profile = "ToolsGuiDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + + new GuiSliderCtrl(){ //camera speed slider + internalName = "slider"; + position = "9 17"; + extent = "129 15"; + bitmap = "tools/gui/images/separator-h.png"; + HorizSizing = "width"; + VertSizing = "bottom"; + range = "1 200"; + ticks = "0"; + value = "100"; + AltCommand = "EWorldEditorCameraSpeed.updateMenuBar( $ThisControl );"; + }; + new GuiTextCtrl(){ // Normal + internalName = "text"; + position = "54 3"; + extent = "39 18"; + text = "Normal"; + Profile = "ToolsGuiTextCenterProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + new GuiTextCtrl(){ // - + position = "11 2"; + extent = "39 18"; + text = "-"; + Profile = "ToolsGuiTextProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + new GuiTextCtrl(){ // + + position = "98 5"; + extent = "39 13"; + text = "+"; + Profile = "ToolsGuiTextRightProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + }; + }; }; - new GuiTextCtrl(){ // Normal - internalName = "text"; - position = "54 3"; - extent = "39 18"; - text = "Normal"; - Profile = "ToolsGuiTextCenterProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - }; - new GuiTextCtrl(){ // - - position = "11 2"; - extent = "39 18"; - text = "-"; - Profile = "ToolsGuiTextProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - }; - new GuiTextCtrl(){ // + - position = "98 5"; - extent = "39 13"; - text = "+"; - Profile = "ToolsGuiTextRightProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; }; }; }; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui index 14e419edf..4b8acbbcf 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui @@ -7,7 +7,7 @@ $guiContent = new GuiContainer(EWToolsToolbar) { Profile = "ToolsMenubarProfile"; HorizSizing = "right"; VertSizing = "bottom"; - Position = "0 41"; + Position = "0 38"; Extent = "0 33"; MinExtent = "8 2"; canSave = "1"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui index 51692048c..735b9b070 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui @@ -131,7 +131,7 @@ $guiContent = new GuiControl() { HorizSizing = "width"; VertSizing = "height"; Position = "5 29"; - Extent = "300 271"; + Extent = "290 240"; MinExtent = "8 8"; canSave = "1"; Visible = "1"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui index 4a6f94ddb..94d8510e4 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui @@ -135,7 +135,7 @@ function ObjectBuilderGui::reset(%this) %this.createFunction = ""; %this.createCallback = ""; %this.currentControl = 0; - + // OBObjectName.setValue(%this.defaultObjectName); @@ -969,6 +969,10 @@ function ObjectBuilderGui::processNewObject(%this, %obj) if ( !isObject( %obj ) ) return; + %controlMask = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType; + if (%obj.control) + localClientConnection.setControlobject(%obj); + // Add the object to the group. if( %this.objectGroup !$= "" ) %this.objectGroup.add( %obj ); @@ -1079,6 +1083,14 @@ function ObjectBuilderGui::buildObject(%this, %className) %this.process(); } +function ObjectBuilderGui::buildGameBaseObject(%this, %className) +{ + %this.objectClassName = %className; + //assumes we fgollow the pattern of class is instance, classData is datablock + %this.addField("dataBlock", "TypeDataBlock", "Data block", %className @"Data"); + + %this.process(); +} //------------------------------------------------------------------------------ // Environment //------------------------------------------------------------------------------ @@ -1451,6 +1463,45 @@ function ObjectBuilderGui::buildPlayerDropPoint(%this) %this.process(); } +function ObjectBuilderGui::buildPlayer(%this) +{ + %this.objectClassName = "Player"; + %this.addField("dataBlock", "TypeDataBlock", "dataBlock", "PlayerData"); + %this.addField("control", "TypeBool", "control?", "false"); + %this.process(); +} + +function ObjectBuilderGui::buildAIPlayer(%this) +{ + %this.objectClassName = "AIPlayer"; + %this.addField("dataBlock", "TypeDataBlock", "dataBlock", "PlayerData"); + %this.process(); +} + +function ObjectBuilderGui::buildWheeledVehicle(%this) +{ + %this.objectClassName = "WheeledVehicle"; + %this.addField("dataBlock", "TypeDataBlock", "dataBlock", "WheeledVehicleData"); + %this.addField("control", "TypeBool", "control?", "false"); + %this.process(); +} + +function ObjectBuilderGui::buildHoverVehicle(%this) +{ + %this.objectClassName = "HoverVehicle"; + %this.addField("dataBlock", "TypeDataBlock", "dataBlock", "HoverVehicleData"); + %this.addField("control", "TypeBool", "control?", "false"); + %this.process(); +} + +function ObjectBuilderGui::buildFlyingVehicle(%this) +{ + %this.objectClassName = "FlyingVehicle"; + %this.addField("dataBlock", "TypeDataBlock", "dataBlock", "FlyingVehicleData"); + %this.addField("control", "TypeBool", "control?", "false"); + %this.process(); +} + function ObjectBuilderGui::buildObserverDropPoint(%this) { %this.objectClassName = "SpawnSphere"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui b/Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui index 997d05417..0a1f7d7b4 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/shadowViz.gui @@ -7,7 +7,7 @@ $guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) { canSaveDynamicFields = "0"; isContainer = "1"; - Profile = "GuiModelessDialogProfile"; + Profile = "ToolsGuiModelessDialogProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "0 0"; diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h.png b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h.png new file mode 100644 index 000000000..6a02d7d42 Binary files /dev/null and b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h.png differ diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h_image.asset.taml b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h_image.asset.taml new file mode 100644 index 000000000..7a643ed81 --- /dev/null +++ b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_h_image.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n.png b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n.png new file mode 100644 index 000000000..6fefd102b Binary files /dev/null and b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n.png differ diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n_image.asset.taml b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n_image.asset.taml new file mode 100644 index 000000000..dc5c3ebb4 --- /dev/null +++ b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/pausebutton_n_image.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h.png b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h.png new file mode 100644 index 000000000..bcb3b3f89 Binary files /dev/null and b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h.png differ diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h_image.asset.taml b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h_image.asset.taml new file mode 100644 index 000000000..82f4dfbd3 --- /dev/null +++ b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_h_image.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n.png b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n.png new file mode 100644 index 000000000..c45cd993c Binary files /dev/null and b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n.png differ diff --git a/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n_image.asset.taml b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n_image.asset.taml new file mode 100644 index 000000000..11eed81f7 --- /dev/null +++ b/Templates/BaseGame/game/tools/worldEditor/images/toolbar/stopbutton_n_image.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript index afe0e3991..8a33a55da 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript @@ -43,7 +43,7 @@ function EditorGui::init(%this) if( isObject( EWToolsPaletteWindow ) ) { - %this.add( EWToolsPaletteWindow ); + MainSceneTabPanel.add( EWToolsPaletteWindow ); EWToolsPaletteWindow.init(); EWToolsPaletteWindow.setVisible( false ); } @@ -124,7 +124,7 @@ function EditorGui::init(%this) exec("~/worldEditor/gui/ToolsToolbar.ed.gui"); if( isObject( EWToolsToolbar ) ) { - %this.add( EWToolsToolbar ); + MainSceneTabPanel.add( EWToolsToolbar ); EWToolsToolbar.setVisible( true ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript index c0beb15f7..6cfdb0350 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.tscript @@ -286,10 +286,7 @@ function doEditorResetDefaultLevel() function EditorSaveMissionMenu() { - if(EditorGui.saveAs) - AssetBrowser.setupCreateNewAsset("LevelAsset", AssetBrowser.selectedModule, "EditorSaveMissionAs"); - else - EditorSaveMission(); + EditorSaveMission(); } function EditorSaveMission() @@ -387,6 +384,8 @@ function EditorSaveMission() function EditorSaveMissionAs( %levelAsset ) { + EditorGui.saveAs = true; + AssetBrowser.setupCreateNewAsset("LevelAsset", AssetBrowser.selectedModule,""); // If we didn't get passed a new mission name then // prompt the user for one. if ( %levelAsset $= "" ) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.tscript index ea9b26918..5b21e0630 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.tscript @@ -142,7 +142,7 @@ function EditorGui::buildMenus(%this) %fileMenu.appendItem("Open Recent" TAB RecentLevelsPopupMenu); %fileMenu.appendItem("-"); %fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();"); - %fileMenu.appendItem("Save Level As..." TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule, \"EditorSaveMissionAs\");"); + %fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();"); %fileMenu.appendItem("-"); %fileMenu.appendItem("Save Current Scene as Editor Default" TAB "" TAB "EditorSaveAsDefaultLevel();"); %fileMenu.appendItem("Reset Editor Default" TAB "" TAB "EditorResetDefaultLevel();"); @@ -364,19 +364,18 @@ function EditorGui::buildMenus(%this) %this.menuBar.insert(%toolsMenu); // Help Menu - %helpMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorHelpMenu"; - - barTitle = "Help"; - - item[0] = "Online Documentation..." TAB "Alt F1" TAB "gotoWebPage(EWorldEditor.documentationURL);"; - item[1] = "Offline User Guide..." TAB "" TAB "gotoWebPage(EWorldEditor.documentationLocal);"; - item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; - item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; - }; - %this.menuBar.insert(%helpMenu); + %helpMenu = MenuBuilder::newMenu("Help", "EditorHelpMenu"); + %helpMenu.newItem("Online Documentation...", "gotoWebPage(EWorldEditor.documentationURL);", "Alt F1"); + %helpMenu.newItem("Offline User Guide...", "gotoWebPage(EWorldEditor.documentationLocal);"); + %helpMenu.newItem("Offline Reference Guide...", "shellexecute(EWorldEditor.documentationReference);"); + %helpMenu.newItem("Torque 3D Forums...", "gotoWebPage(EWorldEditor.forumURL);"); + + //These files don't currently exist, so we're going to disable them until such a time + //as they exist again + %helpMenu.enableItem(1, false); + %helpMenu.enableItem(2, false); + + MenuBuilder::addMenuToMenubar(%this.menubar, %helpMenu); // Menus that are added/removed dynamically (temporary) @@ -466,6 +465,66 @@ function EditorGui::buildMenus(%this) Item[24] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; }; } + + %addMenu = MenuBuilder::newMenu("Add"); + + %enumeratedClasses = enumerateConsoleClasses("SceneObject"); + for(%c=0; %c < getFieldCount(%enumeratedClasses); %c++) + { + %class = getField(%enumeratedClasses, %c); + //SceneObject itself is not directly spawnable + if (%class $= "SceneObject") + continue; + + %category = getCategoryOfClass(%class); + + if(%category $= "") + { + error("Attempted to fetch category of class " @ %class @ " but none were found."); + continue; + } + //skip classes explicitly tagged not for listing (typically due to being unspawnable) + if(%category $= "UNLISTED") + continue; + + if(%category $= "MISC") + warn("unsorted class: "@ %class); + + %parentMenu = %addMenu; //start at the top + for(%cat=0; %cat < getFieldCount(%category); %cat++) + { + %subCat = getField(%category, %cat); + %targetSubmenu = %parentMenu.findMenu(%subCat); + if(!isObject(%targetSubmenu)) + { + %targetSubmenu = %parentMenu.newSubmenu(%subCat); + } + + %parentMenu = %targetSubmenu; + } + + %buildfunc = ""; + %class = %class; + %method = "build" @ %buildfunc; + if( !ObjectBuilderGui.isMethod( %method ) ) + %method = "build" @ %class; + + if( !ObjectBuilderGui.isMethod( %method ) ) + { + if (isMemberOfClass(%class,"gameBase")) + %cmd = "ObjectBuilderGui.buildGameBaseObject("@ %class @");"; + else + %cmd = "return new " @ %class @ "();"; + } + else + %cmd = "ObjectBuilderGui." @ %method @ "();"; + + %createCmd = "ObjectBuilderGui.newObjectCallback = \"ObjectCreator.onFinishCreateObject\"; ObjectCreator.createObject( \"" @ %cmd @ "\" );"; + + %targetSubmenu.newItem(%class, %createCmd, ""); + } + + MenuBuilder::addMenuToMenubar(%this.menubar, %addMenu, 4); } ////////////////////////////////////////////////////////////////////////// diff --git a/Tools/CMake/Info.plist.in b/Tools/CMake/Info.plist.in index 8c39d8f4f..cfe6d5943 100644 --- a/Tools/CMake/Info.plist.in +++ b/Tools/CMake/Info.plist.in @@ -17,6 +17,6 @@ CFBundleVersion 1.0 SDL_FILESYSTEM_BASE_DIR_TYPE - parent + $(SDL_FILE_DIR) diff --git a/Tools/CMake/torqueMacOSconfigs.cmake b/Tools/CMake/torqueMacOSconfigs.cmake index 99f918ea8..a0b3c42db 100644 --- a/Tools/CMake/torqueMacOSconfigs.cmake +++ b/Tools/CMake/torqueMacOSconfigs.cmake @@ -1,23 +1,163 @@ +if(APPLE) #detect Architecture -if (APPLE AND NOT IOS) - option(TORQUE_MACOS_UNIVERSAL_BINARY OFF) +enable_language(OBJC) +enable_language(OBJCXX) +enable_language(CXX) - # Detect architecture if not using universal - if (TORQUE_MACOS_UNIVERSAL_BINARY) - set(ARCHITECTURE_STRING_APPLE "x86_64;arm64") - set(DEPLOYMENT_TARGET_APPLE "10.13") - else() - if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") - set(ARCHITECTURE_STRING_APPLE "arm64") - set(DEPLOYMENT_TARGET_APPLE "11.0") - else() - set(ARCHITECTURE_STRING_APPLE "x86_64") - set(DEPLOYMENT_TARGET_APPLE "10.13") - endif() +find_program(XCODEBUILD_EXECUTABLE xcodebuild) +execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk macosx Path + OUTPUT_VARIABLE XCODE_SDK_ROOT_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(XCODE_SDK_ROOT_DIR "${XCODE_SDK_ROOT_DIR}" CACHE INTERNAL "") +# Specify the location or name of the platform SDK to be used in CMAKE_OSX_SYSROOT. +set(CMAKE_OSX_SYSROOT "${XCODE_SDK_ROOT_DIR}" CACHE INTERNAL "") + +if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT CMAKE_GENERATOR MATCHES "Xcode") + get_filename_component(PLATFORM_SDK_DIR ${XCODE_SDK_ROOT_DIR} PATH) + get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH) + if (NOT EXISTS "${CMAKE_DEVELOPER_ROOT}") + message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: ${CMAKE_DEVELOPER_ROOT} does not exist.") endif() +endif() - set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE_STRING_APPLE} CACHE STRING "OSX Architecture" FORCE) - set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET_APPLE} CACHE STRING "OSX Deployment target" FORCE) - mark_as_advanced(CMAKE_OSX_ARCHITECTURES) - mark_as_advanced(CMAKE_OSX_DEPLOYMENT_TARGET) -endif() \ No newline at end of file +# Find (Apple's) libtool. +if(DEFINED BUILD_LIBTOOL) + # Environment variables are always preserved. + set(ENV{_BUILD_LIBTOOL} "${BUILD_LIBTOOL}") +elseif(DEFINED ENV{_BUILD_LIBTOOL}) + set(BUILD_LIBTOOL "$ENV{_BUILD_LIBTOOL}") +elseif(NOT DEFINED BUILD_LIBTOOL) + execute_process(COMMAND xcrun -sdk ${XCODE_SDK_ROOT_DIR} -find libtool + OUTPUT_VARIABLE BUILD_LIBTOOL + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang ${languages}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o " CACHE INTERNAL "") +endforeach() + +set(CMAKE_FRAMEWORK_PATH "/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks") +set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/../Frameworks -rpath @loader_path/../Frameworks") +set(CMAKE_FIND_FRAMEWORK FIRST) +# minimum for multi arch build is 11. +set(CMAKE_OSX_DEPLOYMENT_TARGET "11" CACHE STRING "" FORCE) +set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" FORCE) +set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0" CACHE STRING "arm 64 minimum deployment target" FORCE) +set(CMAKE_XCODE_ATTRIBUTE_SDKROOT macosx) +set(CMAKE_SYSTEM_NAME Darwin) + +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_SHARED_MODULE_SUFFIX ".so") + +set(CMAKE_C_COMPILER_TARGET x86_64-arm64-apple-macosx11) +set(CMAKE_CXX_COMPILER_TARGET x86_64-arm64-apple-macosx11) +set(CMAKE_ASM_COMPILER_TARGET x86_64-arm64-apple-macosx11) + +set(CMAKE_C_COMPILER_ABI ELF) +set(CMAKE_CXX_COMPILER_ABI ELF) +set(CMAKE_C_HAS_ISYSROOT 1) +set(CMAKE_CXX_HAS_ISYSROOT 1) +set(CMAKE_MODULE_EXISTS 1) +set(CMAKE_DL_LIBS "") +set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") +set(CMAKE_MACOSX_BUNDLE YES) +set(OBJC_VARS "-fobjc-abi-version=2 -DOBJC_OLD_DISPATCH_PROTOTYPES=0") + +set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}") +set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}") +set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}") +set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}") +set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}") +set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}") +set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}") +set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}") +set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO}") +set(CMAKE_OBJCXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJCXX_FLAGS_RELEASE}") +set(CMAKE_OBJC_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJC_LINK_FLAGS}") +set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}") + +set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a") + +if(CMAKE_OSX_ARCHITECTURES MATCHES "((^|;|, )(arm64|arm64e|x86_64))+") + set(CMAKE_C_SIZEOF_DATA_PTR 8) + set(CMAKE_CXX_SIZEOF_DATA_PTR 8) + if(CMAKE_OSX_ARCHITECTURES MATCHES "((^|;|, )(arm64|arm64e))+") + set(CMAKE_SYSTEM_PROCESSOR "aarch64") + else() + set(CMAKE_SYSTEM_PROCESSOR "x86_64") + endif() +else() + set(CMAKE_C_SIZEOF_DATA_PTR 4) + set(CMAKE_CXX_SIZEOF_DATA_PTR 4) + set(CMAKE_SYSTEM_PROCESSOR "arm") +endif() + +if(DEFINED CMAKE_INSTALL_NAME_TOOL) + # Environment variables are always preserved. + set(ENV{_CMAKE_INSTALL_NAME_TOOL} "${CMAKE_INSTALL_NAME_TOOL}") +elseif(DEFINED ENV{_CMAKE_INSTALL_NAME_TOOL}) + set(CMAKE_INSTALL_NAME_TOOL "$ENV{_CMAKE_INSTALL_NAME_TOOL}") +elseif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + execute_process(COMMAND xcrun -sdk ${XCODE_SDK_ROOT_DIR} -find install_name_tool + OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE INTERNAL "") +endif() + +# Only create a single Xcode project file +set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE) +# Add all libraries to project link phase (lets Xcode handle linking) +set(CMAKE_XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION) +set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks") + +# Enable codesigning with secure timestamp when not in Debug configuration (required for Notarization) +set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS[variant=Release] "--timestamp") +set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS[variant=RelWithDebInfo] "--timestamp") + +# Enable codesigning with hardened runtime option when not in Debug configuration (required for Notarization) +#set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME[variant=Release] YES) +#set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME[variant=RelWithDebInfo] YES) + +# Disable injection of Xcode's base entitlements used for debugging when not in Debug configuration (required for +# Notarization) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=Release] NO) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=RelWithDebInfo] NO) + +set(_release_configs RelWithDebInfo Release) +if(CMAKE_BUILD_TYPE IN_LIST _release_configs) + add_link_options(LINKER:-dead_strip) +endif() + +set(CMAKE_THREAD_LIBS_INIT "-lpthread") +set(CMAKE_HAVE_THREADS_LIBRARY 1) +set(CMAKE_USE_WIN32_THREADS_INIT 0) +set(CMAKE_USE_PTHREADS_INIT 1) +set(THREADS_PREFER_PTHREAD_FLAG ON) + +set(CMAKE_MACOSX_RPATH 1) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +# Debug configuration for quicker debug builds +set(CMAKE_XCODE_ATTRIBUTE_LINKER_DISPLAYS_MANGLED_NAMES[variant=Debug] YES) +set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] YES) +set(CMAKE_XCODE_ATTRIBUTE_ENABLE_TESTABILITY[variant=Debug] YES) + +endif(APPLE) \ No newline at end of file diff --git a/Tools/CMake/torque_macros.cmake b/Tools/CMake/torque_macros.cmake index 5aee66f32..e98cb1f6c 100644 --- a/Tools/CMake/torque_macros.cmake +++ b/Tools/CMake/torque_macros.cmake @@ -128,6 +128,6 @@ endmacro (filterOut) ################# apple frameworks ################### macro(addFramework framework) if (APPLE) - set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} "-framework ${framework}") + set(TORQUE_LINK_FRAMEWORKS ${TORQUE_LINK_FRAMEWORKS} "${CMAKE_FRAMEWORK_PATH}/${framework}.framework") endif() endmacro() \ No newline at end of file