# Conflicts:
#	.github/workflows/pre-commit.yaml
#	indra/cmake/LLPhysicsExtensions.cmake
#	indra/llwindow/llopenglview-objc.mm
#	indra/newview/CMakeLists.txt
#	indra/newview/llappdelegate-objc.mm
master
Ansariel 2025-10-20 23:56:48 +02:00
commit 431b3b0c6d
32 changed files with 1282 additions and 612 deletions

View File

@ -1,6 +1,7 @@
# Replace tabs with spaces # Replace tabs with spaces
1b68f71348ecf3983b76b40d7940da8377f049b7 1b68f71348ecf3983b76b40d7940da8377f049b7
33418a77b716e122da9778869cdbabe97c83ff37 33418a77b716e122da9778869cdbabe97c83ff37
6b974724826a038b0db794460b322eb4921da735
# Trim trailing whitespace # Trim trailing whitespace
a0b3021bdcf76859054fda8e30abb3ed47749e83 a0b3021bdcf76859054fda8e30abb3ed47749e83
8444cd9562a6a7b755fcb075864e205122354192 8444cd9562a6a7b755fcb075864e205122354192

7
.github/dependabot.yaml vendored Normal file
View File

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

View File

@ -7,14 +7,14 @@ repos:
- id: no-trigraphs - id: no-trigraphs
- id: copyright - id: copyright
- id: end-of-file - id: end-of-file
files: \.(cpp|c|h|py|glsl|cmake|txt)$ files: \.(cpp|c|m|mm|h|py|glsl|cmake|txt)$
exclude: language.txt exclude: language.txt
- id: indent-with-spaces - id: indent-with-spaces
files: \.(cpp|c|h|inl|py|glsl|cmake)$ files: \.(cpp|c|m|mm|h|inl|py|glsl|cmake)$
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v6.0.0
hooks: hooks:
- id: check-xml - id: check-xml
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace - id: trailing-whitespace
files: \.(cpp|c|h|inl|py|glsl|cmake|yaml|sh)$ files: \.(cpp|c|m|mm|h|inl|py|glsl|cmake|yaml|sh)$

View File

@ -1674,36 +1674,6 @@
<key>name</key> <key>name</key>
<string>llphysicsextensions_source</string> <string>llphysicsextensions_source</string>
</map> </map>
<key>llphysicsextensions_stub</key>
<map>
<key>platforms</key>
<map>
<key>common</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>bc41438b10ac6474cf5560465a3662a64f9e65a81342e4c33f18f6694581c7ee28c9ee6f091c36e80a0b1e10c68205be71eb5f8e40fef115d2c744fc2bbfcb43</string>
<key>hash_algorithm</key>
<string>blake2b</string>
<key>url</key>
<string>https://github.com/AlchemyViewer/llphysicsextensions_stub/releases/download/v1.0-cb4900e/llphysicsextensions_stub-1.0-common-17836965684.tar.zst</string>
</map>
<key>name</key>
<string>common</string>
</map>
</map>
<key>license</key>
<string>internal</string>
<key>license_file</key>
<string>LICENSES/llphysicsextensions.txt</string>
<key>copyright</key>
<string>Copyright (c) 2010, Linden Research, Inc.</string>
<key>version</key>
<string>1.0</string>
<key>name</key>
<string>llphysicsextensions_stub</string>
</map>
<key>llphysicsextensions_tpv</key> <key>llphysicsextensions_tpv</key>
<map> <map>
<key>platforms</key> <key>platforms</key>

View File

@ -128,9 +128,6 @@ endif (USE_TRACY)
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio) add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
add_subdirectory(${LIBS_OPEN_PREFIX}llappearance) add_subdirectory(${LIBS_OPEN_PREFIX}llappearance)
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter) add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
if (NOT HAVOK AND NOT HAVOK_TPV)
add_subdirectory(${LIBS_OPEN_PREFIX}llconvexdecomposition)
endif ()
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon) add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
add_subdirectory(${LIBS_OPEN_PREFIX}llcorehttp) add_subdirectory(${LIBS_OPEN_PREFIX}llcorehttp)
add_subdirectory(${LIBS_OPEN_PREFIX}llimage) add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
@ -140,6 +137,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llinventory)
add_subdirectory(${LIBS_OPEN_PREFIX}llmath) add_subdirectory(${LIBS_OPEN_PREFIX}llmath)
add_subdirectory(${LIBS_OPEN_PREFIX}llmeshoptimizer) add_subdirectory(${LIBS_OPEN_PREFIX}llmeshoptimizer)
add_subdirectory(${LIBS_OPEN_PREFIX}llmessage) add_subdirectory(${LIBS_OPEN_PREFIX}llmessage)
add_subdirectory(${LIBS_OPEN_PREFIX}llphysicsextensionsos)
add_subdirectory(${LIBS_OPEN_PREFIX}llprimitive) add_subdirectory(${LIBS_OPEN_PREFIX}llprimitive)
add_subdirectory(${LIBS_OPEN_PREFIX}llrender) add_subdirectory(${LIBS_OPEN_PREFIX}llrender)
add_subdirectory(${LIBS_OPEN_PREFIX}llfilesystem) add_subdirectory(${LIBS_OPEN_PREFIX}llfilesystem)

View File

@ -22,7 +22,6 @@ if (HAVOK)
include(Havok) include(Havok)
use_prebuilt_binary(llphysicsextensions_source) use_prebuilt_binary(llphysicsextensions_source)
set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src) set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
if(DARWIN) if(DARWIN)
set(LLPHYSICSEXTENSIONS_STUB_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub) set(LLPHYSICSEXTENSIONS_STUB_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
# can't set these library dependencies per-arch here, need to do it using XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=*] in newview/CMakeLists.txt # can't set these library dependencies per-arch here, need to do it using XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=*] in newview/CMakeLists.txt
@ -30,28 +29,18 @@ if (HAVOK)
#target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub) #target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub)
else() else()
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions) target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions)
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
endif() endif()
target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
elseif (HAVOK_TPV) elseif (HAVOK_TPV)
use_prebuilt_binary(llphysicsextensions_tpv) use_prebuilt_binary(llphysicsextensions_tpv)
if(WINDOWS) if (NOT DARWIN)
target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib) if(WINDOWS)
else() target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib)
target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/libllphysicsextensions_tpv.a) elseif(LINUX)
target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/libllphysicsextensions_tpv.a)
endif()
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
endif() endif()
target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 ) target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
else (HAVOK) endif ()
use_prebuilt_binary(llphysicsextensions_stub)
set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub)
# <FS:Ansariel> Hotfix pathing lib header and add missing BOOL typedef
file(READ ${LIBS_PREBUILT_DIR}/include/llphysicsextensions/llpathinglib.h PATHINGLIB_HEADER_CONTENTS)
string(FIND "${PATHINGLIB_HEADER_CONTENTS}" "typedef int BOOL;" BOOL_TYPEDEF_POS)
if (${BOOL_TYPEDEF_POS} EQUAL -1)
string(REPLACE "typedef int bool32;" "typedef int bool32;\ntypedef int BOOL;" PATHINGLIB_HEADER_CONTENTS "${PATHINGLIB_HEADER_CONTENTS}")
file(WRITE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions/llpathinglib.h "${PATHINGLIB_HEADER_CONTENTS}")
endif()
# </FS:Ansariel>
endif (HAVOK)
target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)

View File

@ -283,6 +283,7 @@ bool LLPolyMeshSharedData::loadMesh( const std::string& fileName )
LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/
if (!fp) if (!fp)
{ {
LLError::LLUserWarningMsg::showMissingFiles();
LL_ERRS() << "can't open: " << fileName << LL_ENDL; LL_ERRS() << "can't open: " << fileName << LL_ENDL;
return false; return false;
} }

View File

@ -1,39 +0,0 @@
# -*- cmake -*-
project(llconvexdecomposition)
include(00-Common)
include(LLCommon)
include(LLMath)
include(VHACD)
set(llconvexdecomposition_SOURCE_FILES
llconvexdecomposition.cpp
llconvexdecompositionvhacd.cpp
)
set(llconvexdecomposition_HEADER_FILES
CMakeLists.txt
llconvexdecomposition.h
llconvexdecompositionvhacd.h
)
set_source_files_properties(${llconvexdecomposition_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND llconvexdecomposition_SOURCE_FILES ${llconvexdecomposition_HEADER_FILES})
add_library (llconvexdecomposition ${llconvexdecomposition_SOURCE_FILES})
target_include_directories(llconvexdecomposition INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(llconvexdecomposition
llcommon
llmath
ll::vhacd)
if(WINDOWS)
target_compile_options(llconvexdecomposition PRIVATE /bigobj)
endif()
# Add tests

View File

@ -1,28 +1,28 @@
/** /**
* @file lldir_utils_objc.mm * @file lldir_utils_objc.mm
* @brief Cocoa implementation of directory utilities for macOS * @brief Cocoa implementation of directory utilities for macOS
* *
* $LicenseInfo:firstyear=2020&license=viewerlgpl$ * $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc. * Copyright (C) 2020, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; * License as published by the Free Software Foundation;
* version 2.1 of the License only. * version 2.1 of the License only.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#if LL_DARWIN #if LL_DARWIN
//WARNING: This file CANNOT use standard linden includes due to conflicts between definitions of BOOL //WARNING: This file CANNOT use standard linden includes due to conflicts between definitions of BOOL
@ -39,18 +39,18 @@ std::string getSystemTempFolder()
tempDir = @"/tmp"; tempDir = @"/tmp";
result = std::string([tempDir UTF8String]); result = std::string([tempDir UTF8String]);
} }
return result; return result;
} }
//findSystemDirectory scoped exclusively to this file. //findSystemDirectory scoped exclusively to this file.
std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory, std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
NSSearchPathDomainMask domainMask) NSSearchPathDomainMask domainMask)
{ {
std::string result; std::string result;
@autoreleasepool { @autoreleasepool {
NSString *path = nil; NSString *path = nil;
// Search for the path // Search for the path
NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory, NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory,
domainMask, domainMask,
@ -60,10 +60,10 @@ std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
path = [paths objectAtIndex:0]; path = [paths objectAtIndex:0];
//HACK: Always attempt to create directory, ignore errors. //HACK: Always attempt to create directory, ignore errors.
NSError *error = nil; NSError *error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]; [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
result = std::string([path UTF8String]); result = std::string([path UTF8String]);
} }
} }
@ -88,7 +88,7 @@ std::string getSystemResourceFolder()
NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
result = std::string([bundlePath UTF8String]); result = std::string([bundlePath UTF8String]);
} }
return result; return result;
} }
@ -102,7 +102,7 @@ std::string getSystemApplicationSupportFolder()
{ {
return findSystemDirectory (NSApplicationSupportDirectory, return findSystemDirectory (NSApplicationSupportDirectory,
NSUserDomainMask); NSUserDomainMask);
} }
#endif // LL_DARWIN #endif // LL_DARWIN

View File

@ -0,0 +1,47 @@
# -*- cmake -*-
project(llphysicsextensionsos)
include(00-Common)
include(LLCommon)
include(LLMath)
include(VHACD)
set(llphysicsextensionsos_SOURCE_FILES
llconvexdecomposition.cpp
llconvexdecompositionvhacd.cpp
llpathinglib.cpp
LLPathingLibStubImpl.cpp
llphysicsextensions.cpp
LLPhysicsExtensionsStubImpl.cpp
)
set(llphysicsextensionsos_HEADER_FILES
CMakeLists.txt
llconvexdecomposition.h
llconvexdecompositionvhacd.h
llpathinglib.h
LLPathingLibStubImpl.h
llphysicsextensions.h
LLPhysicsExtensionsStubImpl.h
)
set_source_files_properties(${llphysicsextensionsos_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND llphysicsextensionsos_SOURCE_FILES ${llphysicsextensionsos_HEADER_FILES})
add_library (llphysicsextensionsos ${llphysicsextensionsos_SOURCE_FILES})
target_include_directories(llphysicsextensionsos INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(llphysicsextensionsos
llcommon
llmath
ll::vhacd)
if(WINDOWS)
target_compile_options(llphysicsextensionsos PRIVATE /bigobj)
endif()
# Add tests

View File

@ -0,0 +1,109 @@
/**
* @file LLPathingLibStubImpl.cpp
* @author prep@lindenlab.com
* @brief A stubbed implementation of LLPathingLib
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 20112010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llpathinglib.h"
#include "LLPathingLibStubImpl.h"
#include "llsd.h"
//=============================================================================
LLPathingLibImpl::LLPathingLibImpl()
{
}
LLPathingLibImpl::~LLPathingLibImpl()
{
}
LLPathingLib* LLPathingLibImpl::getInstance()
{
return NULL;
}
LLPathingLib::LLPLResult LLPathingLibImpl::initSystem()
{
return LLPL_NOT_IMPLEMENTED;
}
LLPathingLib::LLPLResult LLPathingLibImpl::quitSystem()
{
return LLPL_NOT_IMPLEMENTED;
}
LLPathingLib::LLPLResult LLPathingLibImpl::extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir )
{
return LLPL_NOT_IMPLEMENTED;
}
void LLPathingLibImpl::processNavMeshData()
{
}
LLPathingLibImpl::LLPLResult LLPathingLibImpl::generatePath( const PathingPacket& pathingPacket )
{
return LLPL_NOT_IMPLEMENTED;
}
void LLPathingLibImpl::setNavMeshMaterialType( LLPLCharacterType materialType )
{
}
void LLPathingLibImpl::setNavMeshColors( const NavMeshColors& color )
{
}
void LLPathingLibImpl::renderNavMesh()
{
}
void LLPathingLibImpl::renderNavMeshEdges()
{
}
void LLPathingLibImpl::renderNavMeshShapesVBO( U32 shapeRenderFlags )
{
}
void LLPathingLibImpl::renderPath()
{
}
void LLPathingLibImpl::renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type )
{
}
void LLPathingLibImpl::cleanupVBOManager()
{
}
void LLPathingLibImpl::cleanupResidual()
{
}

View File

@ -0,0 +1,78 @@
/**
* @file LLPathingLibSubImpl.h
* @author prep@lindenlab.com
* @brief A stubbed implementation of LLPathingLib
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_PATHING_LIB_H
#define LL_PATHING_LIB_H
#include "llpathinglib.h"
class LLSD;
//=============================================================================
class LLPathingLibImpl : public LLPathingLib
{
public:
LLPathingLibImpl();
virtual ~LLPathingLibImpl();
// Obtain a pointer to the actual implementation
static LLPathingLib* getInstance();
static LLPathingLib::LLPLResult initSystem();
static LLPathingLib::LLPLResult quitSystem();
//Extract and store navmesh data from the llsd datablock sent down by the server
virtual LLPLResult extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir );
//Stitch any stored navmeshes together
virtual void processNavMeshData();
//Method used to generate and visualize a path on the viewers navmesh
virtual LLPLResult generatePath( const PathingPacket& pathingPacket );
//Set the material type for the heatmap type
virtual void setNavMeshMaterialType( LLPLCharacterType materialType );
//Set the various navmesh colors
virtual void setNavMeshColors( const NavMeshColors& color );
//The entry method to rendering the client side navmesh
virtual void renderNavMesh();
//The entry method to rendering the client side navmesh edges
virtual void renderNavMeshEdges();
//The entry method to render the client navmesh shapes VBO
virtual void renderNavMeshShapesVBO( U32 shapeRenderFlags );
//The entry method to render the clients designated path
virtual void renderPath();
//The entry method to render the capsule bookends for the clients designated path
virtual void renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type );
//Method to delete any vbo's that are currently being managed by the pathing library
virtual void cleanupVBOManager();
//Method to cleanup any allocations within the implementation
virtual void cleanupResidual();
};
#endif //LL_PATHING_LIB_H

View File

@ -0,0 +1,51 @@
/**
* @file LLPhysicsExtensionsStubImpl.cpp
* @author prep@lindenlab.com
* @brief A stubbed implementation of LLPhysicsExtensions
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llphysicsextensions.h"
#include "LLPhysicsExtensionsStubImpl.h"
//=============================================================================
LLPhysicsExtensionsImpl::LLPhysicsExtensionsImpl()
{
}
LLPhysicsExtensionsImpl::~LLPhysicsExtensionsImpl()
{
}
bool LLPhysicsExtensionsImpl::initSystem()
{
return false;
}
bool LLPhysicsExtensionsImpl::quitSystem()
{
return false;
}

View File

@ -0,0 +1,46 @@
/**
* @file LLPhysicsExtensionsSubImpl.h
* @author prep@lindenlab.com
* @brief A stubbed implementation of LLPhysicsExtensions
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_PHYSICS_EXTENSIONS_STUB_IMPL_H
#define LL_PHYSICS_EXTENSIONS_STUB_IMPL_H
#include "llphysicsextensions.h"
//=============================================================================
class LLPhysicsExtensionsImpl : public LLPhysicsExtensions
{
public:
LLPhysicsExtensionsImpl();
virtual ~LLPhysicsExtensionsImpl();
static bool initSystem();
static bool quitSystem();
};
#endif //LL_PHYSICS_EXTENSIONS_STUB_IMPL_H

View File

@ -0,0 +1,83 @@
/**
* @file llpathinglib.cpp
* @author prep@lindenlab.com
* @brief LLPathingLib core creation methods
*
* $LicenseInfo:firstyear=2012&license=lgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "LLPathingLibStubImpl.h"
#include "llpathinglib.h"
//=============================================================================
/*static */bool LLPathingLib::s_isInitialized = false;
//=============================================================================
/*static*/bool LLPathingLib::isFunctional()
{
return false;
}
/*static*/LLPathingLib* LLPathingLib::getInstance()
{
if ( !s_isInitialized )
{
return NULL;
}
else
{
return LLPathingLibImpl::getInstance();
}
}
//=============================================================================
/*static */LLPathingLib::LLPLResult LLPathingLib::initSystem()
{
if ( LLPathingLibImpl::initSystem() == LLPL_OK )
{
s_isInitialized = true;
return LLPL_OK;
}
return LLPL_UNKOWN_ERROR;
}
//=============================================================================
/*static */LLPathingLib::LLPLResult LLPathingLib::quitSystem()
{
LLPLResult quitResult = LLPL_UNKOWN_ERROR;
if (s_isInitialized)
{
quitResult = LLPathingLibImpl::quitSystem();
s_isInitialized = false;
}
return quitResult;
}
//=============================================================================

View File

@ -0,0 +1,187 @@
/**
* @file llpathinglib.cpp
* @author prep@lindenlab.com
* @brief LLPathingLib interface definition
*
* $LicenseInfo:firstyear=2012&license=lgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_PATHING_LIBRARY
#define LL_PATHING_LIBRARY
#include "llpreprocessor.h"
#include "llsd.h"
#include "v3dmath.h"
#include "v4math.h"
#include "v4color.h"
#include "v4coloru.h"
#include "llphysicsextensions.h"
typedef int bool32;
#if defined(_WIN32) || defined(_WIN64)
#define LLCD_CALL __cdecl
#else
#define LLCD_CALL
#endif
class LLRender;
//=============================================================================
class LLPathingLib
{
public:
enum LLShapeType
{
LLST_WalkableObjects = 0,
LLST_ObstacleObjects,
LLST_MaterialPhantoms,
LLST_ExclusionPhantoms,
LLST_MaxShapeTypes = LLST_ExclusionPhantoms+1,
LLST_None = LLST_MaxShapeTypes+2,
LLST_SimpleBox = LLST_None+1,
LLST_SimpleCapsule = LLST_SimpleBox+1,
};
enum LLShapeTypeFlag
{
LLSTB_WalkableObjects = 0x1 << 1,
LLSTB_ObstacleObjects = 0x1 << 2,
LLSTB_MaterialPhantoms = 0x1 << 3,
LLSTB_ExclusionPhantoms = 0x1 << 4,
LLSTB_None = 0x1 << 5
};
enum LLPLPathBookEnd
{
LLPL_START = 0,
LLPL_END,
};
enum LLPLResult
{
LLPL_OK = 0,
LLPL_NOTSET,
LLPL_ERROR,
LLPL_NO_NAVMESH,
LLPL_UNKOWN_ERROR,
LLPL_NO_PATH,
LLPL_PATH_GENERATED_OK,
LLPL_NOT_IMPLEMENTED,
};
enum LLPLCharacterType
{
LLPL_CHARACTER_TYPE_A = 4,
LLPL_CHARACTER_TYPE_B = 3,
LLPL_CHARACTER_TYPE_C = 2,
LLPL_CHARACTER_TYPE_D = 1,
LLPL_CHARACTER_TYPE_NONE = 0
};
struct PathingPacket
{
PathingPacket() : mHasPointA(false), mHasPointB(false), mCharacterWidth(0.0f), mCharacterType(LLPL_CHARACTER_TYPE_NONE) {}
bool mHasPointA;
LLVector3 mStartPointA;
LLVector3 mEndPointA;
bool mHasPointB;
LLVector3 mStartPointB;
LLVector3 mEndPointB;
F32 mCharacterWidth;
LLPLCharacterType mCharacterType;
};
struct NavMeshColors
{
LLColor4U mWalkable;
LLColor4U mObstacle;
LLColor4U mMaterial;
LLColor4U mExclusion;
LLColor4U mConnectedEdge;
LLColor4U mBoundaryEdge;
LLColor4 mHeatColorBase;
LLColor4 mHeatColorMax;
LLColor4U mFaceColor;
LLColor4U mStarValid;
LLColor4U mStarInvalid;
LLColor4U mTestPath;
LLColor4U mWaterColor;
};
public:
//Ctor
LLPathingLib() {}
virtual ~LLPathingLib() {}
/// @returns false if this is the stub
static bool isFunctional();
// Obtain a pointer to the actual implementation
static LLPathingLib* getInstance();
static LLPathingLib::LLPLResult initSystem();
static LLPathingLib::LLPLResult quitSystem();
//Extract and store navmesh data from the llsd datablock sent down by the server
virtual LLPLResult extractNavMeshSrcFromLLSD( const LLSD::Binary& dataBlock, int dir ) = 0;
//Stitch any stored navmeshes together
virtual void processNavMeshData( ) = 0;
//Method used to generate and visualize a path on the viewers navmesh
virtual LLPLResult generatePath( const PathingPacket& pathingPacket ) = 0;
//Set the material type for the heatmap type
virtual void setNavMeshMaterialType( LLPLCharacterType materialType ) = 0;
//Set the various navmesh colors
virtual void setNavMeshColors( const NavMeshColors& color ) = 0;
//The entry method to rendering the client side navmesh
virtual void renderNavMesh() = 0;
//The entry method to rendering the client side navmesh edges
virtual void renderNavMeshEdges() = 0;
//The entry method to render the client navmesh shapes VBO
virtual void renderNavMeshShapesVBO( U32 shapeRenderFlags ) = 0;
//The entry method to render the clients designated path
virtual void renderPath() = 0;
//The entry method to render the capsule bookends for the clients designated path
virtual void renderPathBookend( LLRender& gl, LLPathingLib::LLPLPathBookEnd type ) = 0;
//Renders all of the generated simple shapes (using their default transforms)
virtual void renderSimpleShapes( LLRender& gl, F32 regionsWaterHeight ) = 0;
//Method called from second life to create a capsule from properties of a character
virtual void createPhysicsCapsuleRep( F32 length, F32 radius, bool horizontal, const LLUUID& id ) = 0;
//Removes any cached physics capsule using a list of cached uuids
virtual void cleanupPhysicsCapsuleRepResiduals() = 0;
//Renders a selected uuids physics rep
virtual void renderSimpleShapeCapsuleID( LLRender& gl, const LLUUID& id, const LLVector3& pos, const LLQuaternion& rot ) = 0;
//Method to delete any vbo's that are currently being managed by the pathing library
virtual void cleanupVBOManager( ) = 0;
//Method to cleanup any allocations within the implementation
virtual void cleanupResidual( ) = 0;
private:
static bool s_isInitialized;
};
#endif //LL_PATHING_LIBRARY

View File

@ -0,0 +1,78 @@
/**
* @file llphysicsextensions.cpp
* @author nyx@lindenlab.com
* @brief LLPhysicsExtensions core initialization methods
*
* $LicenseInfo:firstyear=2012&license=lgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llphysicsextensions.h"
#include "LLPhysicsExtensionsStubImpl.h"
//disable the undefined symbol optimization
//#pragma warning (disable : 4221)
//=============================================================================
/*static */bool LLPhysicsExtensions::s_isInitialized = false;
/*static*/bool LLPhysicsExtensions::isFunctional()
{
return false;
}
//=============================================================================
/*static*/LLPhysicsExtensions* LLPhysicsExtensions::getInstance()
{
if ( !s_isInitialized )
{
return NULL;
}
else
{
return LLPhysicsExtensionsImpl::getInstance();
}
}
//=============================================================================
/*static */bool LLPhysicsExtensions::initSystem()
{
bool result = LLPhysicsExtensionsImpl::initSystem();
if ( result )
{
s_isInitialized = true;
}
return result;
}
//=============================================================================
/*static */bool LLPhysicsExtensions::quitSystem()
{
return LLPhysicsExtensionsImpl::quitSystem();
}
//=============================================================================

View File

@ -0,0 +1,59 @@
/**
* @file llphysicsextensions.h
* @author nyx@lindenlab.com
* @brief LLPhysicsExtensions core shared initialization
* routines
*
* $LicenseInfo:firstyear=2012&license=lgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_PHYSICS_EXTENSIONS
#define LL_PHYSICS_EXTENSIONS
#include "llpreprocessor.h"
#include "llsd.h"
#include "v3dmath.h"
#define LLPHYSICSEXTENSIONS_VERSION "1.0"
typedef int bool32;
class LLPhysicsExtensions
{
public:
// Obtain a pointer to the actual implementation
static LLPhysicsExtensions* getInstance();
/// @returns false if this is the stub
static bool isFunctional();
static bool initSystem();
static bool quitSystem();
private:
static bool s_isInitialized;
};
#endif //LL_PATHING_LIBRARY

View File

@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; * License as published by the Free Software Foundation;
* version 2.1 of the License only. * version 2.1 of the License only.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
* *
@ -38,51 +38,51 @@
void LLCocoaPlugin::setupCocoa() void LLCocoaPlugin::setupCocoa()
{ {
static bool inited = false; static bool inited = false;
if(!inited) if(!inited)
{ {
createAutoReleasePool(); createAutoReleasePool();
// The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents.
// ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr'
// when init'ing the Cocoa App window. // when init'ing the Cocoa App window.
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
// This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor": // This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor":
// http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html // http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html
// Needed for Carbon based applications which call into Cocoa // Needed for Carbon based applications which call into Cocoa
NSApplicationLoad(); NSApplicationLoad();
// Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image
[[[NSWindow alloc] init] release];
// Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image
[[[NSWindow alloc] init] release];
mPluginWindow = [NSApp mainWindow]; mPluginWindow = [NSApp mainWindow];
deleteAutoReleasePool(); deleteAutoReleasePool();
inited = true; inited = true;
} }
} }
static NSAutoreleasePool *sPool = NULL; static NSAutoreleasePool *sPool = NULL;
void LLCocoaPlugin::createAutoReleasePool() void LLCocoaPlugin::createAutoReleasePool()
{ {
if(!sPool) if(!sPool)
{ {
sPool = [[NSAutoreleasePool alloc] init]; sPool = [[NSAutoreleasePool alloc] init];
} }
} }
void LLCocoaPlugin::deleteAutoReleasePool() void LLCocoaPlugin::deleteAutoReleasePool()
{ {
if(sPool) if(sPool)
{ {
[sPool release]; [sPool release];
sPool = NULL; sPool = NULL;
} }
} }
LLCocoaPlugin::LLCocoaPlugin():mHackState(0) LLCocoaPlugin::LLCocoaPlugin():mHackState(0)
@ -110,12 +110,12 @@ void LLCocoaPlugin::setupGroup()
// { // {
// // Start out with a window layer that's way out in front (fixes the problem with the menubar not getting hidden on first switch to fullscreen youtube) // // Start out with a window layer that's way out in front (fixes the problem with the menubar not getting hidden on first switch to fullscreen youtube)
// SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer")); // SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer"));
// SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel); // SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel);
// } // }
} }
void LLCocoaPlugin::updateWindows() void LLCocoaPlugin::updateWindows()
{ {
// NSArray* window_list = [NSApp orderedWindows]; // NSArray* window_list = [NSApp orderedWindows];
// NSWindow* current_window = [window_list objectAtIndex:0]; // NSWindow* current_window = [window_list objectAtIndex:0];
@ -123,38 +123,38 @@ void LLCocoaPlugin::updateWindows()
// bool this_is_front_process = false; // bool this_is_front_process = false;
// bool parent_is_front_process = false; // bool parent_is_front_process = false;
// //
// //
// // Check for a change in this process's frontmost window. // // Check for a change in this process's frontmost window.
// if ( current_window != mFrontWindow ) // if ( current_window != mFrontWindow )
// { // {
// // and figure out whether this process or its parent are currently frontmost // // and figure out whether this process or its parent are currently frontmost
// if ( current_window == parent_window ) parent_is_front_process = true; // if ( current_window == parent_window ) parent_is_front_process = true;
// if ( current_window == mPluginWindow ) this_is_front_process = true; // if ( current_window == mPluginWindow ) this_is_front_process = true;
// //
// if (current_window != NULL && mFrontWindow == NULL) // if (current_window != NULL && mFrontWindow == NULL)
// { // {
// // Opening the first window // // Opening the first window
// //
// if(mHackState == 0) // if(mHackState == 0)
// { // {
// // Next time through the event loop, lower the window group layer // // Next time through the event loop, lower the window group layer
// mHackState = 1; // mHackState = 1;
// } // }
// //
// if(parent_is_front_process) // if(parent_is_front_process)
// { // {
// // Bring this process's windows to the front. // // Bring this process's windows to the front.
// [mPluginWindow makeKeyAndOrderFront:NSApp]; // [mPluginWindow makeKeyAndOrderFront:NSApp];
// [mPluginWindow setOrderedIndex:0]; // [mPluginWindow setOrderedIndex:0];
// } // }
// //
// [NSApp activateIgnoringOtherApps:YES]; // [NSApp activateIgnoringOtherApps:YES];
// } // }
// //
// else if (( current_window == NULL) && (mFrontWindow != NULL)) // else if (( current_window == NULL) && (mFrontWindow != NULL))
// { // {
// // Closing the last window // // Closing the last window
// //
// if(this_is_front_process) // if(this_is_front_process)
// { // {
// // Try to bring this process's parent to the front // // Try to bring this process's parent to the front
@ -171,7 +171,7 @@ void LLCocoaPlugin::updateWindows()
//// } //// }
// mHackState = 2; // mHackState = 2;
// } // }
// //
// mFrontWindow = [window_list objectAtIndex:0]; // mFrontWindow = [window_list objectAtIndex:0];
// } // }
} }

View File

@ -66,15 +66,18 @@ target_link_libraries(llprimitive
llxml llxml
llcharacter llcharacter
llrender llrender
llphysicsextensions_impl
ll::colladadom ll::colladadom
ll::glm ll::glm
) )
if (TARGET llconvexdecomposition) if (HAVOK OR HAVOK_TPV)
target_link_libraries(llprimitive target_link_libraries(llprimitive
llconvexdecomposition llphysicsextensions_impl
) )
else()
target_link_libraries(llprimitive
llphysicsextensionsos
)
endif () endif ()
if(LINUX) if(LINUX)

View File

@ -30,7 +30,7 @@
#import <Carbon/Carbon.h> #import <Carbon/Carbon.h>
extern BOOL gHiDPISupport; extern bool gHiDPISupport;
#pragma mark local functions #pragma mark local functions
@ -114,7 +114,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (unsigned long)getVramSize - (unsigned long)getVramSize
{ {
CGLRendererInfoObj info = 0; CGLRendererInfoObj info = 0;
GLint vram_megabytes = 0; GLint vram_megabytes = 0;
int num_renderers = 0; int num_renderers = 0;
CGLError the_err = CGLQueryRendererInfo (CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &num_renderers); CGLError the_err = CGLQueryRendererInfo (CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &num_renderers);
if(0 == the_err) if(0 == the_err)
@ -132,29 +132,29 @@ attributedStringInfo getSegments(NSAttributedString *str)
vram_megabytes = 256; vram_megabytes = 256;
} }
return (unsigned long)vram_megabytes; // return value is in megabytes. return (unsigned long)vram_megabytes; // return value is in megabytes.
} }
- (void)viewDidMoveToWindow - (void)viewDidMoveToWindow
{ {
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowResized:) name:NSWindowDidResizeNotification selector:@selector(windowResized:) name:NSWindowDidResizeNotification
object:[self window]]; object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowWillMiniaturize:) name:NSWindowWillMiniaturizeNotification selector:@selector(windowWillMiniaturize:) name:NSWindowWillMiniaturizeNotification
object:[self window]]; object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification
object:[self window]]; object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification
object:[self window]]; object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification selector:@selector(windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification
object:[self window]]; object:[self window]];
NSRect wnd_rect = [[self window] frame]; NSRect wnd_rect = [[self window] frame];
@ -188,28 +188,28 @@ attributedStringInfo getSegments(NSAttributedString *str)
-(void)windowDidChangeScreen:(NSNotification *)notification; -(void)windowDidChangeScreen:(NSNotification *)notification;
{ {
callWindowDidChangeScreen(); callWindowDidChangeScreen();
} }
- (void)dealloc - (void)dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc]; [super dealloc];
} }
- (id) init - (id) init
{ {
return [self initWithFrame:[self bounds] withSamples:2 andVsync:TRUE]; return [self initWithFrame:[self bounds] withSamples:2 andVsync:TRUE];
} }
- (id) initWithSamples:(NSUInteger)samples - (id) initWithSamples:(NSUInteger)samples
{ {
return [self initWithFrame:[self bounds] withSamples:samples andVsync:TRUE]; return [self initWithFrame:[self bounds] withSamples:samples andVsync:TRUE];
} }
- (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync - (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync
{ {
return [self initWithFrame:[self bounds] withSamples:samples andVsync:vsync]; return [self initWithFrame:[self bounds] withSamples:samples andVsync:vsync];
} }
#if LL_DARWIN #if LL_DARWIN
@ -220,101 +220,101 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync
{ {
// <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley // <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (!self) { return self; } // Despite what this may look like, returning nil self is a-ok. if (!self) { return self; } // Despite what this may look like, returning nil self is a-ok.
// <F/S> // <F/S>
[self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]]; [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]];
//[self initWithFrame:frame]; <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley //[self initWithFrame:frame]; <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley
// Initialize with a default "safe" pixel format that will work with versions dating back to OS X 10.6. // Initialize with a default "safe" pixel format that will work with versions dating back to OS X 10.6.
// Any specialized pixel formats, i.e. a core profile pixel format, should be initialized through rebuildContextWithFormat. // Any specialized pixel formats, i.e. a core profile pixel format, should be initialized through rebuildContextWithFormat.
// 10.7 and 10.8 don't really care if we're defining a profile or not. If we don't explicitly request a core or legacy profile, it'll always assume a legacy profile (for compatibility reasons). // 10.7 and 10.8 don't really care if we're defining a profile or not. If we don't explicitly request a core or legacy profile, it'll always assume a legacy profile (for compatibility reasons).
NSOpenGLPixelFormatAttribute attrs[] = { NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFANoRecovery, NSOpenGLPFANoRecovery,
NSOpenGLPFADoubleBuffer, NSOpenGLPFADoubleBuffer,
NSOpenGLPFAClosestPolicy, NSOpenGLPFAClosestPolicy,
NSOpenGLPFAAccelerated, NSOpenGLPFAAccelerated,
NSOpenGLPFASampleBuffers, 0, NSOpenGLPFASampleBuffers, 0,
NSOpenGLPFASamples, 0, NSOpenGLPFASamples, 0,
NSOpenGLPFAStencilSize, 8, NSOpenGLPFAStencilSize, 8,
NSOpenGLPFADepthSize, 24, NSOpenGLPFADepthSize, 24,
NSOpenGLPFAAlphaSize, 8, NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFAColorSize, 24, NSOpenGLPFAColorSize, 24,
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core,
0 0
}; };
NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease]; NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease];
if (pixelFormat == nil) if (pixelFormat == nil)
{ {
NSLog(@"Failed to create pixel format!", nil); NSLog(@"Failed to create pixel format!", nil);
return nil; return nil;
} }
// <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley // <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley
//NSOpenGLContext *glContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; //NSOpenGLContext *glContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
NSOpenGLContext *glContext = [[[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil] autorelease]; NSOpenGLContext *glContext = [[[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil] autorelease];
// </FS> // </FS>
if (glContext == nil) if (glContext == nil)
{ {
NSLog(@"Failed to create OpenGL context!", nil); NSLog(@"Failed to create OpenGL context!", nil);
return nil; return nil;
} }
[self setPixelFormat:pixelFormat]; [self setPixelFormat:pixelFormat];
//for retina support //for retina support
[self setWantsBestResolutionOpenGLSurface:gHiDPISupport]; [self setWantsBestResolutionOpenGLSurface:gHiDPISupport];
[self setOpenGLContext:glContext]; [self setOpenGLContext:glContext];
[glContext setView:self]; [glContext setView:self];
[glContext makeCurrentContext]; [glContext makeCurrentContext];
if (vsync) if (vsync)
{ {
GLint value = 1; GLint value = 1;
[glContext setValues:&value forParameter:NSOpenGLContextParameterSwapInterval]; [glContext setValues:&value forParameter:NSOpenGLContextParameterSwapInterval];
} else { } else {
// supress this error after move to Xcode 7: // supress this error after move to Xcode 7:
// error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull] // error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
// Tried using ObjC 'nonnull' keyword as per SO article but didn't build // Tried using ObjC 'nonnull' keyword as per SO article but didn't build
GLint swapInterval=0; GLint swapInterval=0;
[glContext setValues:&swapInterval forParameter:NSOpenGLContextParameterSwapInterval]; [glContext setValues:&swapInterval forParameter:NSOpenGLContextParameterSwapInterval];
} }
return self; return self;
} }
- (BOOL) rebuildContext - (BOOL) rebuildContext
{ {
return [self rebuildContextWithFormat:[self pixelFormat]]; return [self rebuildContextWithFormat:[self pixelFormat]];
} }
- (BOOL) rebuildContextWithFormat:(NSOpenGLPixelFormat *)format - (BOOL) rebuildContextWithFormat:(NSOpenGLPixelFormat *)format
{ {
NSOpenGLContext *ctx = [self openGLContext]; NSOpenGLContext *ctx = [self openGLContext];
[ctx clearDrawable]; [ctx clearDrawable];
// <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley // <FS> Fix some bad refcount code and squash some potential leakiness; by Cinder Roxley
//[ctx initWithFormat:format shareContext:nil]; //[ctx initWithFormat:format shareContext:nil];
ctx = [[[NSOpenGLContext alloc] initWithFormat:format shareContext:nil] autorelease]; ctx = [[[NSOpenGLContext alloc] initWithFormat:format shareContext:nil] autorelease];
// </FS> // </FS>
if (ctx == nil) if (ctx == nil)
{ {
NSLog(@"Failed to create OpenGL context!", nil); NSLog(@"Failed to create OpenGL context!", nil);
return false; return false;
} }
[self setOpenGLContext:ctx]; [self setOpenGLContext:ctx];
[ctx setView:self]; [ctx setView:self];
[ctx makeCurrentContext]; [ctx makeCurrentContext];
return true; return true;
} }
#if LL_DARWIN #if LL_DARWIN
@ -323,14 +323,14 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (CGLContextObj)getCGLContextObj - (CGLContextObj)getCGLContextObj
{ {
NSOpenGLContext *ctx = [self openGLContext]; NSOpenGLContext *ctx = [self openGLContext];
return (CGLContextObj)[ctx CGLContextObj]; return (CGLContextObj)[ctx CGLContextObj];
} }
- (CGLPixelFormatObj*)getCGLPixelFormatObj - (CGLPixelFormatObj*)getCGLPixelFormatObj
{ {
NSOpenGLPixelFormat *fmt = [self pixelFormat]; NSOpenGLPixelFormat *fmt = [self pixelFormat];
return (CGLPixelFormatObj*)[fmt CGLPixelFormatObj]; return (CGLPixelFormatObj*)[fmt CGLPixelFormatObj];
} }
// Various events can be intercepted by our view, thus not reaching our window. // Various events can be intercepted by our view, thus not reaching our window.
@ -375,29 +375,29 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) rightMouseDown:(NSEvent *)theEvent - (void) rightMouseDown:(NSEvent *)theEvent
{ {
callRightMouseDown(mMousePos, [theEvent modifierFlags]); callRightMouseDown(mMousePos, [theEvent modifierFlags]);
} }
- (void) rightMouseUp:(NSEvent *)theEvent - (void) rightMouseUp:(NSEvent *)theEvent
{ {
callRightMouseUp(mMousePos, [theEvent modifierFlags]); callRightMouseUp(mMousePos, [theEvent modifierFlags]);
} }
- (void)mouseMoved:(NSEvent *)theEvent - (void)mouseMoved:(NSEvent *)theEvent
{ {
NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])]; NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])];
float mouseDeltas[] = { float mouseDeltas[] = {
float(dev_delta.x), float(dev_delta.x),
float(dev_delta.y) float(dev_delta.y)
}; };
callDeltaUpdate(mouseDeltas, 0); callDeltaUpdate(mouseDeltas, 0);
NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]];
mMousePos[0] = mPoint.x; mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y; mMousePos[1] = mPoint.y;
callMouseMoved(mMousePos, 0); callMouseMoved(mMousePos, 0);
} }
// NSWindow doesn't trigger mouseMoved when the mouse is being clicked and dragged. // NSWindow doesn't trigger mouseMoved when the mouse is being clicked and dragged.
@ -405,23 +405,23 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) mouseDragged:(NSEvent *)theEvent - (void) mouseDragged:(NSEvent *)theEvent
{ {
// Trust the deltas supplied by NSEvent. // Trust the deltas supplied by NSEvent.
// The old CoreGraphics APIs we previously relied on are now flagged as obsolete. // The old CoreGraphics APIs we previously relied on are now flagged as obsolete.
// NSEvent isn't obsolete, and provides us with the correct deltas. // NSEvent isn't obsolete, and provides us with the correct deltas.
NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])]; NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])];
float mouseDeltas[] = { float mouseDeltas[] = {
float(dev_delta.x), float(dev_delta.x),
float(dev_delta.y) float(dev_delta.y)
}; };
callDeltaUpdate(mouseDeltas, 0); callDeltaUpdate(mouseDeltas, 0);
NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]]; NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]];
mMousePos[0] = mPoint.x; mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y; mMousePos[1] = mPoint.y;
callMouseDragged(mMousePos, 0); callMouseDragged(mMousePos, 0);
} }
- (void) otherMouseDown:(NSEvent *)theEvent - (void) otherMouseDown:(NSEvent *)theEvent
@ -436,29 +436,29 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) rightMouseDragged:(NSEvent *)theEvent - (void) rightMouseDragged:(NSEvent *)theEvent
{ {
[self mouseDragged:theEvent]; [self mouseDragged:theEvent];
} }
- (void) otherMouseDragged:(NSEvent *)theEvent - (void) otherMouseDragged:(NSEvent *)theEvent
{ {
[self mouseDragged:theEvent]; [self mouseDragged:theEvent];
} }
- (void) scrollWheel:(NSEvent *)theEvent - (void) scrollWheel:(NSEvent *)theEvent
{ {
callScrollMoved(-[theEvent deltaX], -[theEvent deltaY]); callScrollMoved(-[theEvent deltaX], -[theEvent deltaY]);
} }
- (void) mouseExited:(NSEvent *)theEvent - (void) mouseExited:(NSEvent *)theEvent
{ {
callMouseExit(); callMouseExit();
} }
- (void) keyUp:(NSEvent *)theEvent - (void) keyUp:(NSEvent *)theEvent
{ {
NativeKeyEventData eventData = extractKeyDataFromKeyEvent(theEvent); NativeKeyEventData eventData = extractKeyDataFromKeyEvent(theEvent);
eventData.mKeyEvent = NativeKeyEventData::KEYUP; eventData.mKeyEvent = NativeKeyEventData::KEYUP;
callKeyUp(&eventData, [theEvent keyCode], [theEvent modifierFlags]); callKeyUp(&eventData, [theEvent keyCode], [theEvent modifierFlags]);
} }
- (void) keyDown:(NSEvent *)theEvent - (void) keyDown:(NSEvent *)theEvent
@ -472,7 +472,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
// Because flagsChange event handler misses event when other window is activated, // Because flagsChange event handler misses event when other window is activated,
// e.g. OS Window for upload something or Input Window... // e.g. OS Window for upload something or Input Window...
// mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit) // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit)
mModifiers = [theEvent modifierFlags]; mModifiers = [theEvent modifierFlags];
NSString *str_no_modifiers = [theEvent charactersIgnoringModifiers]; NSString *str_no_modifiers = [theEvent charactersIgnoringModifiers];
unichar ch = 0; unichar ch = 0;
if (str_no_modifiers.length) if (str_no_modifiers.length)
@ -500,8 +500,8 @@ attributedStringInfo getSegments(NSAttributedString *str)
{ {
NativeKeyEventData eventData = extractKeyDataFromModifierEvent(theEvent); NativeKeyEventData eventData = extractKeyDataFromModifierEvent(theEvent);
mModifiers = [theEvent modifierFlags]; mModifiers = [theEvent modifierFlags];
callModifier([theEvent modifierFlags]); callModifier([theEvent modifierFlags]);
NSInteger mask = 0; NSInteger mask = 0;
switch([theEvent keyCode]) switch([theEvent keyCode])
@ -542,69 +542,69 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (BOOL) acceptsFirstResponder - (BOOL) acceptsFirstResponder
{ {
return YES; return YES;
} }
- (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender - (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender
{ {
NSPasteboard *pboard; NSPasteboard *pboard;
NSDragOperation sourceDragMask; NSDragOperation sourceDragMask;
sourceDragMask = [sender draggingSourceOperationMask]; sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard]; pboard = [sender draggingPasteboard];
if ([[pboard types] containsObject:NSPasteboardTypeURL]) if ([[pboard types] containsObject:NSPasteboardTypeURL])
{ {
if (sourceDragMask & NSDragOperationLink) { if (sourceDragMask & NSDragOperationLink) {
NSURL *fileUrl = [[pboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:[NSDictionary dictionary]] objectAtIndex:0]; NSURL *fileUrl = [[pboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:[NSDictionary dictionary]] objectAtIndex:0];
mLastDraggedUrl = [[fileUrl absoluteString] UTF8String]; mLastDraggedUrl = [[fileUrl absoluteString] UTF8String];
return NSDragOperationLink; return NSDragOperationLink;
} }
} }
return NSDragOperationNone; return NSDragOperationNone;
} }
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{ {
callHandleDragUpdated(mLastDraggedUrl); callHandleDragUpdated(mLastDraggedUrl);
return NSDragOperationLink; return NSDragOperationLink;
} }
- (void) draggingExited:(id<NSDraggingInfo>)sender - (void) draggingExited:(id<NSDraggingInfo>)sender
{ {
callHandleDragExited(mLastDraggedUrl); callHandleDragExited(mLastDraggedUrl);
} }
- (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender - (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender
{ {
return YES; return YES;
} }
- (BOOL) performDragOperation:(id<NSDraggingInfo>)sender - (BOOL) performDragOperation:(id<NSDraggingInfo>)sender
{ {
callHandleDragDropped(mLastDraggedUrl); callHandleDragDropped(mLastDraggedUrl);
return true; return true;
} }
- (BOOL)hasMarkedText - (BOOL)hasMarkedText
{ {
return mHasMarkedText; return mHasMarkedText;
} }
- (NSRange)markedRange - (NSRange)markedRange
{ {
int range[2]; int range[2];
getPreeditMarkedRange(&range[0], &range[1]); getPreeditMarkedRange(&range[0], &range[1]);
return NSMakeRange(range[0], range[1]); return NSMakeRange(range[0], range[1]);
} }
- (NSRange)selectedRange - (NSRange)selectedRange
{ {
int range[2]; int range[2];
getPreeditSelectionRange(&range[0], &range[1]); getPreeditSelectionRange(&range[0], &range[1]);
return NSMakeRange(range[0], range[1]); return NSMakeRange(range[0], range[1]);
} }
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
@ -690,21 +690,21 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void)unmarkText - (void)unmarkText
{ {
[[self inputContext] discardMarkedText]; [[self inputContext] discardMarkedText];
resetPreedit(); resetPreedit();
mHasMarkedText = FALSE; mHasMarkedText = FALSE;
} }
// We don't support attributed strings. // We don't support attributed strings.
- (NSArray *)validAttributesForMarkedText - (NSArray *)validAttributesForMarkedText
{ {
return [NSArray array]; return [NSArray array];
} }
// See above. // See above.
- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{ {
return nil; return nil;
} }
- (void)insertText:(id)insertString - (void)insertText:(id)insertString
@ -717,9 +717,9 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
{ {
// SL-19801 Special workaround for system emoji picker // SL-19801 Special workaround for system emoji picker
if ([aString length] == 2) if ([aString length] == 2)
{ {
@try @try
{ {
uint32_t b0 = [aString characterAtIndex:0]; uint32_t b0 = [aString characterAtIndex:0];
@ -737,7 +737,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
NSLog(@"Encountered an unsupported attributed character. Exception: %@ String: %@", e.name, aString); NSLog(@"Encountered an unsupported attributed character. Exception: %@ String: %@", e.name, aString);
return; return;
} }
} }
@try @try
{ {
@ -770,36 +770,36 @@ attributedStringInfo getSegments(NSAttributedString *str)
if (!(mModifiers & NSEventModifierFlagCommand) && if (!(mModifiers & NSEventModifierFlagCommand) &&
!(mModifiers & NSEventModifierFlagShift) && !(mModifiers & NSEventModifierFlagShift) &&
!(mModifiers & NSEventModifierFlagOption)) !(mModifiers & NSEventModifierFlagOption))
{ {
callUnicodeCallback(13, 0); callUnicodeCallback(13, 0);
} else { } else {
callUnicodeCallback(13, mModifiers); callUnicodeCallback(13, mModifiers);
} }
} }
- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint - (NSUInteger)characterIndexForPoint:(NSPoint)aPoint
{ {
return NSNotFound; return NSNotFound;
} }
- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{ {
float pos[4] = {0, 0, 0, 0}; float pos[4] = {0, 0, 0, 0};
getPreeditLocation(pos, mMarkedTextLength); getPreeditLocation(pos, mMarkedTextLength);
return NSMakeRect(pos[0], pos[1], pos[2], pos[3]); return NSMakeRect(pos[0], pos[1], pos[2], pos[3]);
} }
- (void)doCommandBySelector:(SEL)aSelector - (void)doCommandBySelector:(SEL)aSelector
{ {
if (aSelector == @selector(insertNewline:)) if (aSelector == @selector(insertNewline:))
{ {
[self insertNewline:self]; [self insertNewline:self];
} }
} }
- (BOOL)drawsVerticallyForCharacterAtIndex:(NSUInteger)charIndex - (BOOL)drawsVerticallyForCharacterAtIndex:(NSUInteger)charIndex
{ {
return NO; return NO;
} }
- (void) allowMarkedTextInput:(bool)allowed - (void) allowMarkedTextInput:(bool)allowed
@ -834,7 +834,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) setGLView:(LLOpenGLView *)view - (void) setGLView:(LLOpenGLView *)view
{ {
glview = view; glview = view;
} }
- (void)keyDown:(NSEvent *)theEvent - (void)keyDown:(NSEvent *)theEvent
@ -885,24 +885,24 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (id) init - (id) init
{ {
return self; return self;
} }
- (BOOL) becomeFirstResponder - (BOOL) becomeFirstResponder
{ {
callFocus(); callFocus();
return true; return true;
} }
- (BOOL) resignFirstResponder - (BOOL) resignFirstResponder
{ {
callFocusLost(); callFocusLost();
return true; return true;
} }
- (void) close - (void) close
{ {
callQuitHandler(); callQuitHandler();
} }
@end @end

View File

@ -41,15 +41,15 @@
int createNSApp(int argc, const char *argv[]) int createNSApp(int argc, const char *argv[])
{ {
return NSApplicationMain(argc, argv); return NSApplicationMain(argc, argv);
} }
void setupCocoa() void setupCocoa()
{ {
static bool inited = false; static bool inited = false;
if(!inited) if(!inited)
{ {
@autoreleasepool { @autoreleasepool {
// The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents.
// ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr'
@ -57,8 +57,8 @@ void setupCocoa()
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
} }
inited = true; inited = true;
} }
} }
bool copyToPBoard(const unsigned short *str, unsigned int len) bool copyToPBoard(const unsigned short *str, unsigned int len)
@ -66,7 +66,7 @@ bool copyToPBoard(const unsigned short *str, unsigned int len)
@autoreleasepool { @autoreleasepool {
NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard clearContents]; [pboard clearContents];
NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease]; NSArray *contentsToPaste = [[[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil] autorelease];
return [pboard writeObjects:contentsToPaste]; return [pboard writeObjects:contentsToPaste];
} }
@ -74,8 +74,8 @@ bool copyToPBoard(const unsigned short *str, unsigned int len)
bool pasteBoardAvailable() bool pasteBoardAvailable()
{ {
NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
return [[NSPasteboard generalPasteboard] canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; return [[NSPasteboard generalPasteboard] canReadObjectForClasses:classArray options:[NSDictionary dictionary]];
} }
unsigned short *copyFromPBoard() unsigned short *copyFromPBoard()
@ -111,55 +111,55 @@ CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY)
hotSpot:NSMakePoint(hotspotX, hotspotY) hotSpot:NSMakePoint(hotspotX, hotspotY)
] retain]; ] retain];
} }
return (CursorRef)cursor; return (CursorRef)cursor;
} }
void setArrowCursor() void setArrowCursor()
{ {
NSCursor *cursor = [NSCursor arrowCursor]; NSCursor *cursor = [NSCursor arrowCursor];
[NSCursor unhide]; [NSCursor unhide];
[cursor set]; [cursor set];
} }
void setIBeamCursor() void setIBeamCursor()
{ {
NSCursor *cursor = [NSCursor IBeamCursor]; NSCursor *cursor = [NSCursor IBeamCursor];
[cursor set]; [cursor set];
} }
void setPointingHandCursor() void setPointingHandCursor()
{ {
NSCursor *cursor = [NSCursor pointingHandCursor]; NSCursor *cursor = [NSCursor pointingHandCursor];
[cursor set]; [cursor set];
} }
void setCopyCursor() void setCopyCursor()
{ {
NSCursor *cursor = [NSCursor dragCopyCursor]; NSCursor *cursor = [NSCursor dragCopyCursor];
[cursor set]; [cursor set];
} }
void setCrossCursor() void setCrossCursor()
{ {
NSCursor *cursor = [NSCursor crosshairCursor]; NSCursor *cursor = [NSCursor crosshairCursor];
[cursor set]; [cursor set];
} }
void setNotAllowedCursor() void setNotAllowedCursor()
{ {
NSCursor *cursor = [NSCursor operationNotAllowedCursor]; NSCursor *cursor = [NSCursor operationNotAllowedCursor];
[cursor set]; [cursor set];
} }
void hideNSCursor() void hideNSCursor()
{ {
[NSCursor hide]; [NSCursor hide];
} }
void showNSCursor() void showNSCursor()
{ {
[NSCursor unhide]; [NSCursor unhide];
} }
#if LL_DARWIN #if LL_DARWIN
@ -179,42 +179,42 @@ bool isCGCursorVisible()
void hideNSCursorTillMove(bool hide) void hideNSCursorTillMove(bool hide)
{ {
[NSCursor setHiddenUntilMouseMoves:hide]; [NSCursor setHiddenUntilMouseMoves:hide];
} }
// This is currently unused, since we want all our cursors to persist for the life of the app, but I've included it for completeness. // This is currently unused, since we want all our cursors to persist for the life of the app, but I've included it for completeness.
OSErr releaseImageCursor(CursorRef ref) OSErr releaseImageCursor(CursorRef ref)
{ {
if( ref != NULL ) if( ref != NULL )
{ {
@autoreleasepool { @autoreleasepool {
NSCursor *cursor = (NSCursor*)ref; NSCursor *cursor = (NSCursor*)ref;
[cursor autorelease]; [cursor autorelease];
} }
} }
else else
{ {
return paramErr; return paramErr;
} }
return noErr; return noErr;
} }
OSErr setImageCursor(CursorRef ref) OSErr setImageCursor(CursorRef ref)
{ {
if( ref != NULL ) if( ref != NULL )
{ {
@autoreleasepool { @autoreleasepool {
NSCursor *cursor = (NSCursor*)ref; NSCursor *cursor = (NSCursor*)ref;
[cursor set]; [cursor set];
} }
} }
else else
{ {
return paramErr; return paramErr;
} }
return noErr; return noErr;
} }
// Now for some unholy juggling between generic pointers and casting them to Obj-C objects! // Now for some unholy juggling between generic pointers and casting them to Obj-C objects!
@ -222,46 +222,46 @@ OSErr setImageCursor(CursorRef ref)
NSWindowRef createNSWindow(int x, int y, int width, int height) NSWindowRef createNSWindow(int x, int y, int width, int height)
{ {
LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height) LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height)
styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable
backing:NSBackingStoreBuffered defer:NO]; backing:NSBackingStoreBuffered defer:NO];
[window makeKeyAndOrderFront:nil]; [window makeKeyAndOrderFront:nil];
[window setAcceptsMouseMovedEvents:TRUE]; [window setAcceptsMouseMovedEvents:TRUE];
[window setRestorable:FALSE]; // Viewer manages state from own settings [window setRestorable:FALSE]; // Viewer manages state from own settings
return window; return window;
} }
GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync) GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync)
{ {
LLOpenGLView *glview = [[LLOpenGLView alloc]initWithFrame:[(LLNSWindow*)window frame] withSamples:samples andVsync:vsync]; LLOpenGLView *glview = [[LLOpenGLView alloc]initWithFrame:[(LLNSWindow*)window frame] withSamples:samples andVsync:vsync];
[(LLNSWindow*)window setContentView:glview]; [(LLNSWindow*)window setContentView:glview];
return glview; return glview;
} }
void glSwapBuffers(void* context) void glSwapBuffers(void* context)
{ {
[(NSOpenGLContext*)context flushBuffer]; [(NSOpenGLContext*)context flushBuffer];
} }
CGLContextObj getCGLContextObj(GLViewRef view) CGLContextObj getCGLContextObj(GLViewRef view)
{ {
return [(LLOpenGLView *)view getCGLContextObj]; return [(LLOpenGLView *)view getCGLContextObj];
} }
CGLPixelFormatObj* getCGLPixelFormatObj(NSWindowRef window) CGLPixelFormatObj* getCGLPixelFormatObj(NSWindowRef window)
{ {
LLOpenGLView *glview = [(LLNSWindow*)window contentView]; LLOpenGLView *glview = [(LLNSWindow*)window contentView];
return [glview getCGLPixelFormatObj]; return [glview getCGLPixelFormatObj];
} }
unsigned long getVramSize(GLViewRef view) unsigned long getVramSize(GLViewRef view)
{ {
return [(LLOpenGLView *)view getVramSize]; return [(LLOpenGLView *)view getVramSize];
} }
float getDeviceUnitSize(GLViewRef view) float getDeviceUnitSize(GLViewRef view)
{ {
return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width; return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width;
} }
CGRect getContentViewRect(NSWindowRef window) CGRect getContentViewRect(NSWindowRef window)
@ -276,48 +276,48 @@ CGRect getBackingViewRect(NSWindowRef window, GLViewRef view)
void getWindowSize(NSWindowRef window, float* size) void getWindowSize(NSWindowRef window, float* size)
{ {
NSRect frame = [(LLNSWindow*)window frame]; NSRect frame = [(LLNSWindow*)window frame];
size[0] = frame.origin.x; size[0] = frame.origin.x;
size[1] = frame.origin.y; size[1] = frame.origin.y;
size[2] = frame.size.width; size[2] = frame.size.width;
size[3] = frame.size.height; size[3] = frame.size.height;
} }
void setWindowSize(NSWindowRef window, int width, int height) void setWindowSize(NSWindowRef window, int width, int height)
{ {
NSRect frame = [(LLNSWindow*)window frame]; NSRect frame = [(LLNSWindow*)window frame];
frame.size.width = width; frame.size.width = width;
frame.size.height = height; frame.size.height = height;
[(LLNSWindow*)window setFrame:frame display:TRUE]; [(LLNSWindow*)window setFrame:frame display:TRUE];
} }
void setWindowPos(NSWindowRef window, float* pos) void setWindowPos(NSWindowRef window, float* pos)
{ {
NSPoint point; NSPoint point;
point.x = pos[0]; point.x = pos[0];
point.y = pos[1]; point.y = pos[1];
[(LLNSWindow*)window setFrameOrigin:point]; [(LLNSWindow*)window setFrameOrigin:point];
} }
void getCursorPos(NSWindowRef window, float* pos) void getCursorPos(NSWindowRef window, float* pos)
{ {
NSPoint mLoc; NSPoint mLoc;
mLoc = [(LLNSWindow*)window mouseLocationOutsideOfEventStream]; mLoc = [(LLNSWindow*)window mouseLocationOutsideOfEventStream];
pos[0] = mLoc.x; pos[0] = mLoc.x;
pos[1] = mLoc.y; pos[1] = mLoc.y;
} }
void makeWindowOrderFront(NSWindowRef window) void makeWindowOrderFront(NSWindowRef window)
{ {
[(LLNSWindow*)window makeKeyAndOrderFront:nil]; [(LLNSWindow*)window makeKeyAndOrderFront:nil];
} }
void convertScreenToWindow(NSWindowRef window, float *coord) void convertScreenToWindow(NSWindowRef window, float *coord)
{ {
NSRect point = NSMakeRect(coord[0], coord[1], 0,0); NSRect point = NSMakeRect(coord[0], coord[1], 0,0);
point = [(LLNSWindow*)window convertRectFromScreen:point]; point = [(LLNSWindow*)window convertRectFromScreen:point];
coord[0] = point.origin.x; coord[0] = point.origin.x;
coord[1] = point.origin.y; coord[1] = point.origin.y;
} }
void convertRectToScreen(NSWindowRef window, float *coord) void convertRectToScreen(NSWindowRef window, float *coord)
@ -325,21 +325,21 @@ void convertRectToScreen(NSWindowRef window, float *coord)
NSRect rect = NSMakeRect(coord[0], coord[1], coord[2], coord[3]);; NSRect rect = NSMakeRect(coord[0], coord[1], coord[2], coord[3]);;
rect = [(LLNSWindow*)window convertRectToScreen:rect]; rect = [(LLNSWindow*)window convertRectToScreen:rect];
coord[0] = rect.origin.x; coord[0] = rect.origin.x;
coord[1] = rect.origin.y; coord[1] = rect.origin.y;
coord[2] = rect.size.width; coord[2] = rect.size.width;
coord[3] = rect.size.height; coord[3] = rect.size.height;
} }
void convertRectFromScreen(NSWindowRef window, float *coord) void convertRectFromScreen(NSWindowRef window, float *coord)
{ {
NSRect point = NSMakeRect(coord[0], coord[1], coord[2], coord[3]); NSRect point = NSMakeRect(coord[0], coord[1], coord[2], coord[3]);
point = [(LLNSWindow*)window convertRectFromScreen:point]; point = [(LLNSWindow*)window convertRectFromScreen:point];
coord[0] = point.origin.x; coord[0] = point.origin.x;
coord[1] = point.origin.y; coord[1] = point.origin.y;
coord[2] = point.size.width; coord[2] = point.size.width;
coord[3] = point.size.height; coord[3] = point.size.height;
} }
void convertWindowToScreen(NSWindowRef window, float *coord) void convertWindowToScreen(NSWindowRef window, float *coord)
@ -353,24 +353,24 @@ void convertWindowToScreen(NSWindowRef window, float *coord)
void closeWindow(NSWindowRef window) void closeWindow(NSWindowRef window)
{ {
[(LLNSWindow*)window close]; [(LLNSWindow*)window close];
[(LLNSWindow*)window release]; [(LLNSWindow*)window release];
} }
void removeGLView(GLViewRef view) void removeGLView(GLViewRef view)
{ {
[(LLOpenGLView*)view clearGLContext]; [(LLOpenGLView*)view clearGLContext];
[(LLOpenGLView*)view removeFromSuperview]; [(LLOpenGLView*)view removeFromSuperview];
} }
void setupInputWindow(NSWindowRef window, GLViewRef glview) void setupInputWindow(NSWindowRef window, GLViewRef glview)
{ {
[[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview]; [[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview];
} }
void commitCurrentPreedit(GLViewRef glView) void commitCurrentPreedit(GLViewRef glView)
{ {
[(LLOpenGLView*)glView commitCurrentPreedit]; [(LLOpenGLView*)glView commitCurrentPreedit];
} }
void allowDirectMarkedTextInput(bool allow, GLViewRef glView) void allowDirectMarkedTextInput(bool allow, GLViewRef glView)
@ -380,20 +380,20 @@ void allowDirectMarkedTextInput(bool allow, GLViewRef glView)
NSWindowRef getMainAppWindow() NSWindowRef getMainAppWindow()
{ {
LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window];
[winRef setAcceptsMouseMovedEvents:TRUE]; [winRef setAcceptsMouseMovedEvents:TRUE];
return winRef; return winRef;
} }
void makeFirstResponder(NSWindowRef window, GLViewRef view) void makeFirstResponder(NSWindowRef window, GLViewRef view)
{ {
[(LLNSWindow*)window makeFirstResponder:(LLOpenGLView*)view]; [(LLNSWindow*)window makeFirstResponder:(LLOpenGLView*)view];
} }
void requestUserAttention() void requestUserAttention()
{ {
[[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest]; [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest];
} }
long showAlert(std::string text, std::string title, int type) long showAlert(std::string text, std::string title, int type)
@ -401,7 +401,7 @@ long showAlert(std::string text, std::string title, int type)
long ret = 0; long ret = 0;
@autoreleasepool { @autoreleasepool {
NSAlert *alert = [[[NSAlert alloc] init] autorelease]; NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]];
[alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]];
if (type == 0) if (type == 0)
@ -418,7 +418,7 @@ long showAlert(std::string text, std::string title, int type)
} }
ret = [alert runModal]; ret = [alert runModal];
} }
if (ret == NSAlertFirstButtonReturn) if (ret == NSAlertFirstButtonReturn)
{ {
if (type == 1) if (type == 1)
@ -438,7 +438,7 @@ long showAlert(std::string text, std::string title, int type)
ret = 1; ret = 1;
} }
} }
return ret; return ret;
} }
@ -451,13 +451,13 @@ long showAlert(std::string text, std::string title, int type)
unsigned int getModifiers() unsigned int getModifiers()
{ {
return [NSEvent modifierFlags]; return [NSEvent modifierFlags];
} }
// <FS:CR> Set Window Title - sigh. // <FS:CR> Set Window Title - sigh.
void setTitleCocoa(NSWindowRef window, const std::string &title) void setTitleCocoa(NSWindowRef window, const std::string &title)
{ {
NSString *str = [NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]; NSString *str = [NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]];
[(LLNSWindow*)window setTitle:str]; [(LLNSWindow*)window setTitle:str];
} }
// </FS:CR> // </FS:CR>

View File

@ -56,11 +56,7 @@ include(ColladaDom)
include(jemalloc) include(jemalloc)
include(Discord) include(Discord)
# <FS:ND> if using ndPhysicsstub this variable will be unset, we don't need to build any stub code viewer side in that case if (HAVOK)
if (LLPHYSICSEXTENSIONS_SRC_DIR)
# </FS:ND>
if (NOT HAVOK_TPV)
# When using HAVOK_TPV, the library is precompiled, so no need for this # When using HAVOK_TPV, the library is precompiled, so no need for this
# Stub and probably havok lib itself is a hack, autobuild loads a 3p that really is a source tarball # Stub and probably havok lib itself is a hack, autobuild loads a 3p that really is a source tarball
@ -86,11 +82,7 @@ if (NOT HAVOK_TPV)
target_compile_options( llphysicsextensions PRIVATE -Wno-unused-local-typedef) target_compile_options( llphysicsextensions PRIVATE -Wno-unused-local-typedef)
endif (DARWIN) endif (DARWIN)
endif() endif()
endif (NOT HAVOK_TPV) endif ()
# <FS:ND>
endif (LLPHYSICSEXTENSIONS_SRC_DIR)
# </FS:ND>
set(viewer_SOURCE_FILES set(viewer_SOURCE_FILES
# <Add FS includes below this line> # <Add FS includes below this line>
@ -2511,20 +2503,30 @@ elseif (DARWIN)
# otherwise occurs when upscaling the viewer to Retina resolution levels. # otherwise occurs when upscaling the viewer to Retina resolution levels.
LINK_FLAGS_RELEASE "${LINK_FLAGS_RELEASE} -Xlinker -platform_version -Xlinker macos -Xlinker ${CMAKE_OSX_DEPLOYMENT_TARGET} -Xlinker 10.12" LINK_FLAGS_RELEASE "${LINK_FLAGS_RELEASE} -Xlinker -platform_version -Xlinker macos -Xlinker ${CMAKE_OSX_DEPLOYMENT_TARGET} -Xlinker 10.12"
# <FS:TJ> We can only do these if building with Havok
) )
if(HAVOK OR HAVOK_TPV) if(HAVOK)
set_target_properties(${VIEWER_BINARY_NAME} set_target_properties(${VIEWER_BINARY_NAME}
PROPERTIES PROPERTIES
# arch specific flags for universal builds: https://stackoverflow.com/a/77942065 # arch specific flags for universal builds: https://stackoverflow.com/a/77942065
XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=x86_64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_FULL" XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=x86_64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_FULL -DLL_HAVOK=1"
XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=arm64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_STUB" XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=arm64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_STUB"
# only generate the .MAP file for llphysicsextensions_tpv on x86_64 # only generate the .MAP file for llphysicsextensions_tpv on x86_64
XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "$(inherited) -L${CMAKE_CURRENT_BINARY_DIR}/llphysicsextensions/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensions -Xlinker -map -Xlinker ${CMAKE_CURRENT_BINARY_DIR}/${VIEWER_BINARY_NAME}.MAP" XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "$(inherited) -L${CMAKE_CURRENT_BINARY_DIR}/llphysicsextensions/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensions -Xlinker -map -Xlinker ${CMAKE_CURRENT_BINARY_DIR}/${VIEWER_BINARY_NAME}.MAP"
XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=arm64] "$(inherited) -L${CMAKE_CURRENT_BINARY_DIR}/llphysicsextensionsstub/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensionsstub" XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=arm64] "$(inherited) -L${CMAKE_BINARY_DIR}/llphysicsextensionsos/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensionsos"
) )
elseif(HAVOK_TPV)
set_target_properties(${VIEWER_BINARY_NAME}
PROPERTIES
# arch specific flags for universal builds: https://stackoverflow.com/a/77942065
XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=x86_64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_FULL -DLL_HAVOK=1"
XCODE_ATTRIBUTE_OTHER_CFLAGS[arch=arm64] "$(inherited) -DLLPHYSICSEXTENSIONS_USE_STUB"
# only generate the .MAP file for llphysicsextensions_tpv on x86_64
XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=x86_64] "$(inherited) -L${ARCH_PREBUILT_DIRS}/ -lllphysicsextensions_tpv"
XCODE_ATTRIBUTE_OTHER_LDFLAGS[arch=arm64] "$(inherited) -L${CMAKE_BINARY_DIR}/llphysicsextensionsos/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,$<CONFIG>,${CMAKE_CFG_INTDIR}>/ -lllphysicsextensionsos"
)
else()
target_link_libraries(${VIEWER_BINARY_NAME} llphysicsextensionsos)
endif() endif()
# </FS:TJ>
else (WINDOWS) else (WINDOWS)
# Linux # Linux
set_target_properties(${VIEWER_BINARY_NAME} set_target_properties(${VIEWER_BINARY_NAME}

View File

@ -57,42 +57,42 @@
- (void) applicationDidFinishLaunching:(NSNotification *)notification - (void) applicationDidFinishLaunching:(NSNotification *)notification
{ {
// Call constructViewer() first so our logging subsystem is in place. This // Call constructViewer() first so our logging subsystem is in place. This
// risks missing crashes in the LLAppViewerMacOSX constructor, but for // risks missing crashes in the LLAppViewerMacOSX constructor, but for
// present purposes it's more important to get the startup sequence // present purposes it's more important to get the startup sequence
// properly logged. // properly logged.
// Someday I would like to modify the logging system so that calls before // Someday I would like to modify the logging system so that calls before
// it's initialized are cached in a std::ostringstream and then, once it's // it's initialized are cached in a std::ostringstream and then, once it's
// initialized, "played back" into whatever handlers have been set up. // initialized, "played back" into whatever handlers have been set up.
constructViewer(); constructViewer();
#if defined(LL_BUGSPLAT) #if defined(LL_BUGSPLAT)
infos("bugsplat setup"); infos("bugsplat setup");
// Engage BugsplatStartupManager *before* calling initViewer() to handle // Engage BugsplatStartupManager *before* calling initViewer() to handle
// any crashes during initialization. // any crashes during initialization.
// https://www.bugsplat.com/docs/platforms/os-x#initialization // https://www.bugsplat.com/docs/platforms/os-x#initialization
[BugsplatStartupManager sharedManager].autoSubmitCrashReport = NO; [BugsplatStartupManager sharedManager].autoSubmitCrashReport = NO;
[BugsplatStartupManager sharedManager].askUserDetails = YES; [BugsplatStartupManager sharedManager].askUserDetails = YES;
[BugsplatStartupManager sharedManager].delegate = self; [BugsplatStartupManager sharedManager].delegate = self;
[[BugsplatStartupManager sharedManager] start]; [[BugsplatStartupManager sharedManager] start];
#endif #endif
infos("post-bugsplat setup"); infos("post-bugsplat setup");
frameTimer = nil; frameTimer = nil;
[self languageUpdated]; [self languageUpdated];
if (initViewer()) if (initViewer())
{ {
// Set up recurring calls to oneFrame (repeating timer with timeout 0) // Set up recurring calls to oneFrame (repeating timer with timeout 0)
// until applicationShouldTerminate. // until applicationShouldTerminate.
frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self
selector:@selector(oneFrame) userInfo:nil repeats:YES]; selector:@selector(oneFrame) userInfo:nil repeats:YES];
} else { } else {
exit(0); exit(0);
} }
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(languageUpdated) name:@"NSTextInputContextKeyboardSelectionDidChangeNotification" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(languageUpdated) name:@"NSTextInputContextKeyboardSelectionDidChangeNotification" object:nil];
// [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; // [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
} }
@ -110,74 +110,74 @@
- (void) applicationDidBecomeActive:(NSNotification *)notification - (void) applicationDidBecomeActive:(NSNotification *)notification
{ {
callWindowFocus(); callWindowFocus();
} }
- (void) applicationDidResignActive:(NSNotification *)notification - (void) applicationDidResignActive:(NSNotification *)notification
{ {
callWindowUnfocus(); callWindowUnfocus();
} }
- (void) applicationDidHide:(NSNotification *)notification - (void) applicationDidHide:(NSNotification *)notification
{ {
callWindowHide(); callWindowHide();
} }
- (void) applicationDidUnhide:(NSNotification *)notification - (void) applicationDidUnhide:(NSNotification *)notification
{ {
callWindowUnhide(); callWindowUnhide();
} }
- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender - (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
{ {
// run one frame to assess state // run one frame to assess state
if (!pumpMainLoop()) if (!pumpMainLoop())
{ {
// pumpMainLoop() returns true when done, false if it wants to be // pumpMainLoop() returns true when done, false if it wants to be
// called again. Since it returned false, do not yet cancel // called again. Since it returned false, do not yet cancel
// frameTimer. // frameTimer.
handleQuit(); handleQuit();
[[NSApplication sharedApplication] stopModal]; [[NSApplication sharedApplication] stopModal];
return NSTerminateCancel; return NSTerminateCancel;
} else { } else {
// pumpMainLoop() returned true: it's done. Okay, done with frameTimer. // pumpMainLoop() returned true: it's done. Okay, done with frameTimer.
[frameTimer release]; [frameTimer release];
cleanupViewer(); cleanupViewer();
return NSTerminateNow; return NSTerminateNow;
} }
} }
- (void) oneFrame - (void) oneFrame
{ {
bool appExiting = pumpMainLoop(); bool appExiting = pumpMainLoop();
if (appExiting) if (appExiting)
{ {
// Once pumpMainLoop() reports that we're done, cancel frameTimer: // Once pumpMainLoop() reports that we're done, cancel frameTimer:
// stop the repetitive calls. // stop the repetitive calls.
[frameTimer release]; [frameTimer release];
[[LLApplication sharedApplication] terminate:self]; [[LLApplication sharedApplication] terminate:self];
} }
} }
- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent - (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent
{ {
if (![self romanScript]) if (![self romanScript])
{ {
if (show) if (show)
{ {
NSLog(@"Showing input window."); NSLog(@"Showing input window.");
[inputWindow makeKeyAndOrderFront:inputWindow]; [inputWindow makeKeyAndOrderFront:inputWindow];
if (textEvent != nil) if (textEvent != nil)
{ {
[[inputView inputContext] discardMarkedText]; [[inputView inputContext] discardMarkedText];
[[inputView inputContext] handleEvent:textEvent]; [[inputView inputContext] handleEvent:textEvent];
} }
} else { } else {
NSLog(@"Hiding input window."); NSLog(@"Hiding input window.");
[inputWindow orderOut:inputWindow]; [inputWindow orderOut:inputWindow];
[window makeKeyAndOrderFront:window]; [window makeKeyAndOrderFront:window];
} }
} }
} }
// This will get called multiple times by NSNotificationCenter. // This will get called multiple times by NSNotificationCenter.
@ -187,15 +187,15 @@
- (void) languageUpdated - (void) languageUpdated
{ {
TISInputSourceRef currentInput = TISCopyCurrentKeyboardInputSource(); TISInputSourceRef currentInput = TISCopyCurrentKeyboardInputSource();
CFArrayRef languages = (CFArrayRef)TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages); CFArrayRef languages = (CFArrayRef)TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages);
#if 0 // In the event of ever needing to add new language sources, change this to 1 and watch the terminal for "languages:" #if 0 // In the event of ever needing to add new language sources, change this to 1 and watch the terminal for "languages:"
NSLog(@"languages: %@", TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages)); NSLog(@"languages: %@", TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages));
#endif #endif
// Typically the language we want is going to be the very first result in the array. // Typically the language we want is going to be the very first result in the array.
currentInputLanguage = (NSString*)CFArrayGetValueAtIndex(languages, 0); currentInputLanguage = (NSString*)CFArrayGetValueAtIndex(languages, 0);
} }
- (bool) romanScript - (bool) romanScript
@ -209,7 +209,7 @@
return false; return false;
} }
} }
return true; return true;
} }
@ -314,11 +314,11 @@ struct AttachmentInfo
// We "happen to know" that info[0].basename is "SecondLife.old" -- due to // We "happen to know" that info[0].basename is "SecondLife.old" -- due to
// the fact that BugsplatMac only notices a crash during the viewer run // the fact that BugsplatMac only notices a crash during the viewer run
// following the crash. // following the crash.
// The Bugsplat service doesn't respect the MIME type above when returning // The Bugsplat service doesn't respect the MIME type above when returning
// the log data to a browser, so take this opportunity to rename the file // the log data to a browser, so take this opportunity to rename the file
// from <base>.old to <base>_log.txt // from <base>.old to <base>_log.txt
// info[0].basename = // info[0].basename =
// boost::filesystem::path(info[0].pathname).stem().string() + "_log.txt"; // boost::filesystem::path(info[0].pathname).stem().string() + "_log.txt";
// infos("attachmentsForBugsplatStartupManager attaching log " + info[0].basename); // infos("attachmentsForBugsplatStartupManager attaching log " + info[0].basename);
@ -377,7 +377,7 @@ std::string bar = std::string([pStr UTF8String]);
{ {
[super sendEvent:event]; [super sendEvent:event];
if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand)) if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand))
{ {
[[self keyWindow] sendEvent:event]; [[self keyWindow] sendEvent:event];
} }
} }

View File

@ -5,27 +5,27 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; * License as published by the Free Software Foundation;
* version 2.1 of the License only. * version 2.1 of the License only.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#if !defined LL_DARWIN #if !defined LL_DARWIN
#error "Use only with macOS" #error "Use only with macOS"
#endif #endif
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -1,25 +1,25 @@
/** /**
* @file llfilepicker_mac.cpp * @file llfilepicker_mac.cpp
* @brief OS-specific file picker * @brief OS-specific file picker
* *
* $LicenseInfo:firstyear=2001&license=viewerlgpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2010, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; * License as published by the Free Software Foundation;
* version 2.1 of the License only. * version 2.1 of the License only.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@ -32,15 +32,15 @@
NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned int flags) NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned int flags)
{ {
int i; int i;
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
NSMutableArray *fileTypes = nil; NSMutableArray *fileTypes = nil;
if ( allowed_types && !allowed_types->empty()) if ( allowed_types && !allowed_types->empty())
{ {
fileTypes = [[NSMutableArray alloc] init]; fileTypes = [[NSMutableArray alloc] init];
for (i=0;i<allowed_types->size();++i) for (i=0;i<allowed_types->size();++i)
{ {
[fileTypes addObject: [fileTypes addObject:
@ -48,7 +48,7 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
encoding:[NSString defaultCStringEncoding]]]; encoding:[NSString defaultCStringEncoding]]];
} }
} }
//[panel setMessage:@"Import one or more files or directories."]; //[panel setMessage:@"Import one or more files or directories."];
[panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ]; [panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ];
[panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ]; [panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ];
@ -56,7 +56,7 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
[panel setResolvesAliases: true]; [panel setResolvesAliases: true];
[panel setCanChooseFiles: ( (flags & F_FILE)?true:false )]; [panel setCanChooseFiles: ( (flags & F_FILE)?true:false )];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
if (fileTypes) if (fileTypes)
{ {
[panel setAllowedFileTypes:fileTypes]; [panel setAllowedFileTypes:fileTypes];
@ -77,7 +77,7 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
std::unique_ptr<std::vector<std::string>> outfiles; std::unique_ptr<std::vector<std::string>> outfiles;
@autoreleasepool @autoreleasepool
{ {
int result; int result;
//Aura TODO: We could init a small window and release it at the end of this routine //Aura TODO: We could init a small window and release it at the end of this routine
//for a modeless interface. //for a modeless interface.
@ -85,17 +85,17 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
NSOpenPanel *panel = init_panel(allowed_types,flags); NSOpenPanel *panel = init_panel(allowed_types,flags);
result = [panel runModal]; result = [panel runModal];
if (result == NSModalResponseOK) if (result == NSModalResponseOK)
{ {
NSArray *filesToOpen = [panel URLs]; NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count]; int i, count = [filesToOpen count];
if (count > 0) if (count > 0)
{ {
outfiles.reset(new std::vector<std::string>); outfiles.reset(new std::vector<std::string>);
} }
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
NSString *aFile = [[filesToOpen objectAtIndex:i] path]; NSString *aFile = [[filesToOpen objectAtIndex:i] path];
std::string afilestr = std::string([aFile UTF8String]); std::string afilestr = std::string([aFile UTF8String]);
@ -113,11 +113,11 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
{ {
@autoreleasepool @autoreleasepool
{ {
// Note: might need to return and save this panel // Note: might need to return and save this panel
// so that it does not close immediately // so that it does not close immediately
NSOpenPanel *panel = init_panel(allowed_types,flags); NSOpenPanel *panel = init_panel(allowed_types,flags);
[panel beginWithCompletionHandler:^(NSModalResponse result) [panel beginWithCompletionHandler:^(NSModalResponse result)
{ {
std::vector<std::string> outfiles; std::vector<std::string> outfiles;
@ -125,10 +125,10 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
{ {
NSArray *filesToOpen = [panel URLs]; NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count]; int i, count = [filesToOpen count];
if (count > 0) if (count > 0)
{ {
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
NSString *aFile = [[filesToOpen objectAtIndex:i] path]; NSString *aFile = [[filesToOpen objectAtIndex:i] path];
std::string *afilestr = new std::string([aFile UTF8String]); std::string *afilestr = new std::string([aFile UTF8String]);
@ -149,7 +149,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
} }
} }
std::unique_ptr<std::string> doSaveDialog(const std::string* file, std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type, const std::string* type,
const std::string* creator, const std::string* creator,
const std::string* extension, const std::string* extension,
@ -157,18 +157,18 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
{ {
std::unique_ptr<std::string> outfile; std::unique_ptr<std::string> outfile;
@autoreleasepool @autoreleasepool
{ {
NSSavePanel *panel = [NSSavePanel savePanel]; NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]]; NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","]; NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"]; //[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true]; [panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType]; [panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]]; NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName]; NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName]; [panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url]; [panel setDirectoryURL: url];
@ -193,39 +193,39 @@ void doSaveDialogModeless(const std::string* file,
void *userdata) void *userdata)
{ {
@autoreleasepool { @autoreleasepool {
NSSavePanel *panel = [NSSavePanel savePanel]; NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]]; NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","]; NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"]; //[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ]; [panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true]; [panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType]; [panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]]; NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName]; NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName]; [panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url]; [panel setDirectoryURL: url];
[panel beginWithCompletionHandler:^(NSModalResponse result) [panel beginWithCompletionHandler:^(NSModalResponse result)
{ {
if (result == NSModalResponseOK) if (result == NSModalResponseOK)
{ {
NSURL* url = [panel URL]; NSURL* url = [panel URL];
NSString* p = [url path]; NSString* p = [url path];
std::string outfile([p UTF8String]); std::string outfile([p UTF8String]);
callback(true, outfile, userdata); callback(true, outfile, userdata);
} }
else // cancel else // cancel
{ {
std::string outfile; std::string outfile;
callback(false, outfile, userdata); callback(false, outfile, userdata);
} }
}]; }];
} }
} }
#endif #endif

View File

@ -5263,7 +5263,7 @@ void LLRiggedVolume::update(
else else
{ {
face_begin = face_index; face_begin = face_index;
face_end = face_begin + 1; face_end = llmin(face_begin + 1, volume->getNumVolumeFaces());
} }
for (S32 i = face_begin; i < face_end; ++i) for (S32 i = face_begin; i < face_end; ++i)
{ {

View File

@ -70,7 +70,7 @@ def process_directory(directory, extensions, tab_stop):
def main(): def main():
parser = argparse.ArgumentParser(description='Convert tabs to spaces in files, considering tab stops.') parser = argparse.ArgumentParser(description='Convert tabs to spaces in files, considering tab stops.')
parser.add_argument('-e', '--extensions', type=str, default='c,cpp,h,hpp,inl,py,glsl,cmake', help='Comma-separated list of file extensions to process (default: "c,cpp,h,hpp,inl,py,glsl,cmake")') parser.add_argument('-e', '--extensions', type=str, default='c,cpp,m,mm,h,hpp,inl,py,glsl,cmake', help='Comma-separated list of file extensions to process (default: "c,cpp,h,hpp,inl,py,glsl,cmake")')
parser.add_argument('-t', '--tabstop', type=int, default=4, help='Tab stop size (default: 4)') parser.add_argument('-t', '--tabstop', type=int, default=4, help='Tab stop size (default: 4)')
parser.add_argument('-d', '--directory', type=str, required=True, help='Directory to process') parser.add_argument('-d', '--directory', type=str, required=True, help='Directory to process')