mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 10:53:34 +02:00
Merge branch 'master' into fixMainTextContainerQML
This commit is contained in:
commit
189e7e15fe
119 changed files with 4906 additions and 3005 deletions
android
app/src/main
AndroidManifest.xml
build.gradlecpp
java/io/highfidelity/hifiinterface
res
interface
resources
src
AndroidHelper.cppAndroidHelper.hApplication.cppApplication.hConnectionMonitor.cppConnectionMonitor.h
avatar
commerce
main.cppraypick
scripting
ui
libraries
animation/src
audio-client/src
audio/src
avatars/src
entities-renderer/src
entities/src
gpu-gl/src/gpu/gl41
networking/src
AccountManager.cppAccountManager.hAddressManager.hDomainHandler.cppDomainHandler.hNetworkingConstants.h
pointers/src
render-utils/src
Highlight.slhHighlightEffect.cppHighlightEffect.hHighlight_aabox.slvModel.cppModel.hparabola_translucent.slf
render-utils
script-engine/src
shared/src
scripts
modules
system
|
@ -9,6 +9,7 @@
|
|||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>
|
||||
|
||||
|
@ -75,6 +76,15 @@
|
|||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:process=":breakpad_uploader"/>
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.HeadsetStateReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.HEADSET_PLUG" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
<uses-feature android:name="android.software.vr.mode" android:required="true"/>
|
||||
|
|
|
@ -355,5 +355,51 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_WebViewActivity_nativeProcessU
|
|||
AndroidHelper::instance().processURL(QString::fromUtf8(nativeString));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_io_highfidelity_hifiinterface_fragment_SettingsFragment_updateHifiSetting(JNIEnv *env,
|
||||
jobject instance,
|
||||
jstring group_,
|
||||
jstring key_,
|
||||
jboolean value_) {
|
||||
const char *c_group = env->GetStringUTFChars(group_, 0);
|
||||
const char *c_key = env->GetStringUTFChars(key_, 0);
|
||||
|
||||
const QString group = QString::fromUtf8(c_group);
|
||||
const QString key = QString::fromUtf8(c_key);
|
||||
|
||||
env->ReleaseStringUTFChars(group_, c_group);
|
||||
env->ReleaseStringUTFChars(key_, c_key);
|
||||
|
||||
bool value = value_;
|
||||
|
||||
Setting::Handle<bool> setting { QStringList() << group << key , !value };
|
||||
setting.set(value);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_io_highfidelity_hifiinterface_fragment_SettingsFragment_getHifiSettingBoolean(JNIEnv *env,
|
||||
jobject instance,
|
||||
jstring group_,
|
||||
jstring key_,
|
||||
jboolean defaultValue) {
|
||||
const char *c_group = env->GetStringUTFChars(group_, 0);
|
||||
const char *c_key = env->GetStringUTFChars(key_, 0);
|
||||
|
||||
const QString group = QString::fromUtf8(c_group);
|
||||
const QString key = QString::fromUtf8(c_key);
|
||||
|
||||
env->ReleaseStringUTFChars(group_, c_group);
|
||||
env->ReleaseStringUTFChars(key_, c_key);
|
||||
|
||||
Setting::Handle<bool> setting { QStringList() << group << key , defaultValue};
|
||||
return setting.get();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_io_highfidelity_hifiinterface_receiver_HeadsetStateReceiver_notifyHeadsetOn(JNIEnv *env,
|
||||
jobject instance,
|
||||
jboolean pluggedIn) {
|
||||
AndroidHelper::instance().notifyHeadsetOn(pluggedIn);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package io.highfidelity.hifiinterface;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -40,6 +41,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import io.highfidelity.hifiinterface.fragment.WebViewFragment;
|
||||
import io.highfidelity.hifiinterface.receiver.HeadsetStateReceiver;
|
||||
|
||||
/*import com.google.vr.cardboard.DisplaySynchronizer;
|
||||
import com.google.vr.cardboard.DisplayUtils;
|
||||
|
@ -55,6 +57,7 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
private static final int NORMAL_DPI = 160;
|
||||
|
||||
private Vibrator mVibrator;
|
||||
private HeadsetStateReceiver headsetStateReceiver;
|
||||
|
||||
//public static native void handleHifiURL(String hifiURLString);
|
||||
private native long nativeOnCreate(InterfaceActivity instance, AssetManager assetManager);
|
||||
|
@ -151,6 +154,8 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
layoutParams.resolveLayoutDirection(View.LAYOUT_DIRECTION_RTL);
|
||||
qtLayout.addView(webSlidingDrawer, layoutParams);
|
||||
webSlidingDrawer.setVisibility(View.GONE);
|
||||
|
||||
headsetStateReceiver = new HeadsetStateReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,6 +166,7 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
} else {
|
||||
nativeEnterBackground();
|
||||
}
|
||||
unregisterReceiver(headsetStateReceiver);
|
||||
//gvrApi.pauseTracking();
|
||||
}
|
||||
|
||||
|
@ -183,6 +189,7 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
nativeEnterForeground();
|
||||
surfacesWorkaround();
|
||||
keepInterfaceRunning = false;
|
||||
registerReceiver(headsetStateReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
|
||||
//gvrApi.resumeTracking();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import io.highfidelity.hifiinterface.fragment.FriendsFragment;
|
|||
import io.highfidelity.hifiinterface.fragment.HomeFragment;
|
||||
import io.highfidelity.hifiinterface.fragment.LoginFragment;
|
||||
import io.highfidelity.hifiinterface.fragment.PolicyFragment;
|
||||
import io.highfidelity.hifiinterface.fragment.SettingsFragment;
|
||||
import io.highfidelity.hifiinterface.task.DownloadProfileImageTask;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener,
|
||||
|
@ -80,6 +81,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
mPeopleMenuItem = mNavigationView.getMenu().findItem(R.id.action_people);
|
||||
|
||||
updateDebugMenu(mNavigationView.getMenu());
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
toolbar.setTitleTextAppearance(this, R.style.HomeActionBarTitleStyle);
|
||||
setSupportActionBar(toolbar);
|
||||
|
@ -108,6 +111,16 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
}
|
||||
}
|
||||
|
||||
private void updateDebugMenu(Menu menu) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
for (int i=0; i < menu.size(); i++) {
|
||||
if (menu.getItem(i).getItemId() == R.id.action_debug_settings) {
|
||||
menu.getItem(i).setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFragment(String fragment) {
|
||||
switch (fragment) {
|
||||
case "Login":
|
||||
|
@ -151,6 +164,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
loadFragment(fragment, getString(R.string.people), getString(R.string.tagFragmentPeople), true);
|
||||
}
|
||||
|
||||
private void loadSettingsFragment() {
|
||||
SettingsFragment fragment = SettingsFragment.newInstance();
|
||||
|
||||
loadFragment(fragment, getString(R.string.settings), getString(R.string.tagSettings), true);
|
||||
}
|
||||
|
||||
|
||||
private void loadFragment(Fragment fragment, String title, String tag, boolean addToBackStack) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
|
||||
|
@ -241,6 +261,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
case R.id.action_people:
|
||||
loadPeopleFragment();
|
||||
return true;
|
||||
case R.id.action_debug_settings:
|
||||
loadSettingsFragment();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package io.highfidelity.hifiinterface.fragment;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.audiofx.AcousticEchoCanceler;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import io.highfidelity.hifiinterface.R;
|
||||
|
||||
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
public native void updateHifiSetting(String group, String key, boolean value);
|
||||
public native boolean getHifiSettingBoolean(String group, String key, boolean defaultValue);
|
||||
|
||||
private final String HIFI_SETTINGS_ANDROID_GROUP = "Android";
|
||||
private final String HIFI_SETTINGS_AEC_KEY = "aec";
|
||||
private final String PREFERENCE_KEY_AEC = "aec";
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings);
|
||||
|
||||
if (!AcousticEchoCanceler.isAvailable()) {
|
||||
getPreferenceScreen().getPreferenceManager().findPreference("aec").setEnabled(false);
|
||||
}
|
||||
|
||||
getPreferenceScreen().getSharedPreferences().edit().putBoolean(PREFERENCE_KEY_AEC,
|
||||
getHifiSettingBoolean(HIFI_SETTINGS_ANDROID_GROUP, HIFI_SETTINGS_AEC_KEY, false));
|
||||
}
|
||||
|
||||
public static SettingsFragment newInstance() {
|
||||
SettingsFragment fragment = new SettingsFragment();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
Preference pref = findPreference(key);
|
||||
switch (key) {
|
||||
case "aec":
|
||||
updateHifiSetting(HIFI_SETTINGS_ANDROID_GROUP, HIFI_SETTINGS_AEC_KEY, sharedPreferences.getBoolean(key, false));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package io.highfidelity.hifiinterface.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class HeadsetStateReceiver extends BroadcastReceiver {
|
||||
|
||||
private native void notifyHeadsetOn(boolean pluggedIn);
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
notifyHeadsetOn(audioManager.isWiredHeadsetOn());
|
||||
}
|
||||
}
|
|
@ -9,4 +9,9 @@
|
|||
android:id="@+id/action_people"
|
||||
android:title="@string/people"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/action_debug_settings"
|
||||
android:title="@string/settings"
|
||||
android:visible="false"
|
||||
/>
|
||||
</menu>
|
||||
|
|
|
@ -29,4 +29,9 @@
|
|||
<string name="tagFragmentLogin">tagFragmentLogin</string>
|
||||
<string name="tagFragmentPolicy">tagFragmentPolicy</string>
|
||||
<string name="tagFragmentPeople">tagFragmentPeople</string>
|
||||
<string name="tagSettings">tagSettings</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="AEC">AEC</string>
|
||||
<string name="acoustic_echo_cancellation">Acoustic Echo Cancellation</string>
|
||||
<string name="settings_developer">Developer</string>
|
||||
</resources>
|
||||
|
|
11
android/app/src/main/res/xml/settings.xml
Normal file
11
android/app/src/main/res/xml/settings.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_developer"
|
||||
android:key="pref_key_developer">
|
||||
<SwitchPreference
|
||||
android:key="aec"
|
||||
android:title="@string/AEC"
|
||||
android:summary="@string/acoustic_echo_cancellation" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
|
@ -72,17 +72,17 @@ def jniFolder = new File(appDir, 'src/main/jniLibs/arm64-v8a')
|
|||
def baseUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/android/'
|
||||
def breakpadDumpSymsDir = new File("${appDir}/build/tmp/breakpadDumpSyms")
|
||||
|
||||
def qtFile='qt-5.11.1_linux_armv8-libcpp_openssl.tgz'
|
||||
def qtChecksum='f312c47cd8b8dbca824c32af4eec5e66'
|
||||
def qtVersionId='nyCGcb91S4QbYeJhUkawO5x1lrLdSNB_'
|
||||
def qtFile='qt-5.11.1_linux_armv8-libcpp_openssl_patched.tgz'
|
||||
def qtChecksum='aa449d4bfa963f3bc9a9dfe558ba29df'
|
||||
def qtVersionId='3S97HBM5G5Xw9EfE52sikmgdN3t6C2MN'
|
||||
if (Os.isFamily(Os.FAMILY_MAC)) {
|
||||
qtFile = 'qt-5.11.1_osx_armv8-libcpp_openssl.tgz'
|
||||
qtChecksum='a0c8b394aec5b0fcd46714ca3a53278a'
|
||||
qtVersionId='QNa.lwNJaPc0eGuIL.xZ8ebeTuLL7rh8'
|
||||
qtFile = 'qt-5.11.1_osx_armv8-libcpp_openssl_patched.tgz'
|
||||
qtChecksum='c83cc477c08a892e00c71764dca051a0'
|
||||
qtVersionId='OxBD7iKINv1HbyOXmAmDrBb8AF3N.Kup'
|
||||
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
qtFile = 'qt-5.11.1_win_armv8-libcpp_openssl.tgz'
|
||||
qtChecksum='d80aed4233ce9e222aae8376e7a94bf9'
|
||||
qtVersionId='iDVXu0i3WEXRFIxQCtzcJ2XuKrE8RIqB'
|
||||
qtFile = 'qt-5.11.1_win_armv8-libcpp_openssl_patched.tgz'
|
||||
qtChecksum='0582191cc55431aa4f660848a542883e'
|
||||
qtVersionId='JfWM0P_Mz5Qp0LwpzhrsRwN3fqlLSFeT'
|
||||
}
|
||||
|
||||
def packages = [
|
||||
|
|
57
interface/resources/icons/tablet-icons/goto-a-msg.svg
Normal file
57
interface/resources/icons/tablet-icons/goto-a-msg.svg
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 50 50"
|
||||
style="enable-background:new 0 0 50 50;"
|
||||
xml:space="preserve"
|
||||
id="svg2"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="goto-a.svg"><metadata
|
||||
id="metadata14"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs12" /><sodipodi:namedview
|
||||
pagecolor="#ff0000"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="852"
|
||||
inkscape:window-height="480"
|
||||
id="namedview10"
|
||||
showgrid="false"
|
||||
inkscape:zoom="4.72"
|
||||
inkscape:cx="25"
|
||||
inkscape:cy="25"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" /><style
|
||||
type="text/css"
|
||||
id="style4">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
</style>
|
||||
<circle class="st1" cx="44.1" cy="6" r="5.6"/>
|
||||
<g
|
||||
id="Layer_2" /><g
|
||||
id="Layer_1"
|
||||
style="fill:#000000;fill-opacity:1"><path
|
||||
class="st0"
|
||||
d="M47.2,41.3l-9.1-9.1c-0.8-0.8-1.9-1.1-3-1l-2.4-2.4c1.8-2.6,2.8-5.7,2.8-9c0-8.9-7.2-16.1-16.1-16.1 S3.3,11,3.3,19.8c0,8.9,7.2,16.1,16.1,16.1c4.1,0,7.8-1.5,10.6-4l2.2,2.2c-0.2,1.1,0.1,2.2,1,3l9.1,9.1c1.4,1.4,3.6,1.4,4.9,0 C48.5,44.9,48.5,42.7,47.2,41.3z M19.4,32.2c-6.8,0-12.3-5.5-12.3-12.3c0-6.8,5.5-12.3,12.3-12.3s12.3,5.5,12.3,12.3 C31.8,26.6,26.2,32.2,19.4,32.2z"
|
||||
id="path8"
|
||||
style="fill:#000000;fill-opacity:1" /></g></svg>
|
After (image error) Size: 2.2 KiB |
Before (image error) Size: 911 B After (image error) Size: 911 B |
83
interface/resources/icons/tablet-icons/people-a-msg.svg
Normal file
83
interface/resources/icons/tablet-icons/people-a-msg.svg
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 50 50"
|
||||
style="enable-background:new 0 0 50 50;"
|
||||
xml:space="preserve"
|
||||
id="svg2"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="people-a.svg"><metadata
|
||||
id="metadata24"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs22" /><sodipodi:namedview
|
||||
pagecolor="#ff0000"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="852"
|
||||
inkscape:window-height="480"
|
||||
id="namedview20"
|
||||
showgrid="false"
|
||||
inkscape:zoom="4.72"
|
||||
inkscape:cx="25"
|
||||
inkscape:cy="25"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" /><style
|
||||
type="text/css"
|
||||
id="style4">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
</style>
|
||||
<circle class="st1" cx="44.1" cy="6" r="5.6"/>
|
||||
<g
|
||||
id="Layer_2" /><g
|
||||
id="Layer_1"
|
||||
style="fill:#000000;fill-opacity:1"><circle
|
||||
class="st0"
|
||||
cx="25.6"
|
||||
cy="14.8"
|
||||
r="8.1"
|
||||
id="circle8"
|
||||
style="fill:#000000;fill-opacity:1" /><path
|
||||
class="st0"
|
||||
d="M31.4,27h-11c-4.6,0-8.2,3.9-8.2,8.5v4.3c3.8,2.8,8.1,4.5,13.1,4.5c5.6,0,10.6-2.1,14.4-5.6v-3.2 C39.6,30.9,35.9,27,31.4,27z"
|
||||
id="path10"
|
||||
style="fill:#000000;fill-opacity:1" /><circle
|
||||
class="st0"
|
||||
cx="41.6"
|
||||
cy="17.1"
|
||||
r="3.5"
|
||||
id="circle12"
|
||||
style="fill:#000000;fill-opacity:1" /><path
|
||||
class="st0"
|
||||
d="M43.9,23.9h-4.1c-0.9,0-1.7,0.4-2.3,1c1.2,0.6,2.3,1.6,3.1,2.5c1,1.2,1.5,2.7,1.7,4.3c0.3,0.9,0.4,1.8,0.2,2.8 v0.6c1.6-2.2,3.3-6,4-8.1v-0.3C46.5,25.7,45.3,23.9,43.9,23.9z"
|
||||
id="path14"
|
||||
style="fill:#000000;fill-opacity:1" /><circle
|
||||
class="st0"
|
||||
cx="9.4"
|
||||
cy="18"
|
||||
r="3.5"
|
||||
id="circle16"
|
||||
style="fill:#000000;fill-opacity:1" /><path
|
||||
class="st0"
|
||||
d="M8.5,35.7c-0.1-0.7-0.1-1.4,0-2.1l0.1-0.2c0-0.2,0-0.4,0-0.6c0-0.2,0-0.3,0.1-0.5c0-0.2,0-0.3,0-0.5 c0.2-2.1,1.6-4.4,3.2-5.7c0.4-0.4,0.9-0.6,1.4-0.9c-0.5-0.5-1.3-0.7-2-0.7H7c-1.4,0-2.6,1.8-2.4,2.7v0.3 C5.1,29.8,6.8,33.5,8.5,35.7z"
|
||||
id="path18"
|
||||
style="fill:#000000;fill-opacity:1" /></g></svg>
|
After (image error) Size: 2.9 KiB |
24
interface/resources/icons/tablet-icons/people-i-msg.svg
Normal file
24
interface/resources/icons/tablet-icons/people-i-msg.svg
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
</style>
|
||||
<circle class="st1" cx="44.1" cy="6" r="5.6"/>
|
||||
<g id="Layer_2">
|
||||
</g>
|
||||
<g id="Layer_1">
|
||||
<circle class="st0" cx="25.6" cy="14.8" r="8.1"/>
|
||||
<path class="st0" d="M31.4,27h-11c-4.6,0-8.2,3.9-8.2,8.5v4.3c3.8,2.8,8.1,4.5,13.1,4.5c5.6,0,10.6-2.1,14.4-5.6v-3.2
|
||||
C39.6,30.9,35.9,27,31.4,27z"/>
|
||||
<circle class="st0" cx="41.6" cy="17.1" r="3.5"/>
|
||||
<path class="st0" d="M43.9,23.9h-4.1c-0.9,0-1.7,0.4-2.3,1c1.2,0.6,2.3,1.6,3.1,2.5c1,1.2,1.5,2.7,1.7,4.3c0.3,0.9,0.4,1.8,0.2,2.8
|
||||
v0.6c1.6-2.2,3.3-6,4-8.1v-0.3C46.5,25.7,45.3,23.9,43.9,23.9z"/>
|
||||
<circle class="st0" cx="9.4" cy="18" r="3.5"/>
|
||||
<path class="st0" d="M8.5,35.7c-0.1-0.7-0.1-1.4,0-2.1l0.1-0.2c0-0.2,0-0.4,0-0.6c0-0.2,0-0.3,0.1-0.5c0-0.2,0-0.3,0-0.5
|
||||
c0.2-2.1,1.6-4.4,3.2-5.7c0.4-0.4,0.9-0.6,1.4-0.9c-0.5-0.5-1.3-0.7-2-0.7H7c-1.4,0-2.6,1.8-2.4,2.7v0.3
|
||||
C5.1,29.8,6.8,33.5,8.5,35.7z"/>
|
||||
</g>
|
||||
</svg>
|
After (image error) Size: 1.2 KiB |
6
interface/resources/icons/tablet-icons/wallet-a-msg.svg
Normal file
6
interface/resources/icons/tablet-icons/wallet-a-msg.svg
Normal file
|
@ -0,0 +1,6 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st1{fill:#EF3B4E;}
|
||||
</style>
|
||||
<circle class="st1" cx="84.6" cy="11.5" r="10.75"/>
|
||||
<g><path d="M2.4,70.5c0,6.1,4.9,11,11,11H76c6.1,0,11-4.9,11-11V59.6c3.7-0.7,6.6-3.9,6.6-7.9v-7.5c0-3.9-2.8-7.2-6.6-7.9V25.5 c0-6.1-4.9-11-11-11H13.4c-6.1,0-11,4.9-11,11V70.5z M87.6,51.8c0,1.1-0.9,2-2,2H72.2c-2.8,0-5-2.2-5-5v-1.5c0-2.8,2.2-5,5-5h13.3 c1.1,0,2,0.9,2,2V51.8z M8.4,25.5c0-2.8,2.2-5,5-5H76c2.8,0,5,2.2,5,5v10.7h-8.7c-6.1,0-11,4.9-11,11v1.5c0,6.1,4.9,11,11,11H81 v10.7c0,2.8-2.2,5-5,5H13.4c-2.8,0-5-2.2-5-5V25.5z"></path></g></svg>
|
After (image error) Size: 755 B |
16
interface/resources/icons/tablet-icons/wallet-i-msg.svg
Normal file
16
interface/resources/icons/tablet-icons/wallet-i-msg.svg
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{fill:#EF3B4E;}
|
||||
</style>
|
||||
<circle class="st1" cx="84.6" cy="11.5" r="10.75"/>
|
||||
<g>
|
||||
<path class="st0" d="M2.4,70.5c0,6.1,4.9,11,11,11H76c6.1,0,11-4.9,11-11V59.6c3.7-0.7,6.6-3.9,6.6-7.9v-7.5c0-3.9-2.8-7.2-6.6-7.9
|
||||
V25.5c0-6.1-4.9-11-11-11H13.4c-6.1,0-11,4.9-11,11C2.4,25.5,2.4,70.5,2.4,70.5z M87.6,51.8c0,1.1-0.9,2-2,2H72.2c-2.8,0-5-2.2-5-5
|
||||
v-1.5c0-2.8,2.2-5,5-5h13.3c1.1,0,2,0.9,2,2L87.6,51.8L87.6,51.8z M8.4,25.5c0-2.8,2.2-5,5-5H76c2.8,0,5,2.2,5,5v10.7h-8.7
|
||||
c-6.1,0-11,4.9-11,11v1.5c0,6.1,4.9,11,11,11H81v10.7c0,2.8-2.2,5-5,5H13.4c-2.8,0-5-2.2-5-5V25.5z"/>
|
||||
</g>
|
||||
</svg>
|
After (image error) Size: 984 B |
|
@ -48,35 +48,11 @@ Item {
|
|||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: "State Machines:---------------------------------------------------------------------------"
|
||||
text: root.positionText
|
||||
}
|
||||
ListView {
|
||||
width: firstCol.width
|
||||
height: root.animStateMachines.length * 15
|
||||
visible: root.animStateMchines.length > 0;
|
||||
model: root.animStateMachines
|
||||
delegate: StatText {
|
||||
text: {
|
||||
return modelData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: secondCol.width + 8
|
||||
height: secondCol.height + 8
|
||||
color: root.bgColor;
|
||||
|
||||
Column {
|
||||
id: secondCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: "Anim Vars:--------------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
ListView {
|
||||
width: secondCol.width
|
||||
height: root.animVars.length * 15
|
||||
|
@ -104,6 +80,36 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: secondCol.width + 8
|
||||
height: secondCol.height + 8
|
||||
color: root.bgColor;
|
||||
|
||||
Column {
|
||||
id: secondCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: root.rotationText
|
||||
}
|
||||
StatText {
|
||||
text: "State Machines:---------------------------------------------------------------------------"
|
||||
}
|
||||
ListView {
|
||||
width: firstCol.width
|
||||
height: root.animStateMachines.length * 15
|
||||
visible: root.animStateMachines.length > 0;
|
||||
model: root.animStateMachines
|
||||
delegate: StatText {
|
||||
text: {
|
||||
return modelData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: thirdCol.width + 8
|
||||
height: thirdCol.height + 8
|
||||
|
@ -113,10 +119,12 @@ Item {
|
|||
id: thirdCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: root.velocityText
|
||||
}
|
||||
StatText {
|
||||
text: "Alpha Values:--------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
ListView {
|
||||
width: thirdCol.width
|
||||
height: root.animAlphaValues.length * 15
|
||||
|
|
|
@ -271,6 +271,8 @@ Rectangle {
|
|||
connectionsUserModel.getFirstPage();
|
||||
}
|
||||
activeTab = "connectionsTab";
|
||||
connectionsOnlineDot.visible = false;
|
||||
pal.sendToScript({method: 'hideNotificationDot'});
|
||||
connectionsHelpText.color = hifi.colors.blueAccent;
|
||||
}
|
||||
}
|
||||
|
@ -298,6 +300,16 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: connectionsOnlineDot;
|
||||
visible: false;
|
||||
width: 10;
|
||||
height: width;
|
||||
radius: width;
|
||||
color: "#EF3B4E"
|
||||
anchors.left: parent.left;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
// "CONNECTIONS" text
|
||||
RalewaySemiBold {
|
||||
id: connectionsTabSelectorText;
|
||||
|
@ -305,7 +317,11 @@ Rectangle {
|
|||
// Text size
|
||||
size: hifi.fontSizes.tabularData;
|
||||
// Anchors
|
||||
anchors.fill: parent;
|
||||
anchors.left: connectionsOnlineDot.visible ? connectionsOnlineDot.right : parent.left;
|
||||
anchors.leftMargin: connectionsOnlineDot.visible ? 4 : 0;
|
||||
anchors.top: parent.top;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.right: parent.right;
|
||||
// Style
|
||||
font.capitalization: Font.AllUppercase;
|
||||
color: activeTab === "connectionsTab" ? hifi.colors.blueAccent : hifi.colors.baseGray;
|
||||
|
@ -326,7 +342,7 @@ Rectangle {
|
|||
anchors.left: connectionsTabSelectorTextContainer.left;
|
||||
anchors.top: connectionsTabSelectorTextContainer.top;
|
||||
anchors.topMargin: 1;
|
||||
anchors.leftMargin: connectionsTabSelectorTextMetrics.width + 42;
|
||||
anchors.leftMargin: connectionsTabSelectorTextMetrics.width + 42 + connectionsOnlineDot.width + connectionsTabSelectorText.anchors.leftMargin;
|
||||
RalewayRegular {
|
||||
id: connectionsHelpText;
|
||||
text: "[?]";
|
||||
|
@ -1267,6 +1283,9 @@ Rectangle {
|
|||
case 'http.response':
|
||||
http.handleHttpResponse(message);
|
||||
break;
|
||||
case 'changeConnectionsDotStatus':
|
||||
connectionsOnlineDot.visible = message.shouldShowDot;
|
||||
break;
|
||||
default:
|
||||
console.log('Unrecognized message:', JSON.stringify(message));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,290 @@
|
|||
//
|
||||
// marketplaceItemTester
|
||||
// qml/hifi/commerce/marketplaceItemTester
|
||||
//
|
||||
// Load items not in the marketplace for testing purposes
|
||||
//
|
||||
// Created by Zach Fox on 2018-09-05
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import Hifi 1.0 as Hifi
|
||||
import "../../../styles-uit" as HifiStylesUit
|
||||
import "../../../controls-uit" as HifiControlsUit
|
||||
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string installedApps
|
||||
property var nextResourceObjectId: 0
|
||||
signal sendToScript(var message)
|
||||
|
||||
HifiStylesUit.HifiConstants { id: hifi }
|
||||
ListModel { id: resourceListModel }
|
||||
|
||||
color: hifi.colors.white
|
||||
|
||||
AnimatedImage {
|
||||
id: spinner;
|
||||
source: "spinner.gif"
|
||||
width: 74;
|
||||
height: width;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
}
|
||||
|
||||
function fromScript(message) {
|
||||
switch (message.method) {
|
||||
case "newResourceObjectInTest":
|
||||
var resourceObject = message.resourceObject;
|
||||
resourceListModel.append(resourceObject);
|
||||
spinner.visible = false;
|
||||
break;
|
||||
case "nextObjectIdInTest":
|
||||
nextResourceObjectId = message.id;
|
||||
spinner.visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function buildResourceObj(resource) {
|
||||
resource = resource.trim();
|
||||
var assetType = (resource.match(/\.app\.json$/) ? "application" :
|
||||
resource.match(/\.fst$/) ? "avatar" :
|
||||
resource.match(/\.json\.gz$/) ? "content set" :
|
||||
resource.match(/\.json$/) ? "entity or wearable" :
|
||||
"unknown");
|
||||
return { "id": nextResourceObjectId++,
|
||||
"resource": resource,
|
||||
"assetType": assetType };
|
||||
}
|
||||
|
||||
function installResourceObj(resourceObj) {
|
||||
if ("application" === resourceObj.assetType) {
|
||||
Commerce.installApp(resourceObj.resource);
|
||||
}
|
||||
}
|
||||
|
||||
function addAllInstalledAppsToList() {
|
||||
var i, apps = Commerce.getInstalledApps().split(","), len = apps.length;
|
||||
for(i = 0; i < len - 1; ++i) {
|
||||
if (i in apps) {
|
||||
resourceListModel.append(buildResourceObj(apps[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toUrl(resource) {
|
||||
var httpPattern = /^http/i;
|
||||
return httpPattern.test(resource) ? resource : "file:///" + resource;
|
||||
}
|
||||
|
||||
function rezEntity(resource, entityType) {
|
||||
sendToScript({
|
||||
method: 'tester_rezClicked',
|
||||
itemHref: toUrl(resource),
|
||||
itemType: entityType});
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.bottomMargin: 40
|
||||
anchors.rightMargin: 12
|
||||
model: resourceListModel
|
||||
spacing: 5
|
||||
interactive: false
|
||||
|
||||
delegate: RowLayout {
|
||||
anchors.left: parent.left
|
||||
width: parent.width
|
||||
spacing: 5
|
||||
|
||||
property var actions: {
|
||||
"forward": function(resource, assetType){
|
||||
switch(assetType) {
|
||||
case "application":
|
||||
Commerce.openApp(resource);
|
||||
break;
|
||||
case "avatar":
|
||||
MyAvatar.useFullAvatarURL(resource);
|
||||
break;
|
||||
case "content set":
|
||||
urlHandler.handleUrl("hifi://localhost/0,0,0");
|
||||
Commerce.replaceContentSet(toUrl(resource), "");
|
||||
break;
|
||||
case "entity":
|
||||
case "wearable":
|
||||
rezEntity(resource, assetType);
|
||||
break;
|
||||
default:
|
||||
print("Marketplace item tester unsupported assetType " + assetType);
|
||||
}
|
||||
},
|
||||
"trash": function(resource, assetType){
|
||||
if ("application" === assetType) {
|
||||
Commerce.uninstallApp(resource);
|
||||
}
|
||||
sendToScript({
|
||||
method: "tester_deleteResourceObject",
|
||||
objectId: resourceListModel.get(index).id});
|
||||
resourceListModel.remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
Layout.preferredWidth: root.width * .6
|
||||
spacing: 5
|
||||
Text {
|
||||
text: {
|
||||
var match = resource.match(/\/([^/]*)$/);
|
||||
return match ? match[1] : resource;
|
||||
}
|
||||
font.pointSize: 12
|
||||
horizontalAlignment: Text.AlignBottom
|
||||
}
|
||||
Text {
|
||||
text: resource
|
||||
font.pointSize: 8
|
||||
width: root.width * .6
|
||||
horizontalAlignment: Text.AlignBottom
|
||||
wrapMode: Text.WrapAnywhere
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: comboBox
|
||||
|
||||
Layout.preferredWidth: root.width * .2
|
||||
|
||||
model: [
|
||||
"application",
|
||||
"avatar",
|
||||
"content set",
|
||||
"entity",
|
||||
"wearable",
|
||||
"unknown"
|
||||
]
|
||||
|
||||
currentIndex: (("entity or wearable" === assetType) ?
|
||||
model.indexOf("unknown") : model.indexOf(assetType))
|
||||
|
||||
Component.onCompleted: {
|
||||
onCurrentIndexChanged.connect(function() {
|
||||
assetType = model[currentIndex];
|
||||
sendToScript({
|
||||
method: "tester_updateResourceObjectAssetType",
|
||||
objectId: resourceListModel.get(index)["id"],
|
||||
assetType: assetType });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: [ "forward", "trash" ]
|
||||
|
||||
HifiStylesUit.HiFiGlyphs {
|
||||
property var glyphs: {
|
||||
"application": hifi.glyphs.install,
|
||||
"avatar": hifi.glyphs.avatar,
|
||||
"content set": hifi.glyphs.globe,
|
||||
"entity": hifi.glyphs.wand,
|
||||
"trash": hifi.glyphs.trash,
|
||||
"unknown": hifi.glyphs.circleSlash,
|
||||
"wearable": hifi.glyphs.hat,
|
||||
}
|
||||
text: (("trash" === modelData) ?
|
||||
glyphs.trash :
|
||||
glyphs[comboBox.model[comboBox.currentIndex]])
|
||||
size: ("trash" === modelData) ? 22 : 30
|
||||
color: hifi.colors.black
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
actions[modelData](resource, comboBox.currentText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
headerPositioning: ListView.OverlayHeader
|
||||
header: HifiStylesUit.RalewayRegular {
|
||||
id: rootHeader
|
||||
text: "Marketplace Item Tester"
|
||||
height: 80
|
||||
width: paintedWidth
|
||||
size: 22
|
||||
color: hifi.colors.black
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
}
|
||||
|
||||
footerPositioning: ListView.OverlayFooter
|
||||
footer: Row {
|
||||
id: rootActions
|
||||
spacing: 20
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
property string currentAction
|
||||
property var actions: {
|
||||
"Load File": function(){
|
||||
rootActions.currentAction = "load file";
|
||||
Window.browseChanged.connect(onResourceSelected);
|
||||
Window.browseAsync("Please select a file (*.app.json *.json *.fst *.json.gz)", "", "Assets (*.app.json *.json *.fst *.json.gz)");
|
||||
},
|
||||
"Load URL": function(){
|
||||
rootActions.currentAction = "load url";
|
||||
Window.promptTextChanged.connect(onResourceSelected);
|
||||
Window.promptAsync("Please enter a URL", "");
|
||||
}
|
||||
}
|
||||
|
||||
function onResourceSelected(resource) {
|
||||
// It is possible that we received the present signal
|
||||
// from something other than our browserAsync window.
|
||||
// Alas, there is nothing we can do about that so charge
|
||||
// ahead as though we are sure the present signal is one
|
||||
// we expect.
|
||||
switch(currentAction) {
|
||||
case "load file":
|
||||
Window.browseChanged.disconnect(onResourceSelected);
|
||||
break
|
||||
case "load url":
|
||||
Window.promptTextChanged.disconnect(onResourceSelected);
|
||||
break;
|
||||
}
|
||||
if (resource) {
|
||||
var resourceObj = buildResourceObj(resource);
|
||||
installResourceObj(resourceObj);
|
||||
sendToScript({
|
||||
method: 'tester_newResourceObject',
|
||||
resourceObject: resourceObj });
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: [ "Load File", "Load URL" ]
|
||||
HifiControlsUit.Button {
|
||||
color: hifi.buttons.blue
|
||||
fontSize: 20
|
||||
text: modelData
|
||||
width: root.width / 3
|
||||
height: 40
|
||||
onClicked: actions[text]()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After ![]() (image error) Size: 45 KiB |
|
@ -59,7 +59,7 @@ Item {
|
|||
|
||||
Connections {
|
||||
target: Commerce;
|
||||
|
||||
|
||||
onContentSetChanged: {
|
||||
if (contentSetHref === root.itemHref) {
|
||||
showConfirmation = true;
|
||||
|
@ -135,7 +135,7 @@ Item {
|
|||
anchors.topMargin: 8;
|
||||
width: 30;
|
||||
height: width;
|
||||
|
||||
|
||||
HiFiGlyphs {
|
||||
id: closeContextMenuGlyph;
|
||||
text: hifi.glyphs.close;
|
||||
|
@ -376,7 +376,7 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transform: Rotation {
|
||||
id: rotation;
|
||||
origin.x: flipable.width/2;
|
||||
|
@ -509,7 +509,7 @@ Item {
|
|||
}
|
||||
verticalAlignment: Text.AlignTop;
|
||||
}
|
||||
|
||||
|
||||
HiFiGlyphs {
|
||||
id: statusIcon;
|
||||
text: {
|
||||
|
@ -588,7 +588,7 @@ Item {
|
|||
border.width: 1;
|
||||
border.color: "#E2334D";
|
||||
}
|
||||
|
||||
|
||||
HiFiGlyphs {
|
||||
id: contextMenuGlyph;
|
||||
text: hifi.glyphs.verticalEllipsis;
|
||||
|
@ -615,7 +615,7 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: rezzedNotifContainer;
|
||||
z: 998;
|
||||
|
@ -663,13 +663,13 @@ Item {
|
|||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onFocusChanged: {
|
||||
if (focus) {
|
||||
Tablet.playSound(TabletEnums.ButtonHover);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onClicked: {
|
||||
Tablet.playSound(TabletEnums.ButtonClick);
|
||||
if (root.itemType === "contentSet") {
|
||||
|
@ -775,7 +775,7 @@ Item {
|
|||
// Style
|
||||
color: hifi.colors.redAccent;
|
||||
horizontalAlignment: Text.AlignRight;
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: true;
|
||||
|
|
|
@ -93,7 +93,7 @@ Rectangle {
|
|||
console.log("Failed to get Available Updates", result.data.message);
|
||||
} else {
|
||||
sendToScript({method: 'purchases_availableUpdatesReceived', numUpdates: result.data.updates.length });
|
||||
root.numUpdatesAvailable = result.data.updates.length;
|
||||
root.numUpdatesAvailable = result.total_entries;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -408,9 +408,7 @@ Rectangle {
|
|||
|
||||
Connections {
|
||||
onSendSignalToWallet: {
|
||||
if (msg.method === 'walletReset' || msg.method === 'passphraseReset') {
|
||||
sendToScript(msg);
|
||||
} else if (msg.method === 'walletSecurity_changeSecurityImage') {
|
||||
if (msg.method === 'walletSecurity_changeSecurityImage') {
|
||||
securityImageChange.initModel();
|
||||
root.activeView = "securityImageChange";
|
||||
}
|
||||
|
|
|
@ -45,14 +45,6 @@ Item {
|
|||
onHistoryResult : {
|
||||
transactionHistoryModel.handlePage(null, result);
|
||||
}
|
||||
|
||||
onAvailableUpdatesResult: {
|
||||
if (result.status !== 'success') {
|
||||
console.log("Failed to get Available Updates", result.data.message);
|
||||
} else {
|
||||
sendToScript({method: 'wallet_availableUpdatesReceived', numUpdates: result.data.updates.length });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
//
|
||||
#include "AndroidHelper.h"
|
||||
#include <QDebug>
|
||||
#include <AudioClient.h>
|
||||
#include "Application.h"
|
||||
|
||||
#if defined(qApp)
|
||||
|
@ -18,6 +19,7 @@
|
|||
#define qApp (static_cast<Application*>(QCoreApplication::instance()))
|
||||
|
||||
AndroidHelper::AndroidHelper() {
|
||||
qRegisterMetaType<QAudio::Mode>("QAudio::Mode");
|
||||
}
|
||||
|
||||
AndroidHelper::~AndroidHelper() {
|
||||
|
@ -56,3 +58,12 @@ void AndroidHelper::processURL(const QString &url) {
|
|||
qApp->acceptURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidHelper::notifyHeadsetOn(bool pluggedIn) {
|
||||
#if defined (Q_OS_ANDROID)
|
||||
auto audioClient = DependencyManager::get<AudioClient>();
|
||||
if (audioClient) {
|
||||
QMetaObject::invokeMethod(audioClient.data(), "setHeadsetPluggedIn", Q_ARG(bool, pluggedIn));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
|
||||
void performHapticFeedback(int duration);
|
||||
void processURL(const QString &url);
|
||||
void notifyHeadsetOn(bool pluggedIn);
|
||||
|
||||
AndroidHelper(AndroidHelper const&) = delete;
|
||||
void operator=(AndroidHelper const&) = delete;
|
||||
|
|
|
@ -1691,21 +1691,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
|
||||
});
|
||||
_applicationStateDevice->setInputVariant(STATE_PLATFORM_WINDOWS, []() -> float {
|
||||
#if defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
});
|
||||
_applicationStateDevice->setInputVariant(STATE_PLATFORM_MAC, []() -> float {
|
||||
#if defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_MAC)
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
});
|
||||
_applicationStateDevice->setInputVariant(STATE_PLATFORM_ANDROID, []() -> float {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
|
@ -1759,10 +1759,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
|
||||
// Make sure we don't time out during slow operations at startup
|
||||
updateHeartbeat();
|
||||
|
||||
QTimer* settingsTimer = new QTimer();
|
||||
moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{
|
||||
connect(qApp, &Application::beforeAboutToQuit, [this, settingsTimer]{
|
||||
// This needs to run on the settings thread, so we need to pass the `settingsTimer` as the
|
||||
// receiver object, otherwise it will run on the application thread and trigger a warning
|
||||
// about trying to kill the timer on the main thread.
|
||||
connect(qApp, &Application::beforeAboutToQuit, settingsTimer, [this, settingsTimer]{
|
||||
// Disconnect the signal from the save settings
|
||||
QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
|
||||
// Stop the settings timer
|
||||
|
@ -2881,9 +2883,10 @@ void Application::initializeUi() {
|
|||
QUrl{ "hifi/commerce/common/CommerceLightbox.qml" },
|
||||
QUrl{ "hifi/commerce/common/EmulatedMarketplaceHeader.qml" },
|
||||
QUrl{ "hifi/commerce/common/FirstUseTutorial.qml" },
|
||||
QUrl{ "hifi/commerce/common/SortableListModel.qml" },
|
||||
QUrl{ "hifi/commerce/common/sendAsset/SendAsset.qml" },
|
||||
QUrl{ "hifi/commerce/common/SortableListModel.qml" },
|
||||
QUrl{ "hifi/commerce/inspectionCertificate/InspectionCertificate.qml" },
|
||||
QUrl{ "hifi/commerce/marketplaceItemTester/MarketplaceItemTester.qml"},
|
||||
QUrl{ "hifi/commerce/purchases/PurchasedItem.qml" },
|
||||
QUrl{ "hifi/commerce/purchases/Purchases.qml" },
|
||||
QUrl{ "hifi/commerce/wallet/Help.qml" },
|
||||
|
@ -3427,7 +3430,12 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
|
|||
int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY);
|
||||
QString addressLookupString;
|
||||
if (urlIndex != -1) {
|
||||
addressLookupString = arguments().value(urlIndex + 1);
|
||||
QUrl url(arguments().value(urlIndex + 1));
|
||||
if (url.scheme() == URL_SCHEME_HIFIAPP) {
|
||||
Setting::Handle<QVariant>("startUpApp").set(url.path());
|
||||
} else {
|
||||
addressLookupString = url.toString();
|
||||
}
|
||||
}
|
||||
|
||||
static const QString SENT_TO_PREVIOUS_LOCATION = "previous_location";
|
||||
|
@ -3498,13 +3506,14 @@ bool Application::isServerlessMode() const {
|
|||
}
|
||||
|
||||
void Application::setIsInterstitialMode(bool interstitialMode) {
|
||||
Settings settings;
|
||||
bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool();
|
||||
if (_interstitialMode != interstitialMode && enableInterstitial) {
|
||||
_interstitialMode = interstitialMode;
|
||||
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
||||
if (enableInterstitial) {
|
||||
if (_interstitialMode != interstitialMode) {
|
||||
_interstitialMode = interstitialMode;
|
||||
|
||||
DependencyManager::get<AudioClient>()->setAudioPaused(_interstitialMode);
|
||||
DependencyManager::get<AvatarManager>()->setMyAvatarDataPacketsPaused(_interstitialMode);
|
||||
DependencyManager::get<AudioClient>()->setAudioPaused(_interstitialMode);
|
||||
DependencyManager::get<AvatarManager>()->setMyAvatarDataPacketsPaused(_interstitialMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7674,6 +7683,9 @@ void Application::openUrl(const QUrl& url) const {
|
|||
if (!url.isEmpty()) {
|
||||
if (url.scheme() == URL_SCHEME_HIFI) {
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(url.toString());
|
||||
} else if (url.scheme() == URL_SCHEME_HIFIAPP) {
|
||||
QmlCommerce commerce;
|
||||
commerce.openSystemApp(url.path());
|
||||
} else {
|
||||
// address manager did not handle - ask QDesktopServices to handle
|
||||
QDesktopServices::openUrl(url);
|
||||
|
|
|
@ -432,7 +432,7 @@ public slots:
|
|||
|
||||
void setIsServerlessMode(bool serverlessDomain);
|
||||
void loadServerlessDomain(QUrl domainURL, bool errorDomain = false);
|
||||
void setIsInterstitialMode(bool interstialMode);
|
||||
void setIsInterstitialMode(bool interstitialMode);
|
||||
|
||||
void updateVerboseLogging();
|
||||
|
||||
|
|
|
@ -41,9 +41,15 @@ void ConnectionMonitor::init() {
|
|||
}
|
||||
|
||||
connect(&_timer, &QTimer::timeout, this, [this]() {
|
||||
qDebug() << "ConnectionMonitor: Redirecting to 404 error domain";
|
||||
// set in a timeout error
|
||||
emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, 5);
|
||||
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
||||
if (enableInterstitial) {
|
||||
qDebug() << "ConnectionMonitor: Redirecting to 404 error domain";
|
||||
emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, "", 5);
|
||||
} else {
|
||||
qDebug() << "ConnectionMonitor: Showing connection failure window";
|
||||
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -53,4 +59,8 @@ void ConnectionMonitor::startTimer() {
|
|||
|
||||
void ConnectionMonitor::stopTimer() {
|
||||
_timer.stop();
|
||||
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
||||
if (!enableInterstitial) {
|
||||
DependencyManager::get<DialogsManager>()->setDomainConnectionFailureVisibility(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
void init();
|
||||
|
||||
signals:
|
||||
void setRedirectErrorState(QUrl errorURL, int reasonCode);
|
||||
void setRedirectErrorState(QUrl errorURL, QString reasonMessage = "", int reasonCode = -1, const QString& extraInfo = "");
|
||||
|
||||
private slots:
|
||||
void startTimer();
|
||||
|
@ -34,4 +34,4 @@ private:
|
|||
QTimer _timer;
|
||||
};
|
||||
|
||||
#endif // hifi_ConnectionMonitor_h
|
||||
#endif // hifi_ConnectionMonitor_h
|
||||
|
|
|
@ -234,11 +234,13 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
const SortableAvatar& sortData = *it;
|
||||
const auto avatar = std::static_pointer_cast<OtherAvatar>(sortData.getAvatar());
|
||||
|
||||
// TODO: to help us scale to more avatars it would be nice to not have to poll orb state here
|
||||
// if the geometry is loaded then turn off the orb
|
||||
// TODO: to help us scale to more avatars it would be nice to not have to poll this stuff every update
|
||||
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||
// remove the orb if it is there
|
||||
avatar->removeOrb();
|
||||
if (avatar->needsPhysicsUpdate()) {
|
||||
_avatarsToChangeInPhysics.insert(avatar);
|
||||
}
|
||||
} else {
|
||||
avatar->updateOrbPosition();
|
||||
}
|
||||
|
@ -456,31 +458,37 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar
|
|||
}
|
||||
|
||||
void AvatarManager::clearOtherAvatars() {
|
||||
// Remove other avatars from the world but don't actually remove them from _avatarHash
|
||||
// each will either be removed on timeout or will re-added to the world on receipt of update.
|
||||
const render::ScenePointer& scene = qApp->getMain3DScene();
|
||||
render::Transaction transaction;
|
||||
|
||||
QReadLocker locker(&_hashLock);
|
||||
AvatarHash::iterator avatarIterator = _avatarHash.begin();
|
||||
while (avatarIterator != _avatarHash.end()) {
|
||||
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
|
||||
if (avatar != _myAvatar) {
|
||||
handleRemovedAvatar(avatar);
|
||||
avatarIterator = _avatarHash.erase(avatarIterator);
|
||||
} else {
|
||||
++avatarIterator;
|
||||
}
|
||||
}
|
||||
assert(scene);
|
||||
scene->enqueueTransaction(transaction);
|
||||
_myAvatar->clearLookAtTargetAvatar();
|
||||
|
||||
// setup a vector of removed avatars outside the scope of the hash lock
|
||||
std::vector<AvatarSharedPointer> removedAvatars;
|
||||
|
||||
{
|
||||
QWriteLocker locker(&_hashLock);
|
||||
|
||||
removedAvatars.reserve(_avatarHash.size());
|
||||
|
||||
auto avatarIterator = _avatarHash.begin();
|
||||
while (avatarIterator != _avatarHash.end()) {
|
||||
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
|
||||
if (avatar != _myAvatar) {
|
||||
removedAvatars.push_back(avatar);
|
||||
avatarIterator = _avatarHash.erase(avatarIterator);
|
||||
} else {
|
||||
++avatarIterator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& av : removedAvatars) {
|
||||
handleRemovedAvatar(av);
|
||||
}
|
||||
}
|
||||
|
||||
void AvatarManager::deleteAllAvatars() {
|
||||
assert(_avatarsToChangeInPhysics.empty());
|
||||
|
||||
QReadLocker locker(&_hashLock);
|
||||
QWriteLocker locker(&_hashLock);
|
||||
AvatarHash::iterator avatarIterator = _avatarHash.begin();
|
||||
while (avatarIterator != _avatarHash.end()) {
|
||||
auto avatar = std::static_pointer_cast<OtherAvatar>(avatarIterator.value());
|
||||
|
|
|
@ -204,7 +204,12 @@ private:
|
|||
void simulateAvatarFades(float deltaTime);
|
||||
|
||||
AvatarSharedPointer newSharedAvatar() override;
|
||||
void handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason = KillAvatarReason::NoReason) override;
|
||||
|
||||
// called only from the AvatarHashMap thread - cannot be called while this thread holds the
|
||||
// hash lock, since handleRemovedAvatar needs a write lock on the entity tree and the entity tree
|
||||
// frequently grabs a read lock on the hash to get a given avatar by ID
|
||||
void handleRemovedAvatar(const AvatarSharedPointer& removedAvatar,
|
||||
KillAvatarReason removalReason = KillAvatarReason::NoReason) override;
|
||||
|
||||
QVector<AvatarSharedPointer> _avatarsToFade;
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ const float MIN_SCALE_CHANGED_DELTA = 0.001f;
|
|||
const int MODE_READINGS_RING_BUFFER_SIZE = 500;
|
||||
const float CENTIMETERS_PER_METER = 100.0f;
|
||||
|
||||
const QString AVATAR_SETTINGS_GROUP_NAME { "Avatar" };
|
||||
|
||||
MyAvatar::MyAvatar(QThread* thread) :
|
||||
Avatar(thread),
|
||||
_yawSpeed(YAW_SPEED_DEFAULT),
|
||||
|
@ -114,11 +116,27 @@ MyAvatar::MyAvatar(QThread* thread) :
|
|||
_bodySensorMatrix(),
|
||||
_goToPending(false),
|
||||
_goToSafe(true),
|
||||
_goToFeetAjustment(false),
|
||||
_goToPosition(),
|
||||
_goToOrientation(),
|
||||
_prevShouldDrawHead(true),
|
||||
_audioListenerMode(FROM_HEAD),
|
||||
_hmdAtRestDetector(glm::vec3(0), glm::quat())
|
||||
_hmdAtRestDetector(glm::vec3(0), glm::quat()),
|
||||
_dominantHandSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "dominantHand", DOMINANT_RIGHT_HAND),
|
||||
_headPitchSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "", 0.0f),
|
||||
_scaleSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "scale", _targetScale),
|
||||
_yawSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "yawSpeed", _yawSpeed),
|
||||
_pitchSpeedSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "pitchSpeed", _pitchSpeed),
|
||||
_fullAvatarURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarURL",
|
||||
AvatarData::defaultFullAvatarModelUrl()),
|
||||
_fullAvatarModelNameSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "fullAvatarModelName", _fullAvatarModelName),
|
||||
_animGraphURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "animGraphURL", QUrl("")),
|
||||
_displayNameSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "displayName", ""),
|
||||
_collisionSoundURLSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "collisionSoundURL", QUrl(_collisionSoundURL)),
|
||||
_useSnapTurnSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "useSnapTurn", _useSnapTurn),
|
||||
_userHeightSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "userHeight", DEFAULT_AVATAR_HEIGHT),
|
||||
_flyingHMDSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "flyingHMD", _flyingPrefHMD),
|
||||
_avatarEntityCountSetting(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData" << "size", _flyingPrefHMD)
|
||||
{
|
||||
_clientTraitsHandler = std::unique_ptr<ClientTraitsHandler>(new ClientTraitsHandler(this));
|
||||
|
||||
|
@ -481,7 +499,7 @@ void MyAvatar::update(float deltaTime) {
|
|||
setCurrentStandingHeight(computeStandingHeightMode(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
||||
setAverageHeadRotation(computeAverageHeadRotation(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
||||
|
||||
if (_drawAverageFacingEnabled) {
|
||||
if (_drawAverageFacingEnabled) {
|
||||
auto sensorHeadPose = getControllerPoseInSensorFrame(controller::Action::HEAD);
|
||||
glm::vec3 worldHeadPos = transformPoint(getSensorToWorldMatrix(), sensorHeadPose.getTranslation());
|
||||
glm::vec3 worldFacingAverage = transformVectorFast(getSensorToWorldMatrix(), glm::vec3(_headControllerFacingMovingAverage.x, 0.0f, _headControllerFacingMovingAverage.y));
|
||||
|
@ -509,6 +527,11 @@ void MyAvatar::update(float deltaTime) {
|
|||
_physicsSafetyPending = getCollisionsEnabled();
|
||||
_characterController.recomputeFlying(); // In case we've gone to into the sky.
|
||||
}
|
||||
if (_goToFeetAjustment && _skeletonModelLoaded) {
|
||||
auto feetAjustment = getWorldPosition() - getWorldFeetPosition();
|
||||
goToLocation(getWorldPosition() + feetAjustment);
|
||||
_goToFeetAjustment = false;
|
||||
}
|
||||
if (_physicsSafetyPending && qApp->isPhysicsEnabled() && _characterController.isEnabledAndReady()) {
|
||||
// When needed and ready, arrange to check and fix.
|
||||
_physicsSafetyPending = false;
|
||||
|
@ -1135,88 +1158,80 @@ void MyAvatar::restoreRoleAnimation(const QString& role) {
|
|||
}
|
||||
|
||||
void MyAvatar::saveAvatarUrl() {
|
||||
Settings settings;
|
||||
settings.beginGroup("Avatar");
|
||||
if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid() ) {
|
||||
settings.setValue("fullAvatarURL",
|
||||
_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
|
||||
"" :
|
||||
_fullAvatarURLFromPreferences.toString());
|
||||
if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid()) {
|
||||
_fullAvatarURLSetting.set(_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
|
||||
"" :
|
||||
_fullAvatarURLFromPreferences.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::resizeAvatarEntitySettingHandles(unsigned int avatarEntityIndex) {
|
||||
// The original Settings interface saved avatar-entity array data like this:
|
||||
// Avatar/avatarEntityData/size: 5
|
||||
// Avatar/avatarEntityData/1/id: ...
|
||||
// Avatar/avatarEntityData/1/properties: ...
|
||||
// ...
|
||||
// Avatar/avatarEntityData/5/id: ...
|
||||
// Avatar/avatarEntityData/5/properties: ...
|
||||
//
|
||||
// Create Setting::Handles to mimic this.
|
||||
|
||||
while (_avatarEntityIDSettings.size() <= avatarEntityIndex) {
|
||||
Setting::Handle<QUuid> idHandle(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData"
|
||||
<< QString::number(avatarEntityIndex + 1) << "id", QUuid());
|
||||
_avatarEntityIDSettings.push_back(idHandle);
|
||||
Setting::Handle<QByteArray> dataHandle(QStringList() << AVATAR_SETTINGS_GROUP_NAME << "avatarEntityData"
|
||||
<< QString::number(avatarEntityIndex + 1) << "properties", QByteArray());
|
||||
_avatarEntityDataSettings.push_back(dataHandle);
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MyAvatar::saveData() {
|
||||
Settings settings;
|
||||
settings.beginGroup("Avatar");
|
||||
|
||||
settings.setValue("dominantHand", _dominantHand);
|
||||
settings.setValue("headPitch", getHead()->getBasePitch());
|
||||
|
||||
settings.setValue("scale", _targetScale);
|
||||
|
||||
settings.setValue("yawSpeed", _yawSpeed);
|
||||
settings.setValue("pitchSpeed", _pitchSpeed);
|
||||
_dominantHandSetting.set(_dominantHand);
|
||||
_headPitchSetting.set(getHead()->getBasePitch());
|
||||
_scaleSetting.set(_targetScale);
|
||||
_yawSpeedSetting.set(_yawSpeed);
|
||||
_pitchSpeedSetting.set(_pitchSpeed);
|
||||
|
||||
// only save the fullAvatarURL if it has not been overwritten on command line
|
||||
// (so the overrideURL is not valid), or it was overridden _and_ we specified
|
||||
// --replaceAvatarURL (so _saveAvatarOverrideUrl is true)
|
||||
if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid() ) {
|
||||
settings.setValue("fullAvatarURL",
|
||||
_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
|
||||
"" :
|
||||
_fullAvatarURLFromPreferences.toString());
|
||||
_fullAvatarURLSetting.set(_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
|
||||
"" :
|
||||
_fullAvatarURLFromPreferences.toString());
|
||||
}
|
||||
|
||||
settings.setValue("fullAvatarModelName", _fullAvatarModelName);
|
||||
|
||||
_fullAvatarModelNameSetting.set(_fullAvatarModelName);
|
||||
QUrl animGraphUrl = _prefOverrideAnimGraphUrl.get();
|
||||
settings.setValue("animGraphURL", animGraphUrl);
|
||||
_animGraphURLSetting.set(animGraphUrl);
|
||||
_displayNameSetting.set(_displayName);
|
||||
_collisionSoundURLSetting.set(_collisionSoundURL);
|
||||
_useSnapTurnSetting.set(_useSnapTurn);
|
||||
_userHeightSetting.set(getUserHeight());
|
||||
_flyingHMDSetting.set(getFlyingHMDPref());
|
||||
|
||||
settings.beginWriteArray("attachmentData");
|
||||
for (int i = 0; i < _attachmentData.size(); i++) {
|
||||
settings.setArrayIndex(i);
|
||||
const AttachmentData& attachment = _attachmentData.at(i);
|
||||
settings.setValue("modelURL", attachment.modelURL);
|
||||
settings.setValue("jointName", attachment.jointName);
|
||||
settings.setValue("translation_x", attachment.translation.x);
|
||||
settings.setValue("translation_y", attachment.translation.y);
|
||||
settings.setValue("translation_z", attachment.translation.z);
|
||||
glm::vec3 eulers = safeEulerAngles(attachment.rotation);
|
||||
settings.setValue("rotation_x", eulers.x);
|
||||
settings.setValue("rotation_y", eulers.y);
|
||||
settings.setValue("rotation_z", eulers.z);
|
||||
settings.setValue("scale", attachment.scale);
|
||||
settings.setValue("isSoft", attachment.isSoft);
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
settings.remove("avatarEntityData");
|
||||
settings.beginWriteArray("avatarEntityData");
|
||||
int avatarEntityIndex = 0;
|
||||
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
||||
_avatarEntitiesLock.withReadLock([&] {
|
||||
for (auto entityID : _avatarEntityData.keys()) {
|
||||
if (hmdInterface->getCurrentTabletFrameID() == entityID) {
|
||||
// don't persist the tablet between domains / sessions
|
||||
continue;
|
||||
}
|
||||
QList<QUuid> avatarEntityIDs = _avatarEntityData.keys();
|
||||
unsigned int avatarEntityCount = avatarEntityIDs.size();
|
||||
unsigned int previousAvatarEntityCount = _avatarEntityCountSetting.get(0);
|
||||
resizeAvatarEntitySettingHandles(std::max<unsigned int>(avatarEntityCount, previousAvatarEntityCount));
|
||||
_avatarEntityCountSetting.set(avatarEntityCount);
|
||||
|
||||
settings.setArrayIndex(avatarEntityIndex);
|
||||
settings.setValue("id", entityID);
|
||||
settings.setValue("properties", _avatarEntityData.value(entityID));
|
||||
unsigned int avatarEntityIndex = 0;
|
||||
for (auto entityID : avatarEntityIDs) {
|
||||
_avatarEntityIDSettings[avatarEntityIndex].set(entityID);
|
||||
_avatarEntityDataSettings[avatarEntityIndex].set(_avatarEntityData.value(entityID));
|
||||
avatarEntityIndex++;
|
||||
}
|
||||
|
||||
// clean up any left-over (due to the list shrinking) slots
|
||||
for (; avatarEntityIndex < previousAvatarEntityCount; avatarEntityIndex++) {
|
||||
_avatarEntityIDSettings[avatarEntityIndex].remove();
|
||||
_avatarEntityDataSettings[avatarEntityIndex].remove();
|
||||
}
|
||||
});
|
||||
settings.endArray();
|
||||
|
||||
settings.setValue("displayName", _displayName);
|
||||
settings.setValue("collisionSoundURL", _collisionSoundURL);
|
||||
settings.setValue("useSnapTurn", _useSnapTurn);
|
||||
settings.setValue("userHeight", getUserHeight());
|
||||
settings.setValue("flyingHMD", getFlyingHMDPref());
|
||||
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
float loadSetting(Settings& settings, const QString& name, float defaultValue) {
|
||||
|
@ -1314,66 +1329,36 @@ void MyAvatar::setEnableInverseKinematics(bool isEnabled) {
|
|||
}
|
||||
|
||||
void MyAvatar::loadData() {
|
||||
Settings settings;
|
||||
settings.beginGroup("Avatar");
|
||||
getHead()->setBasePitch(_headPitchSetting.get());
|
||||
|
||||
getHead()->setBasePitch(loadSetting(settings, "headPitch", 0.0f));
|
||||
_yawSpeed = _yawSpeedSetting.get(_yawSpeed);
|
||||
_pitchSpeed = _pitchSpeedSetting.get(_pitchSpeed);
|
||||
|
||||
_yawSpeed = loadSetting(settings, "yawSpeed", _yawSpeed);
|
||||
_pitchSpeed = loadSetting(settings, "pitchSpeed", _pitchSpeed);
|
||||
|
||||
_prefOverrideAnimGraphUrl.set(QUrl(settings.value("animGraphURL", "").toString()));
|
||||
_fullAvatarURLFromPreferences = settings.value("fullAvatarURL", AvatarData::defaultFullAvatarModelUrl()).toUrl();
|
||||
_fullAvatarModelName = settings.value("fullAvatarModelName", DEFAULT_FULL_AVATAR_MODEL_NAME).toString();
|
||||
_prefOverrideAnimGraphUrl.set(_prefOverrideAnimGraphUrl.get().toString());
|
||||
_fullAvatarURLFromPreferences = _fullAvatarURLSetting.get(QUrl(AvatarData::defaultFullAvatarModelUrl()));
|
||||
_fullAvatarModelName = _fullAvatarModelNameSetting.get(DEFAULT_FULL_AVATAR_MODEL_NAME).toString();
|
||||
|
||||
useFullAvatarURL(_fullAvatarURLFromPreferences, _fullAvatarModelName);
|
||||
|
||||
int attachmentCount = settings.beginReadArray("attachmentData");
|
||||
for (int i = 0; i < attachmentCount; i++) {
|
||||
settings.setArrayIndex(i);
|
||||
AttachmentData attachment;
|
||||
attachment.modelURL = settings.value("modelURL").toUrl();
|
||||
attachment.jointName = settings.value("jointName").toString();
|
||||
attachment.translation.x = loadSetting(settings, "translation_x", 0.0f);
|
||||
attachment.translation.y = loadSetting(settings, "translation_y", 0.0f);
|
||||
attachment.translation.z = loadSetting(settings, "translation_z", 0.0f);
|
||||
glm::vec3 eulers;
|
||||
eulers.x = loadSetting(settings, "rotation_x", 0.0f);
|
||||
eulers.y = loadSetting(settings, "rotation_y", 0.0f);
|
||||
eulers.z = loadSetting(settings, "rotation_z", 0.0f);
|
||||
attachment.rotation = glm::quat(eulers);
|
||||
attachment.scale = loadSetting(settings, "scale", 1.0f);
|
||||
attachment.isSoft = settings.value("isSoft").toBool();
|
||||
// old attachments are stored and loaded/converted later when rig is ready
|
||||
_oldAttachmentData.append(attachment);
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
int avatarEntityCount = settings.beginReadArray("avatarEntityData");
|
||||
int avatarEntityCount = _avatarEntityCountSetting.get(0);
|
||||
for (int i = 0; i < avatarEntityCount; i++) {
|
||||
settings.setArrayIndex(i);
|
||||
QUuid entityID = settings.value("id").toUuid();
|
||||
resizeAvatarEntitySettingHandles(i);
|
||||
// QUuid entityID = QUuid::createUuid(); // generate a new ID
|
||||
QByteArray properties = settings.value("properties").toByteArray();
|
||||
QUuid entityID = _avatarEntityIDSettings[i].get(QUuid());
|
||||
QByteArray properties = _avatarEntityDataSettings[i].get();
|
||||
updateAvatarEntity(entityID, properties);
|
||||
}
|
||||
settings.endArray();
|
||||
if (avatarEntityCount == 0) {
|
||||
// HACK: manually remove empty 'avatarEntityData' else legacy data may persist in settings file
|
||||
settings.remove("avatarEntityData");
|
||||
}
|
||||
|
||||
// Flying preferences must be loaded before calling setFlyingEnabled()
|
||||
Setting::Handle<bool> firstRunVal { Settings::firstRun, true };
|
||||
setFlyingHMDPref(firstRunVal.get() ? false : settings.value("flyingHMD").toBool());
|
||||
setFlyingHMDPref(firstRunVal.get() ? false : _flyingHMDSetting.get());
|
||||
setFlyingEnabled(getFlyingEnabled());
|
||||
|
||||
setDisplayName(settings.value("displayName").toString());
|
||||
setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString());
|
||||
setSnapTurn(settings.value("useSnapTurn", _useSnapTurn).toBool());
|
||||
setDominantHand(settings.value("dominantHand", _dominantHand).toString().toLower());
|
||||
setUserHeight(settings.value("userHeight", DEFAULT_AVATAR_HEIGHT).toDouble());
|
||||
settings.endGroup();
|
||||
setDisplayName(_displayNameSetting.get());
|
||||
setCollisionSoundURL(_collisionSoundURLSetting.get(QUrl(DEFAULT_AVATAR_COLLISION_SOUND_URL)).toString());
|
||||
setSnapTurn(_useSnapTurnSetting.get());
|
||||
setDominantHand(_dominantHandSetting.get(DOMINANT_RIGHT_HAND).toLower());
|
||||
setUserHeight(_userHeightSetting.get(DEFAULT_AVATAR_HEIGHT));
|
||||
|
||||
setEnableMeshVisible(Menu::getInstance()->isOptionChecked(MenuOption::MeshVisible));
|
||||
_follow.setToggleHipsFollowing (Menu::getInstance()->isOptionChecked(MenuOption::ToggleHipsFollowing));
|
||||
|
@ -1442,6 +1427,7 @@ AttachmentData MyAvatar::loadAttachmentData(const QUrl& modelURL, const QString&
|
|||
return attachment;
|
||||
}
|
||||
|
||||
|
||||
int MyAvatar::parseDataFromBuffer(const QByteArray& buffer) {
|
||||
qCDebug(interfaceapp) << "Error: ignoring update packet for MyAvatar"
|
||||
<< " packetLength = " << buffer.size();
|
||||
|
@ -1748,6 +1734,7 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
|
||||
_headBoneSet.clear();
|
||||
_cauterizationNeedsUpdate = true;
|
||||
_skeletonModelLoaded = false;
|
||||
|
||||
std::shared_ptr<QMetaObject::Connection> skeletonConnection = std::make_shared<QMetaObject::Connection>();
|
||||
*skeletonConnection = QObject::connect(_skeletonModel.get(), &SkeletonModel::skeletonLoaded, [this, skeletonModelChangeCount, skeletonConnection]() {
|
||||
|
@ -1765,6 +1752,7 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
_skeletonModel->setCauterizeBoneSet(_headBoneSet);
|
||||
_fstAnimGraphOverrideUrl = _skeletonModel->getGeometry()->getAnimGraphOverrideUrl();
|
||||
initAnimGraph();
|
||||
_skeletonModelLoaded = true;
|
||||
}
|
||||
QObject::disconnect(*skeletonConnection);
|
||||
});
|
||||
|
@ -2899,10 +2887,7 @@ void MyAvatar::restrictScaleFromDomainSettings(const QJsonObject& domainSettings
|
|||
}
|
||||
|
||||
// Set avatar current scale
|
||||
Settings settings;
|
||||
settings.beginGroup("Avatar");
|
||||
_targetScale = loadSetting(settings, "scale", 1.0f);
|
||||
|
||||
_targetScale = _scaleSetting.get();
|
||||
// clamp the desired _targetScale by the domain limits NOW, don't try to gracefully animate. Because
|
||||
// this might cause our avatar to become embedded in the terrain.
|
||||
_targetScale = getDomainLimitedScale();
|
||||
|
@ -2914,7 +2899,6 @@ void MyAvatar::restrictScaleFromDomainSettings(const QJsonObject& domainSettings
|
|||
|
||||
setModelScale(_targetScale);
|
||||
rebuildCollisionShape();
|
||||
settings.endGroup();
|
||||
|
||||
_haveReceivedHeightLimitsFromDomain = true;
|
||||
}
|
||||
|
@ -2925,10 +2909,7 @@ void MyAvatar::leaveDomain() {
|
|||
}
|
||||
|
||||
void MyAvatar::saveAvatarScale() {
|
||||
Settings settings;
|
||||
settings.beginGroup("Avatar");
|
||||
settings.setValue("scale", _targetScale);
|
||||
settings.endGroup();
|
||||
_scaleSetting.set(_targetScale);
|
||||
}
|
||||
|
||||
void MyAvatar::clearScaleRestriction() {
|
||||
|
@ -2972,46 +2953,10 @@ void MyAvatar::goToLocation(const QVariant& propertiesVar) {
|
|||
}
|
||||
|
||||
void MyAvatar::goToFeetLocation(const glm::vec3& newPosition,
|
||||
bool hasOrientation, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation) {
|
||||
|
||||
qCDebug(interfaceapp).nospace() << "MyAvatar goToFeetLocation - moving to " << newPosition.x << ", "
|
||||
<< newPosition.y << ", " << newPosition.z;
|
||||
|
||||
ShapeInfo shapeInfo;
|
||||
computeShapeInfo(shapeInfo);
|
||||
glm::vec3 halfExtents = shapeInfo.getHalfExtents();
|
||||
glm::vec3 localFeetPos = shapeInfo.getOffset() - glm::vec3(0.0f, halfExtents.y + halfExtents.x, 0.0f);
|
||||
glm::mat4 localFeet = createMatFromQuatAndPos(Quaternions::IDENTITY, localFeetPos);
|
||||
|
||||
glm::mat4 worldFeet = createMatFromQuatAndPos(Quaternions::IDENTITY, newPosition);
|
||||
|
||||
glm::mat4 avatarMat = worldFeet * glm::inverse(localFeet);
|
||||
|
||||
glm::vec3 adjustedPosition = extractTranslation(avatarMat);
|
||||
|
||||
_goToPending = true;
|
||||
_goToPosition = adjustedPosition;
|
||||
_goToOrientation = getWorldOrientation();
|
||||
if (hasOrientation) {
|
||||
qCDebug(interfaceapp).nospace() << "MyAvatar goToFeetLocation - new orientation is "
|
||||
<< newOrientation.x << ", " << newOrientation.y << ", " << newOrientation.z << ", " << newOrientation.w;
|
||||
|
||||
// orient the user to face the target
|
||||
glm::quat quatOrientation = cancelOutRollAndPitch(newOrientation);
|
||||
|
||||
if (shouldFaceLocation) {
|
||||
quatOrientation = newOrientation * glm::angleAxis(PI, Vectors::UP);
|
||||
|
||||
// move the user a couple units away
|
||||
const float DISTANCE_TO_USER = 2.0f;
|
||||
_goToPosition = adjustedPosition - quatOrientation * IDENTITY_FORWARD * DISTANCE_TO_USER;
|
||||
}
|
||||
|
||||
_goToOrientation = quatOrientation;
|
||||
}
|
||||
|
||||
emit transformChanged();
|
||||
bool hasOrientation, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation) {
|
||||
_goToFeetAjustment = true;
|
||||
goToLocation(newPosition, hasOrientation, newOrientation, shouldFaceLocation);
|
||||
}
|
||||
|
||||
void MyAvatar::goToLocation(const glm::vec3& newPosition,
|
||||
|
|
|
@ -550,6 +550,7 @@ public:
|
|||
float getHMDRollControlRate() const { return _hmdRollControlRate; }
|
||||
|
||||
// get/set avatar data
|
||||
void resizeAvatarEntitySettingHandles(unsigned int avatarEntityIndex);
|
||||
void saveData();
|
||||
void loadData();
|
||||
|
||||
|
@ -1731,6 +1732,7 @@ private:
|
|||
bool _goToPending { false };
|
||||
bool _physicsSafetyPending { false };
|
||||
bool _goToSafe { true };
|
||||
bool _goToFeetAjustment { false };
|
||||
glm::vec3 _goToPosition;
|
||||
glm::quat _goToOrientation;
|
||||
|
||||
|
@ -1806,6 +1808,24 @@ private:
|
|||
|
||||
bool _haveReceivedHeightLimitsFromDomain { false };
|
||||
int _disableHandTouchCount { 0 };
|
||||
bool _skeletonModelLoaded { false };
|
||||
|
||||
Setting::Handle<QString> _dominantHandSetting;
|
||||
Setting::Handle<float> _headPitchSetting;
|
||||
Setting::Handle<float> _scaleSetting;
|
||||
Setting::Handle<float> _yawSpeedSetting;
|
||||
Setting::Handle<float> _pitchSpeedSetting;
|
||||
Setting::Handle<QUrl> _fullAvatarURLSetting;
|
||||
Setting::Handle<QUrl> _fullAvatarModelNameSetting;
|
||||
Setting::Handle<QUrl> _animGraphURLSetting;
|
||||
Setting::Handle<QString> _displayNameSetting;
|
||||
Setting::Handle<QUrl> _collisionSoundURLSetting;
|
||||
Setting::Handle<bool> _useSnapTurnSetting;
|
||||
Setting::Handle<float> _userHeightSetting;
|
||||
Setting::Handle<bool> _flyingHMDSetting;
|
||||
Setting::Handle<int> _avatarEntityCountSetting;
|
||||
std::vector<Setting::Handle<QUuid>> _avatarEntityIDSettings;
|
||||
std::vector<Setting::Handle<QByteArray>> _avatarEntityDataSettings;
|
||||
};
|
||||
|
||||
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);
|
||||
|
|
|
@ -119,6 +119,11 @@ bool OtherAvatar::shouldBeInPhysicsSimulation() const {
|
|||
return (_workloadRegion < workload::Region::R3 && !isDead());
|
||||
}
|
||||
|
||||
bool OtherAvatar::needsPhysicsUpdate() const {
|
||||
constexpr uint32_t FLAGS_OF_INTEREST = Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS | Simulation::DIRTY_POSITION;
|
||||
return (_motionState && (bool)(_motionState->getIncomingDirtyFlags() & FLAGS_OF_INTEREST));
|
||||
}
|
||||
|
||||
void OtherAvatar::rebuildCollisionShape() {
|
||||
if (_motionState) {
|
||||
_motionState->addDirtyFlags(Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
void setWorkloadRegion(uint8_t region);
|
||||
bool shouldBeInPhysicsSimulation() const;
|
||||
bool needsPhysicsUpdate() const;
|
||||
|
||||
friend AvatarManager;
|
||||
|
||||
|
|
|
@ -47,6 +47,54 @@ QmlCommerce::QmlCommerce() {
|
|||
_appsPath = PathUtils::getAppDataPath() + "Apps/";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void QmlCommerce::openSystemApp(const QString& appName) {
|
||||
static QMap<QString, QString> systemApps {
|
||||
{"GOTO", "hifi/tablet/TabletAddressDialog.qml"},
|
||||
{"PEOPLE", "hifi/Pal.qml"},
|
||||
{"WALLET", "hifi/commerce/wallet/Wallet.qml"},
|
||||
{"MARKET", "/marketplace.html"}
|
||||
};
|
||||
|
||||
static QMap<QString, QString> systemInject{
|
||||
{"MARKET", "/scripts/system/html/js/marketplacesInject.js"}
|
||||
};
|
||||
|
||||
|
||||
auto tablet = dynamic_cast<TabletProxy*>(
|
||||
DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
||||
|
||||
QMap<QString, QString>::const_iterator appPathIter = systemApps.find(appName);
|
||||
if (appPathIter != systemApps.end()) {
|
||||
if (appPathIter->contains(".qml", Qt::CaseInsensitive)) {
|
||||
tablet->loadQMLSource(*appPathIter);
|
||||
}
|
||||
else if (appPathIter->contains(".html", Qt::CaseInsensitive)) {
|
||||
QMap<QString, QString>::const_iterator injectIter = systemInject.find(appName);
|
||||
if (appPathIter == systemInject.end()) {
|
||||
tablet->gotoWebScreen(NetworkingConstants::METAVERSE_SERVER_URL().toString() + *appPathIter);
|
||||
}
|
||||
else {
|
||||
QString inject = "file:///" + qApp->applicationDirPath() + *injectIter;
|
||||
tablet->gotoWebScreen(NetworkingConstants::METAVERSE_SERVER_URL().toString() + *appPathIter, inject);
|
||||
}
|
||||
}
|
||||
else {
|
||||
qCDebug(commerce) << "Attempted to open unknown type of URL!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qCDebug(commerce) << "Attempted to open unknown APP!";
|
||||
return;
|
||||
}
|
||||
|
||||
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
||||
}
|
||||
|
||||
|
||||
void QmlCommerce::getWalletStatus() {
|
||||
auto wallet = DependencyManager::get<Wallet>();
|
||||
wallet->getWalletStatus();
|
||||
|
@ -199,12 +247,18 @@ void QmlCommerce::transferAssetToUsername(const QString& username,
|
|||
}
|
||||
|
||||
void QmlCommerce::replaceContentSet(const QString& itemHref, const QString& certificateID) {
|
||||
auto ledger = DependencyManager::get<Ledger>();
|
||||
ledger->updateLocation(certificateID, DependencyManager::get<AddressManager>()->getPlaceName(), true);
|
||||
if (!certificateID.isEmpty()) {
|
||||
auto ledger = DependencyManager::get<Ledger>();
|
||||
ledger->updateLocation(
|
||||
certificateID,
|
||||
DependencyManager::get<AddressManager>()->getPlaceName(),
|
||||
true);
|
||||
}
|
||||
qApp->replaceDomainContent(itemHref);
|
||||
QJsonObject messageProperties = { { "status", "SuccessfulRequestToReplaceContent" }, { "content_set_url", itemHref } };
|
||||
QJsonObject messageProperties = {
|
||||
{ "status", "SuccessfulRequestToReplaceContent" },
|
||||
{ "content_set_url", itemHref } };
|
||||
UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties);
|
||||
|
||||
emit contentSetChanged(itemHref);
|
||||
}
|
||||
|
||||
|
@ -228,6 +282,7 @@ QString QmlCommerce::getInstalledApps(const QString& justInstalledAppID) {
|
|||
// Thus, we protect against deleting the .app.json from the user's disk (below)
|
||||
// by skipping that check for the app we just installed.
|
||||
if ((justInstalledAppID != "") && ((justInstalledAppID + ".app.json") == appFileName)) {
|
||||
installedAppsFromMarketplace += appFileName + ",";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -353,7 +408,7 @@ bool QmlCommerce::openApp(const QString& itemHref) {
|
|||
// Read from the file to know what .html or .qml document to open
|
||||
QFile appFile(_appsPath + "/" + appHref.fileName());
|
||||
if (!appFile.open(QIODevice::ReadOnly)) {
|
||||
qCDebug(commerce) << "Couldn't open local .app.json file.";
|
||||
qCDebug(commerce) << "Couldn't open local .app.json file:" << appFile;
|
||||
return false;
|
||||
}
|
||||
QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(appFile.readAll());
|
||||
|
|
|
@ -24,6 +24,7 @@ class QmlCommerce : public QObject {
|
|||
|
||||
public:
|
||||
QmlCommerce();
|
||||
void openSystemApp(const QString& appPath);
|
||||
|
||||
signals:
|
||||
void walletStatusResult(uint walletStatus);
|
||||
|
|
|
@ -176,7 +176,7 @@ int main(int argc, const char* argv[]) {
|
|||
if (socket.waitForConnected(LOCAL_SERVER_TIMEOUT_MS)) {
|
||||
if (parser.isSet(urlOption)) {
|
||||
QUrl url = QUrl(parser.value(urlOption));
|
||||
if (url.isValid() && url.scheme() == URL_SCHEME_HIFI) {
|
||||
if (url.isValid() && (url.scheme() == URL_SCHEME_HIFI || url.scheme() == URL_SCHEME_HIFIAPP)) {
|
||||
qDebug() << "Writing URL to local socket";
|
||||
socket.write(url.toString().toUtf8());
|
||||
if (!socket.waitForBytesWritten(5000)) {
|
||||
|
|
|
@ -35,6 +35,14 @@ void LaserPointer::editRenderStatePath(const std::string& state, const QVariant&
|
|||
}
|
||||
}
|
||||
|
||||
PickResultPointer LaserPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
|
||||
auto rayPickResult = std::dynamic_pointer_cast<RayPickResult>(pickResult);
|
||||
if (!rayPickResult) {
|
||||
return std::make_shared<RayPickResult>();
|
||||
}
|
||||
return std::make_shared<RayPickResult>(*rayPickResult.get());
|
||||
}
|
||||
|
||||
QVariantMap LaserPointer::toVariantMap() const {
|
||||
QVariantMap qVariantMap;
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||
|
||||
protected:
|
||||
PickResultPointer getPickResultCopy(const PickResultPointer& pickResult) const override;
|
||||
|
||||
void editRenderStatePath(const std::string& state, const QVariant& pathProps) override;
|
||||
|
||||
glm::vec3 getPickOrigin(const PickResultPointer& pickResult) const override;
|
||||
|
|
|
@ -30,6 +30,14 @@ ParabolaPointer::ParabolaPointer(const QVariant& rayProps, const RenderStateMap&
|
|||
{
|
||||
}
|
||||
|
||||
PickResultPointer ParabolaPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
|
||||
auto parabolaPickResult = std::dynamic_pointer_cast<ParabolaPickResult>(pickResult);
|
||||
if (!parabolaPickResult) {
|
||||
return std::make_shared<ParabolaPickResult>();
|
||||
}
|
||||
return std::make_shared<ParabolaPickResult>(*parabolaPickResult.get());
|
||||
}
|
||||
|
||||
void ParabolaPointer::editRenderStatePath(const std::string& state, const QVariant& pathProps) {
|
||||
auto renderState = std::static_pointer_cast<RenderState>(_renderStates[state]);
|
||||
if (renderState) {
|
||||
|
@ -382,9 +390,8 @@ void ParabolaPointer::RenderState::ParabolaRenderItem::updateBounds() {
|
|||
|
||||
const gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::getParabolaPipeline() {
|
||||
if (!_parabolaPipeline || !_transparentParabolaPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola);
|
||||
|
||||
{
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola);
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setBlendFunction(false,
|
||||
|
@ -396,6 +403,7 @@ const gpu::PipelinePointer ParabolaPointer::RenderState::ParabolaRenderItem::get
|
|||
}
|
||||
|
||||
{
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render_utils::program::parabola_translucent);
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setBlendFunction(true,
|
||||
|
|
|
@ -102,6 +102,8 @@ public:
|
|||
static std::shared_ptr<StartEndRenderState> buildRenderState(const QVariantMap& propMap);
|
||||
|
||||
protected:
|
||||
virtual PickResultPointer getPickResultCopy(const PickResultPointer& pickResult) const override;
|
||||
|
||||
void editRenderStatePath(const std::string& state, const QVariant& pathProps) override;
|
||||
|
||||
glm::vec3 getPickOrigin(const PickResultPointer& pickResult) const override;
|
||||
|
|
|
@ -147,6 +147,14 @@ bool StylusPointer::shouldTrigger(const PickResultPointer& pickResult) {
|
|||
return false;
|
||||
}
|
||||
|
||||
PickResultPointer StylusPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
|
||||
auto stylusPickResult = std::dynamic_pointer_cast<StylusPickResult>(pickResult);
|
||||
if (!stylusPickResult) {
|
||||
return std::make_shared<StylusPickResult>();
|
||||
}
|
||||
return std::make_shared<StylusPickResult>(*stylusPickResult.get());
|
||||
}
|
||||
|
||||
Pointer::PickedObject StylusPointer::getHoveredObject(const PickResultPointer& pickResult) {
|
||||
auto stylusPickResult = std::static_pointer_cast<const StylusPickResult>(pickResult);
|
||||
if (!stylusPickResult) {
|
||||
|
|
|
@ -42,6 +42,7 @@ protected:
|
|||
Buttons getPressedButtons(const PickResultPointer& pickResult) override;
|
||||
bool shouldHover(const PickResultPointer& pickResult) override;
|
||||
bool shouldTrigger(const PickResultPointer& pickResult) override;
|
||||
virtual PickResultPointer getPickResultCopy(const PickResultPointer& pickResult) const override;
|
||||
|
||||
PointerEvent buildPointerEvent(const PickedObject& target, const PickResultPointer& pickResult, const std::string& button = "", bool hover = true) override;
|
||||
|
||||
|
|
|
@ -180,6 +180,14 @@ void WindowScriptingInterface::setPreviousBrowseAssetLocation(const QString& loc
|
|||
Setting::Handle<QVariant>(LAST_BROWSE_ASSETS_LOCATION_SETTING).set(location);
|
||||
}
|
||||
|
||||
bool WindowScriptingInterface::getInterstitialModeEnabled() const {
|
||||
return DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::setInterstitialModeEnabled(bool enableInterstitialMode) {
|
||||
DependencyManager::get<NodeList>()->getDomainHandler().setInterstitialModeEnabled(enableInterstitialMode);
|
||||
}
|
||||
|
||||
bool WindowScriptingInterface::isPointOnDesktopWindow(QVariant point) {
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
return offscreenUi->isPointOnDesktopWindow(point);
|
||||
|
|
|
@ -49,6 +49,7 @@ class WindowScriptingInterface : public QObject, public Dependency {
|
|||
Q_PROPERTY(int innerHeight READ getInnerHeight)
|
||||
Q_PROPERTY(int x READ getX)
|
||||
Q_PROPERTY(int y READ getY)
|
||||
Q_PROPERTY(bool interstitialModeEnabled READ getInterstitialModeEnabled WRITE setInterstitialModeEnabled)
|
||||
|
||||
public:
|
||||
WindowScriptingInterface();
|
||||
|
@ -758,6 +759,9 @@ private:
|
|||
QString getPreviousBrowseAssetLocation() const;
|
||||
void setPreviousBrowseAssetLocation(const QString& location);
|
||||
|
||||
bool getInterstitialModeEnabled() const;
|
||||
void setInterstitialModeEnabled(bool enableInterstitialMode);
|
||||
|
||||
void ensureReticleVisible() const;
|
||||
|
||||
int createMessageBox(QString title, QString text, int buttons, int defaultButton);
|
||||
|
|
|
@ -42,6 +42,29 @@ void AnimStats::updateStats(bool force) {
|
|||
auto myAvatar = avatarManager->getMyAvatar();
|
||||
auto debugAlphaMap = myAvatar->getSkeletonModel()->getRig().getDebugAlphaMap();
|
||||
|
||||
glm::vec3 position = myAvatar->getWorldPosition();
|
||||
glm::quat rotation = myAvatar->getWorldOrientation();
|
||||
glm::vec3 velocity = myAvatar->getWorldVelocity();
|
||||
|
||||
_positionText = QString("Position: (%1, %2, %3)").
|
||||
arg(QString::number(position.x, 'f', 2)).
|
||||
arg(QString::number(position.y, 'f', 2)).
|
||||
arg(QString::number(position.z, 'f', 2));
|
||||
emit positionTextChanged();
|
||||
|
||||
glm::vec3 eulerRotation = safeEulerAngles(rotation);
|
||||
_rotationText = QString("Heading: %1").
|
||||
arg(QString::number(glm::degrees(eulerRotation.y), 'f', 2));
|
||||
emit rotationTextChanged();
|
||||
|
||||
// transform velocity into rig coordinate frame. z forward.
|
||||
glm::vec3 localVelocity = Quaternions::Y_180 * glm::inverse(rotation) * velocity;
|
||||
_velocityText = QString("Local Vel: (%1, %2, %3)").
|
||||
arg(QString::number(localVelocity.x, 'f', 2)).
|
||||
arg(QString::number(localVelocity.y, 'f', 2)).
|
||||
arg(QString::number(localVelocity.z, 'f', 2));
|
||||
emit velocityTextChanged();
|
||||
|
||||
// update animation debug alpha values
|
||||
QStringList newAnimAlphaValues;
|
||||
qint64 now = usecTimestampNow();
|
||||
|
|
|
@ -19,6 +19,9 @@ class AnimStats : public QQuickItem {
|
|||
Q_PROPERTY(QStringList animAlphaValues READ animAlphaValues NOTIFY animAlphaValuesChanged)
|
||||
Q_PROPERTY(QStringList animVars READ animVars NOTIFY animVarsChanged)
|
||||
Q_PROPERTY(QStringList animStateMachines READ animStateMachines NOTIFY animStateMachinesChanged)
|
||||
Q_PROPERTY(QString positionText READ positionText NOTIFY positionTextChanged)
|
||||
Q_PROPERTY(QString rotationText READ rotationText NOTIFY rotationTextChanged)
|
||||
Q_PROPERTY(QString velocityText READ velocityText NOTIFY velocityTextChanged)
|
||||
|
||||
public:
|
||||
static AnimStats* getInstance();
|
||||
|
@ -27,9 +30,13 @@ public:
|
|||
|
||||
void updateStats(bool force = false);
|
||||
|
||||
QStringList animAlphaValues() { return _animAlphaValues; }
|
||||
QStringList animVars() { return _animVarsList; }
|
||||
QStringList animStateMachines() { return _animStateMachines; }
|
||||
QStringList animAlphaValues() const { return _animAlphaValues; }
|
||||
QStringList animVars() const { return _animVarsList; }
|
||||
QStringList animStateMachines() const { return _animStateMachines; }
|
||||
|
||||
QString positionText() const { return _positionText; }
|
||||
QString rotationText() const { return _rotationText; }
|
||||
QString velocityText() const { return _velocityText; }
|
||||
|
||||
public slots:
|
||||
void forceUpdateStats() { updateStats(true); }
|
||||
|
@ -39,6 +46,9 @@ signals:
|
|||
void animAlphaValuesChanged();
|
||||
void animVarsChanged();
|
||||
void animStateMachinesChanged();
|
||||
void positionTextChanged();
|
||||
void rotationTextChanged();
|
||||
void velocityTextChanged();
|
||||
|
||||
private:
|
||||
QStringList _animAlphaValues;
|
||||
|
@ -50,6 +60,10 @@ private:
|
|||
std::map<QString, qint64> _animVarChangedTimers; // last time animVar value has changed.
|
||||
|
||||
QStringList _animStateMachines;
|
||||
|
||||
QString _positionText;
|
||||
QString _rotationText;
|
||||
QString _velocityText;
|
||||
};
|
||||
|
||||
#endif // hifi_AnimStats_h
|
||||
|
|
|
@ -252,12 +252,6 @@ bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityIt
|
|||
void ContextOverlayInterface::contextOverlays_mousePressOnOverlay(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (overlayID == _contextOverlayID && event.getButton() == PointerEvent::PrimaryButton) {
|
||||
qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "Overlay ID:" << overlayID;
|
||||
Setting::Handle<bool> _settingSwitch{ "commerce", true };
|
||||
if (_settingSwitch.get()) {
|
||||
openInspectionCertificate();
|
||||
} else {
|
||||
openMarketplace();
|
||||
}
|
||||
emit contextOverlayClicked(_currentEntityWithContextOverlay);
|
||||
_contextOverlayJustClicked = true;
|
||||
}
|
||||
|
@ -390,34 +384,6 @@ void ContextOverlayInterface::requestOwnershipVerification(const QUuid& entityID
|
|||
}
|
||||
}
|
||||
|
||||
static const QString INSPECTION_CERTIFICATE_QML_PATH = "hifi/commerce/inspectionCertificate/InspectionCertificate.qml";
|
||||
void ContextOverlayInterface::openInspectionCertificate() {
|
||||
// lets open the tablet to the inspection certificate QML
|
||||
if (!_currentEntityWithContextOverlay.isNull() && _entityMarketplaceID.length() > 0) {
|
||||
setLastInspectedEntity(_currentEntityWithContextOverlay);
|
||||
auto tablet = dynamic_cast<TabletProxy*>(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||
tablet->loadQMLSource(INSPECTION_CERTIFICATE_QML_PATH);
|
||||
_hmdScriptingInterface->openTablet();
|
||||
}
|
||||
}
|
||||
|
||||
static const QString MARKETPLACE_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/marketplace/items/";
|
||||
|
||||
void ContextOverlayInterface::openMarketplace() {
|
||||
// lets open the tablet and go to the current item in
|
||||
// the marketplace (if the current entity has a
|
||||
// marketplaceID)
|
||||
if (!_currentEntityWithContextOverlay.isNull() && _entityMarketplaceID.length() > 0) {
|
||||
auto tablet = dynamic_cast<TabletProxy*>(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||
// construct the url to the marketplace item
|
||||
QString url = MARKETPLACE_BASE_URL + _entityMarketplaceID;
|
||||
QString MARKETPLACES_INJECT_SCRIPT_PATH = "file:///" + qApp->applicationDirPath() + "/scripts/system/html/js/marketplacesInject.js";
|
||||
tablet->gotoWebScreen(url, MARKETPLACES_INJECT_SCRIPT_PATH);
|
||||
_hmdScriptingInterface->openTablet();
|
||||
_isInMarketplaceInspectionMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ContextOverlayInterface::enableEntityHighlight(const EntityItemID& entityItemID) {
|
||||
_selectionScriptingInterface->addToSelectedItemsList("contextOverlayHighlightList", "entity", entityItemID);
|
||||
}
|
||||
|
|
|
@ -94,8 +94,6 @@ private:
|
|||
|
||||
bool _isInMarketplaceInspectionMode { false };
|
||||
|
||||
void openInspectionCertificate();
|
||||
void openMarketplace();
|
||||
void enableEntityHighlight(const EntityItemID& entityItemID);
|
||||
void disableEntityHighlight(const EntityItemID& entityItemID);
|
||||
|
||||
|
|
|
@ -88,6 +88,10 @@ const AnimPoseVec& AnimStateMachine::evaluate(const AnimVariantMap& animVars, co
|
|||
processOutputJoints(triggersOut);
|
||||
|
||||
context.addStateMachineInfo(_id, _currentState->getID(), _previousState->getID(), _duringInterp, _alpha);
|
||||
if (_duringInterp) {
|
||||
// hack: add previoius state to debug alpha map, with parens around it's name.
|
||||
context.setDebugAlpha(QString("(%1)").arg(_previousState->getID()), 1.0f - _alpha, AnimNodeType::Clip);
|
||||
}
|
||||
|
||||
return _poses;
|
||||
}
|
||||
|
|
|
@ -140,14 +140,19 @@ std::map<QString, QString> AnimVariantMap::toDebugMap() const {
|
|||
result[pair.first] = QString::number(pair.second.getFloat(), 'f', 3);
|
||||
break;
|
||||
case AnimVariant::Type::Vec3: {
|
||||
// To prevent filling up debug stats, don't show vec3 values
|
||||
/*
|
||||
glm::vec3 value = pair.second.getVec3();
|
||||
result[pair.first] = QString("(%1, %2, %3)").
|
||||
arg(QString::number(value.x, 'f', 3)).
|
||||
arg(QString::number(value.y, 'f', 3)).
|
||||
arg(QString::number(value.z, 'f', 3));
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case AnimVariant::Type::Quat: {
|
||||
// To prevent filling up the anim stats, don't show quat values
|
||||
/*
|
||||
glm::quat value = pair.second.getQuat();
|
||||
result[pair.first] = QString("(%1, %2, %3, %4)").
|
||||
arg(QString::number(value.x, 'f', 3)).
|
||||
|
@ -155,10 +160,14 @@ std::map<QString, QString> AnimVariantMap::toDebugMap() const {
|
|||
arg(QString::number(value.z, 'f', 3)).
|
||||
arg(QString::number(value.w, 'f', 3));
|
||||
break;
|
||||
*/
|
||||
}
|
||||
case AnimVariant::Type::String:
|
||||
// To prevent filling up anim stats, don't show string values
|
||||
/*
|
||||
result[pair.first] = pair.second.getString();
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
assert(("invalid AnimVariant::Type", false));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "AudioHelpers.h"
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#define VOICE_RECOGNITION "voicerecognition"
|
||||
#include <QtAndroidExtras/QAndroidJniObject>
|
||||
#endif
|
||||
|
||||
|
@ -101,6 +100,13 @@ QList<QAudioDeviceInfo> getAvailableDevices(QAudio::Mode mode) {
|
|||
|
||||
// now called from a background thread, to keep blocking operations off the audio thread
|
||||
void AudioClient::checkDevices() {
|
||||
// Make sure we're not shutting down
|
||||
Lock timerMutex(_checkDevicesMutex);
|
||||
// If we HAVE shut down after we were queued, but prior to execution, early exit
|
||||
if (nullptr == _checkDevicesTimer) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto inputDevices = getAvailableDevices(QAudio::AudioInput);
|
||||
auto outputDevices = getAvailableDevices(QAudio::AudioOutput);
|
||||
|
||||
|
@ -210,6 +216,7 @@ AudioClient::AudioClient() :
|
|||
_positionGetter(DEFAULT_POSITION_GETTER),
|
||||
#if defined(Q_OS_ANDROID)
|
||||
_checkInputTimer(this),
|
||||
_isHeadsetPluggedIn(false),
|
||||
#endif
|
||||
_orientationGetter(DEFAULT_ORIENTATION_GETTER) {
|
||||
// avoid putting a lock in the device callback
|
||||
|
@ -278,9 +285,6 @@ void AudioClient::customDeleter() {
|
|||
_shouldRestartInputSetup = false;
|
||||
#endif
|
||||
stop();
|
||||
_checkDevicesTimer->stop();
|
||||
_checkPeakValuesTimer->stop();
|
||||
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
@ -461,9 +465,14 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) {
|
|||
|
||||
#if defined (Q_OS_ANDROID)
|
||||
if (mode == QAudio::AudioInput) {
|
||||
Setting::Handle<bool> enableAEC(SETTING_AEC_KEY, false);
|
||||
bool aecEnabled = enableAEC.get();
|
||||
auto audioClient = DependencyManager::get<AudioClient>();
|
||||
bool headsetOn = audioClient? audioClient->isHeadsetPluggedIn() : false;
|
||||
auto inputDevices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
|
||||
for (auto inputDevice : inputDevices) {
|
||||
if (inputDevice.deviceName() == VOICE_RECOGNITION) {
|
||||
if (((headsetOn || !aecEnabled) && inputDevice.deviceName() == VOICE_RECOGNITION) ||
|
||||
((!headsetOn && aecEnabled) && inputDevice.deviceName() == VOICE_COMMUNICATION)) {
|
||||
return inputDevice;
|
||||
}
|
||||
}
|
||||
|
@ -648,12 +657,26 @@ void AudioClient::start() {
|
|||
}
|
||||
|
||||
void AudioClient::stop() {
|
||||
|
||||
qCDebug(audioclient) << "AudioClient::stop(), requesting switchInputToAudioDevice() to shut down";
|
||||
switchInputToAudioDevice(QAudioDeviceInfo(), true);
|
||||
|
||||
qCDebug(audioclient) << "AudioClient::stop(), requesting switchOutputToAudioDevice() to shut down";
|
||||
switchOutputToAudioDevice(QAudioDeviceInfo(), true);
|
||||
|
||||
// Stop triggering the checks
|
||||
QObject::disconnect(_checkPeakValuesTimer, &QTimer::timeout, nullptr, nullptr);
|
||||
QObject::disconnect(_checkDevicesTimer, &QTimer::timeout, nullptr, nullptr);
|
||||
|
||||
// Destruction of the pointers will occur when the parent object (this) is destroyed)
|
||||
{
|
||||
Lock lock(_checkDevicesMutex);
|
||||
_checkDevicesTimer = nullptr;
|
||||
}
|
||||
{
|
||||
Lock lock(_checkPeakValuesMutex);
|
||||
_checkPeakValuesTimer = nullptr;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
_checkInputTimer.stop();
|
||||
disconnect(&_checkInputTimer, &QTimer::timeout, 0, 0);
|
||||
|
@ -1640,6 +1663,29 @@ void AudioClient::checkInputTimeout() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void AudioClient::setHeadsetPluggedIn(bool pluggedIn) {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
if (pluggedIn == !_isHeadsetPluggedIn && !_inputDeviceInfo.isNull()) {
|
||||
QAndroidJniObject brand = QAndroidJniObject::getStaticObjectField<jstring>("android/os/Build", "BRAND");
|
||||
// some samsung phones needs more time to shutdown the previous input device
|
||||
if (brand.toString().contains("samsung", Qt::CaseInsensitive)) {
|
||||
switchInputToAudioDevice(QAudioDeviceInfo(), true);
|
||||
QThread::msleep(200);
|
||||
}
|
||||
|
||||
Setting::Handle<bool> enableAEC(SETTING_AEC_KEY, false);
|
||||
bool aecEnabled = enableAEC.get();
|
||||
|
||||
if ((pluggedIn || !aecEnabled) && _inputDeviceInfo.deviceName() != VOICE_RECOGNITION) {
|
||||
switchAudioDevice(QAudio::AudioInput, VOICE_RECOGNITION);
|
||||
} else if (!pluggedIn && aecEnabled && _inputDeviceInfo.deviceName() != VOICE_COMMUNICATION) {
|
||||
switchAudioDevice(QAudio::AudioInput, VOICE_COMMUNICATION);
|
||||
}
|
||||
}
|
||||
_isHeadsetPluggedIn = pluggedIn;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AudioClient::outputNotify() {
|
||||
int recentUnfulfilled = _audioOutputIODevice.getRecentUnfulfilledReads();
|
||||
if (recentUnfulfilled > 0) {
|
||||
|
|
|
@ -64,6 +64,13 @@
|
|||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#if defined (Q_OS_ANDROID)
|
||||
#define VOICE_RECOGNITION "voicerecognition"
|
||||
#define VOICE_COMMUNICATION "voicecommunication"
|
||||
|
||||
#define SETTING_AEC_KEY "Android/aec"
|
||||
#endif
|
||||
|
||||
class QAudioInput;
|
||||
class QAudioOutput;
|
||||
class QIODevice;
|
||||
|
@ -169,6 +176,10 @@ public:
|
|||
static QString getWinDeviceName(wchar_t* guid);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
bool isHeadsetPluggedIn() { return _isHeadsetPluggedIn; }
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
void stop();
|
||||
|
@ -217,6 +228,9 @@ public slots:
|
|||
bool switchAudioDevice(QAudio::Mode mode, const QAudioDeviceInfo& deviceInfo = QAudioDeviceInfo());
|
||||
bool switchAudioDevice(QAudio::Mode mode, const QString& deviceName);
|
||||
|
||||
// Qt opensles plugin is not able to detect when the headset is plugged in
|
||||
void setHeadsetPluggedIn(bool pluggedIn);
|
||||
|
||||
float getInputVolume() const { return (_audioInput) ? (float)_audioInput->volume() : 0.0f; }
|
||||
void setInputVolume(float volume, bool emitSignal = true);
|
||||
void setReverb(bool reverb);
|
||||
|
@ -278,6 +292,7 @@ private:
|
|||
#ifdef Q_OS_ANDROID
|
||||
QTimer _checkInputTimer;
|
||||
long _inputReadsSinceLastCheck = 0l;
|
||||
bool _isHeadsetPluggedIn;
|
||||
#endif
|
||||
|
||||
class Gate {
|
||||
|
@ -432,7 +447,9 @@ private:
|
|||
bool _shouldRestartInputSetup { true }; // Should we restart the input device because of an unintended stop?
|
||||
#endif
|
||||
|
||||
Mutex _checkDevicesMutex;
|
||||
QTimer* _checkDevicesTimer { nullptr };
|
||||
Mutex _checkPeakValuesMutex;
|
||||
QTimer* _checkPeakValuesTimer { nullptr };
|
||||
|
||||
bool _isRecording { false };
|
||||
|
|
|
@ -40,6 +40,12 @@ void release(IAudioClient* audioClient) {
|
|||
}
|
||||
|
||||
void AudioClient::checkPeakValues() {
|
||||
// Guard against running during shutdown
|
||||
Lock timerMutex(_checkPeakValuesMutex);
|
||||
if (nullptr == _checkPeakValuesTimer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// prepare the windows environment
|
||||
CoInitialize(NULL);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define hifi_AudioHRTF_h
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
static const int HRTF_AZIMUTHS = 72; // 360 / 5-degree steps
|
||||
static const int HRTF_TAPS = 64; // minimum-phase FIR coefficients
|
||||
|
@ -56,6 +57,27 @@ public:
|
|||
void setGainAdjustment(float gain) { _gainAdjust = HRTF_GAIN * gain; };
|
||||
float getGainAdjustment() { return _gainAdjust; }
|
||||
|
||||
// clear internal state, but retain settings
|
||||
void reset() {
|
||||
// FIR history
|
||||
memset(_firState, 0, sizeof(_firState));
|
||||
|
||||
// integer delay history
|
||||
memset(_delayState, 0, sizeof(_delayState));
|
||||
|
||||
// biquad history
|
||||
memset(_bqState, 0, sizeof(_bqState));
|
||||
|
||||
// parameter history
|
||||
_azimuthState = 0.0f;
|
||||
_distanceState = 0.0f;
|
||||
_gainState = 0.0f;
|
||||
|
||||
// _gainAdjust is retained
|
||||
|
||||
_silentState = true;
|
||||
}
|
||||
|
||||
private:
|
||||
AudioHRTF(const AudioHRTF&) = delete;
|
||||
AudioHRTF& operator=(const AudioHRTF&) = delete;
|
||||
|
@ -88,7 +110,7 @@ private:
|
|||
// global and local gain adjustment
|
||||
float _gainAdjust = HRTF_GAIN;
|
||||
|
||||
bool _silentState = false;
|
||||
bool _silentState = true;
|
||||
};
|
||||
|
||||
#endif // AudioHRTF_h
|
||||
|
|
|
@ -43,8 +43,11 @@ void soundSharedPointerFromScriptValue(const QScriptValue& object, SharedSoundPo
|
|||
}
|
||||
}
|
||||
|
||||
SoundScriptingInterface::SoundScriptingInterface(SharedSoundPointer sound) : _sound(sound) {
|
||||
QObject::connect(sound.data(), &Sound::ready, this, &SoundScriptingInterface::ready);
|
||||
SoundScriptingInterface::SoundScriptingInterface(const SharedSoundPointer& sound) : _sound(sound) {
|
||||
// During shutdown we can sometimes get an empty sound pointer back
|
||||
if (_sound) {
|
||||
QObject::connect(_sound.data(), &Sound::ready, this, &SoundScriptingInterface::ready);
|
||||
}
|
||||
}
|
||||
|
||||
Sound::Sound(const QUrl& url, bool isStereo, bool isAmbisonic) :
|
||||
|
|
|
@ -105,11 +105,11 @@ class SoundScriptingInterface : public QObject {
|
|||
Q_PROPERTY(float duration READ getDuration)
|
||||
|
||||
public:
|
||||
SoundScriptingInterface(SharedSoundPointer sound);
|
||||
SharedSoundPointer getSound() { return _sound; }
|
||||
SoundScriptingInterface(const SharedSoundPointer& sound);
|
||||
const SharedSoundPointer& getSound() { return _sound; }
|
||||
|
||||
bool isReady() const { return _sound->isReady(); }
|
||||
float getDuration() { return _sound->getDuration(); }
|
||||
bool isReady() const { return _sound ? _sound->isReady() : false; }
|
||||
float getDuration() { return _sound ? _sound->getDuration() : 0.0f; }
|
||||
|
||||
/**jsdoc
|
||||
* Triggered when the sound has been downloaded and is ready to be played.
|
||||
|
|
|
@ -2829,8 +2829,10 @@ void RayToAvatarIntersectionResultFromScriptValue(const QScriptValue& object, Ra
|
|||
value.extraInfo = object.property("extraInfo").toVariant().toMap();
|
||||
}
|
||||
|
||||
// these coefficients can be changed via JS for experimental tuning
|
||||
// use AvatatManager.setAvatarSortCoefficient("name", value) by a user with domain kick-rights
|
||||
float AvatarData::_avatarSortCoefficientSize { 8.0f };
|
||||
float AvatarData::_avatarSortCoefficientCenter { 4.0f };
|
||||
float AvatarData::_avatarSortCoefficientCenter { 0.25f };
|
||||
float AvatarData::_avatarSortCoefficientAge { 1.0f };
|
||||
|
||||
QScriptValue AvatarEntityMapToScriptValue(QScriptEngine* engine, const AvatarEntityMap& value) {
|
||||
|
|
|
@ -66,6 +66,22 @@ void AvatarReplicas::removeReplicas(const QUuid& parentID) {
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<AvatarSharedPointer> AvatarReplicas::takeReplicas(const QUuid& parentID) {
|
||||
std::vector<AvatarSharedPointer> replicas;
|
||||
|
||||
auto it = _replicasMap.find(parentID);
|
||||
|
||||
if (it != _replicasMap.end()) {
|
||||
// take a copy of the replica shared pointers for this parent
|
||||
replicas.swap(it->second);
|
||||
|
||||
// erase the replicas for this parent from our map
|
||||
_replicasMap.erase(it);
|
||||
}
|
||||
|
||||
return replicas;
|
||||
}
|
||||
|
||||
void AvatarReplicas::processAvatarIdentity(const QUuid& parentID, const QByteArray& identityData, bool& identityChanged, bool& displayNameChanged) {
|
||||
if (_replicasMap.find(parentID) != _replicasMap.end()) {
|
||||
auto &replicas = _replicasMap[parentID];
|
||||
|
@ -386,24 +402,31 @@ void AvatarHashMap::processKillAvatar(QSharedPointer<ReceivedMessage> message, S
|
|||
}
|
||||
|
||||
void AvatarHashMap::removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason) {
|
||||
QWriteLocker locker(&_hashLock);
|
||||
std::vector<AvatarSharedPointer> removedAvatars;
|
||||
|
||||
auto replicaIDs = _replicas.getReplicaIDs(sessionUUID);
|
||||
_replicas.removeReplicas(sessionUUID);
|
||||
for (auto id : replicaIDs) {
|
||||
auto removedReplica = _avatarHash.take(id);
|
||||
if (removedReplica) {
|
||||
handleRemovedAvatar(removedReplica, removalReason);
|
||||
{
|
||||
QWriteLocker locker(&_hashLock);
|
||||
|
||||
auto replicas = _replicas.takeReplicas(sessionUUID);
|
||||
|
||||
for (auto& replica : replicas) {
|
||||
auto removedReplica = _avatarHash.take(replica->getID());
|
||||
if (removedReplica) {
|
||||
removedAvatars.push_back(removedReplica);
|
||||
}
|
||||
}
|
||||
|
||||
_pendingAvatars.remove(sessionUUID);
|
||||
auto removedAvatar = _avatarHash.take(sessionUUID);
|
||||
|
||||
if (removedAvatar) {
|
||||
removedAvatars.push_back(removedAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
_pendingAvatars.remove(sessionUUID);
|
||||
auto removedAvatar = _avatarHash.take(sessionUUID);
|
||||
|
||||
if (removedAvatar) {
|
||||
for (auto& removedAvatar: removedAvatars) {
|
||||
handleRemovedAvatar(removedAvatar, removalReason);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AvatarHashMap::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
|
||||
|
@ -421,11 +444,18 @@ void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& ol
|
|||
}
|
||||
|
||||
void AvatarHashMap::clearOtherAvatars() {
|
||||
QWriteLocker locker(&_hashLock);
|
||||
QList<AvatarSharedPointer> removedAvatars;
|
||||
|
||||
for (auto& av : _avatarHash) {
|
||||
handleRemovedAvatar(av);
|
||||
{
|
||||
QWriteLocker locker(&_hashLock);
|
||||
|
||||
// grab a copy of the current avatars so we can call handleRemoveAvatar for them
|
||||
removedAvatars = _avatarHash.values();
|
||||
|
||||
_avatarHash.clear();
|
||||
}
|
||||
|
||||
_avatarHash.clear();
|
||||
for (auto& av : removedAvatars) {
|
||||
handleRemovedAvatar(av);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
void parseDataFromBuffer(const QUuid& parentID, const QByteArray& buffer);
|
||||
void processAvatarIdentity(const QUuid& parentID, const QByteArray& identityData, bool& identityChanged, bool& displayNameChanged);
|
||||
void removeReplicas(const QUuid& parentID);
|
||||
std::vector<AvatarSharedPointer> takeReplicas(const QUuid& parentID);
|
||||
void processTrait(const QUuid& parentID, AvatarTraits::TraitType traitType, QByteArray traitBinaryData);
|
||||
void processDeletedTraitInstance(const QUuid& parentID, AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID instanceID);
|
||||
void processTraitInstance(const QUuid& parentID, AvatarTraits::TraitType traitType,
|
||||
|
@ -179,7 +180,7 @@ protected:
|
|||
bool& isNew);
|
||||
virtual AvatarSharedPointer findAvatar(const QUuid& sessionUUID) const; // uses a QReadLocker on the hashLock
|
||||
virtual void removeAvatar(const QUuid& sessionUUID, KillAvatarReason removalReason = KillAvatarReason::NoReason);
|
||||
|
||||
|
||||
virtual void handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason = KillAvatarReason::NoReason);
|
||||
|
||||
AvatarHash _avatarHash;
|
||||
|
|
|
@ -187,6 +187,13 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() {
|
|||
connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverLeaveEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) {
|
||||
_entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverLeaveEntity", event);
|
||||
});
|
||||
|
||||
connect(_entitiesScriptEngine.data(), &ScriptEngine::entityScriptPreloadFinished, [&](const EntityItemID& entityID) {
|
||||
EntityItemPointer entity = getTree()->findEntityByID(entityID);
|
||||
if (entity) {
|
||||
entity->setScriptHasFinishedPreload(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void EntityTreeRenderer::clear() {
|
||||
|
@ -512,7 +519,11 @@ bool EntityTreeRenderer::findBestZoneAndMaybeContainingEntities(QVector<EntityIt
|
|||
// be ignored because they can have events fired on them.
|
||||
// FIXME - this could be optimized further by determining if the script is loaded
|
||||
// and if it has either an enterEntity or leaveEntity method
|
||||
if (isZone || hasScript) {
|
||||
//
|
||||
// also, don't flag a scripted entity as containing the avatar until the script is loaded,
|
||||
// so that the script is awake in time to receive the "entityEntity" call (even if the entity is a zone).
|
||||
if ((!hasScript && isZone) ||
|
||||
(hasScript && entity->isScriptPreloadFinished())) {
|
||||
// now check to see if the point contains our entity, this can be expensive if
|
||||
// the entity has a collision hull
|
||||
if (entity->contains(_avatarPosition)) {
|
||||
|
@ -972,6 +983,7 @@ void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool
|
|||
entity->scriptHasUnloaded();
|
||||
}
|
||||
if (shouldLoad) {
|
||||
entity->setScriptHasFinishedPreload(false);
|
||||
_entitiesScriptEngine->loadEntityScript(entityID, resolveScriptURL(scriptUrl), reload);
|
||||
entity->scriptHasPreloaded();
|
||||
}
|
||||
|
|
|
@ -187,12 +187,10 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
particle.basePosition = baseTransform.getTranslation();
|
||||
|
||||
// Position, velocity, and acceleration
|
||||
glm::vec3 emitDirection;
|
||||
if (polarStart == 0.0f && polarFinish == 0.0f && emitDimensions.z == 0.0f) {
|
||||
// Emit along z-axis from position
|
||||
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * Vectors::UNIT_Z);
|
||||
particle.acceleration = emitAcceleration + randFloatInRange(-1.0f, 1.0f) * accelerationSpread;
|
||||
|
||||
emitDirection = Vectors::UNIT_Z;
|
||||
} else {
|
||||
// Emit around point or from ellipsoid
|
||||
// - Distribute directions evenly around point
|
||||
|
@ -210,7 +208,6 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
azimuth = azimuthStart + (TWO_PI + azimuthFinish - azimuthStart) * randFloat();
|
||||
}
|
||||
|
||||
glm::vec3 emitDirection;
|
||||
if (emitDimensions == Vectors::ZERO) {
|
||||
// Point
|
||||
emitDirection = glm::quat(glm::vec3(PI_OVER_TWO - elevation, 0.0f, azimuth)) * Vectors::UNIT_Z;
|
||||
|
@ -235,10 +232,10 @@ ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createPa
|
|||
));
|
||||
particle.relativePosition += emitOrientation * emitPosition;
|
||||
}
|
||||
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * emitDirection);
|
||||
particle.acceleration = emitAcceleration + randFloatInRange(-1.0f, 1.0f) * accelerationSpread;
|
||||
}
|
||||
particle.velocity = (emitSpeed + randFloatInRange(-1.0f, 1.0f) * speedSpread) * (emitOrientation * emitDirection);
|
||||
particle.acceleration = emitAcceleration +
|
||||
glm::vec3(randFloatInRange(-1.0f, 1.0f), randFloatInRange(-1.0f, 1.0f), randFloatInRange(-1.0f, 1.0f)) * accelerationSpread;
|
||||
|
||||
return particle;
|
||||
}
|
||||
|
|
|
@ -97,10 +97,10 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
withWriteLock([&] {
|
||||
auto entity = getEntity();
|
||||
_position = entity->getWorldPosition();
|
||||
_dimensions = entity->getScaledDimensions();
|
||||
_dimensions = entity->getUnscaledDimensions(); // get unscaled to avoid scaling twice
|
||||
_orientation = entity->getWorldOrientation();
|
||||
updateModelTransformAndBound();
|
||||
_renderTransform = getModelTransform();
|
||||
_renderTransform = getModelTransform(); // contains parent scale, if this entity scales with its parent
|
||||
if (_shape == entity::Sphere) {
|
||||
_renderTransform.postScale(SPHERE_ENTITY_SCALE);
|
||||
}
|
||||
|
|
|
@ -3197,3 +3197,26 @@ void EntityItem::setCloneIDs(const QVector<QUuid>& cloneIDs) {
|
|||
_cloneIDs = cloneIDs;
|
||||
});
|
||||
}
|
||||
|
||||
bool EntityItem::shouldPreloadScript() const {
|
||||
return !_script.isEmpty() && ((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp));
|
||||
}
|
||||
|
||||
void EntityItem::scriptHasPreloaded() {
|
||||
_loadedScript = _script;
|
||||
_loadedScriptTimestamp = _scriptTimestamp;
|
||||
}
|
||||
|
||||
void EntityItem::scriptHasUnloaded() {
|
||||
_loadedScript = "";
|
||||
_loadedScriptTimestamp = 0;
|
||||
_scriptPreloadFinished = false;
|
||||
}
|
||||
|
||||
void EntityItem::setScriptHasFinishedPreload(bool value) {
|
||||
_scriptPreloadFinished = value;
|
||||
}
|
||||
|
||||
bool EntityItem::isScriptPreloadFinished() {
|
||||
return _scriptPreloadFinished;
|
||||
}
|
||||
|
|
|
@ -470,10 +470,11 @@ public:
|
|||
/// We only want to preload if:
|
||||
/// there is some script, and either the script value or the scriptTimestamp
|
||||
/// value have changed since our last preload
|
||||
bool shouldPreloadScript() const { return !_script.isEmpty() &&
|
||||
((_loadedScript != _script) || (_loadedScriptTimestamp != _scriptTimestamp)); }
|
||||
void scriptHasPreloaded() { _loadedScript = _script; _loadedScriptTimestamp = _scriptTimestamp; }
|
||||
void scriptHasUnloaded() { _loadedScript = ""; _loadedScriptTimestamp = 0; }
|
||||
bool shouldPreloadScript() const;
|
||||
void scriptHasPreloaded();
|
||||
void scriptHasUnloaded();
|
||||
void setScriptHasFinishedPreload(bool value);
|
||||
bool isScriptPreloadFinished();
|
||||
|
||||
bool getClientOnly() const { return _clientOnly; }
|
||||
virtual void setClientOnly(bool clientOnly) { _clientOnly = clientOnly; }
|
||||
|
@ -584,6 +585,7 @@ protected:
|
|||
QString _script { ENTITY_ITEM_DEFAULT_SCRIPT }; /// the value of the script property
|
||||
QString _loadedScript; /// the value of _script when the last preload signal was sent
|
||||
quint64 _scriptTimestamp { ENTITY_ITEM_DEFAULT_SCRIPT_TIMESTAMP }; /// the script loaded property used for forced reload
|
||||
bool _scriptPreloadFinished { false };
|
||||
|
||||
QString _serverScripts;
|
||||
/// keep track of time when _serverScripts property was last changed
|
||||
|
|
|
@ -132,8 +132,8 @@ EntityItemProperties convertPropertiesToScriptSemantics(const EntityItemProperti
|
|||
EntityItemProperties scriptSideProperties = entitySideProperties;
|
||||
scriptSideProperties.setLocalPosition(entitySideProperties.getPosition());
|
||||
scriptSideProperties.setLocalRotation(entitySideProperties.getRotation());
|
||||
scriptSideProperties.setLocalVelocity(entitySideProperties.getLocalVelocity());
|
||||
scriptSideProperties.setLocalAngularVelocity(entitySideProperties.getLocalAngularVelocity());
|
||||
scriptSideProperties.setLocalVelocity(entitySideProperties.getVelocity());
|
||||
scriptSideProperties.setLocalAngularVelocity(entitySideProperties.getAngularVelocity());
|
||||
scriptSideProperties.setLocalDimensions(entitySideProperties.getDimensions());
|
||||
|
||||
bool success;
|
||||
|
@ -181,8 +181,6 @@ EntityItemProperties convertPropertiesFromScriptSemantics(const EntityItemProper
|
|||
EntityItemProperties entitySideProperties = scriptSideProperties;
|
||||
bool success;
|
||||
|
||||
// TODO -- handle velocity and angularVelocity
|
||||
|
||||
if (scriptSideProperties.localPositionChanged()) {
|
||||
entitySideProperties.setPosition(scriptSideProperties.getLocalPosition());
|
||||
} else if (scriptSideProperties.positionChanged()) {
|
||||
|
|
|
@ -57,7 +57,7 @@ void GL41Backend::postLinkProgram(ShaderObject& programObject, const Shader& pro
|
|||
const auto resourceBufferUniforms = ::gl::Uniform::loadByName(glprogram, program.getResourceBuffers().getNames());
|
||||
for (const auto& resourceBuffer : resourceBufferUniforms) {
|
||||
const auto& targetBinding = expectedResourceBuffers.at(resourceBuffer.name);
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding);
|
||||
glProgramUniform1i(glprogram, resourceBuffer.binding, targetBinding + GL41Backend::RESOURCE_BUFFER_SLOT0_TEX_UNIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,6 @@ void AccountManager::requestAccessToken(const QString& login, const QString& pas
|
|||
|
||||
QNetworkReply* requestReply = networkAccessManager.post(request, postData);
|
||||
connect(requestReply, &QNetworkReply::finished, this, &AccountManager::requestAccessTokenFinished);
|
||||
connect(requestReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestAccessTokenError(QNetworkReply::NetworkError)));
|
||||
}
|
||||
|
||||
void AccountManager::requestAccessTokenWithSteam(QByteArray authSessionTicket) {
|
||||
|
@ -633,12 +632,6 @@ void AccountManager::requestAccessTokenFinished() {
|
|||
}
|
||||
}
|
||||
|
||||
void AccountManager::requestAccessTokenError(QNetworkReply::NetworkError error) {
|
||||
// TODO: error handling
|
||||
qCDebug(networking) << "AccountManager: failed to fetch access token - " << error;
|
||||
emit loginFailed();
|
||||
}
|
||||
|
||||
void AccountManager::refreshAccessTokenFinished() {
|
||||
QNetworkReply* requestReply = reinterpret_cast<QNetworkReply*>(sender());
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ public slots:
|
|||
void requestAccessTokenFinished();
|
||||
void refreshAccessTokenFinished();
|
||||
void requestProfileFinished();
|
||||
void requestAccessTokenError(QNetworkReply::NetworkError error);
|
||||
void refreshAccessTokenError(QNetworkReply::NetworkError error);
|
||||
void requestProfileError(QNetworkReply::NetworkError error);
|
||||
void logout();
|
||||
|
|
|
@ -140,8 +140,7 @@ public:
|
|||
* </table>
|
||||
* @typedef {number} location.LookupTrigger
|
||||
*/
|
||||
enum LookupTrigger
|
||||
{
|
||||
enum LookupTrigger {
|
||||
UserInput,
|
||||
Back,
|
||||
Forward,
|
||||
|
@ -207,9 +206,8 @@ public slots:
|
|||
// functions and signals that should be exposed are moved to a scripting interface class.
|
||||
//
|
||||
// we currently expect this to be called from NodeList once handleLookupString has been called with a path
|
||||
bool goToViewpointForPath(const QString& viewpointString, const QString& pathString) {
|
||||
return handleViewpoint(viewpointString, false, DomainPathResponse, false, pathString);
|
||||
}
|
||||
bool goToViewpointForPath(const QString& viewpointString, const QString& pathString)
|
||||
{ return handleViewpoint(viewpointString, false, DomainPathResponse, false, pathString); }
|
||||
|
||||
/**jsdoc
|
||||
* Go back to the previous location in your navigation history, if there is one.
|
||||
|
@ -231,8 +229,7 @@ public slots:
|
|||
* location history is correctly maintained.
|
||||
*/
|
||||
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) {
|
||||
handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger);
|
||||
}
|
||||
handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
|
||||
|
||||
/**jsdoc
|
||||
* Go to the default "welcome" metaverse address.
|
||||
|
@ -364,8 +361,7 @@ signals:
|
|||
* location.locationChangeRequired.connect(onLocationChangeRequired);
|
||||
*/
|
||||
void locationChangeRequired(const glm::vec3& newPosition,
|
||||
bool hasOrientationChange,
|
||||
const glm::quat& newOrientation,
|
||||
bool hasOrientationChange, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation);
|
||||
|
||||
/**jsdoc
|
||||
|
@ -448,11 +444,8 @@ private:
|
|||
|
||||
bool handleNetworkAddress(const QString& lookupString, LookupTrigger trigger, bool& hostChanged);
|
||||
void handlePath(const QString& path, LookupTrigger trigger, bool wasPathOnly = false);
|
||||
bool handleViewpoint(const QString& viewpointString,
|
||||
bool shouldFace,
|
||||
LookupTrigger trigger,
|
||||
bool definitelyPathOnly = false,
|
||||
const QString& pathString = QString());
|
||||
bool handleViewpoint(const QString& viewpointString, bool shouldFace, LookupTrigger trigger,
|
||||
bool definitelyPathOnly = false, const QString& pathString = QString());
|
||||
bool handleUsername(const QString& lookupString);
|
||||
bool handleDomainID(const QString& host);
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
#include <PathUtils.h>
|
||||
|
||||
#include <shared/QtHelpers.h>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
|
@ -134,6 +138,18 @@ void DomainHandler::hardReset() {
|
|||
_pendingPath.clear();
|
||||
}
|
||||
|
||||
bool DomainHandler::getInterstitialModeEnabled() const {
|
||||
return _interstitialModeSettingLock.resultWithReadLock<bool>([&] {
|
||||
return _enableInterstitialMode.get();
|
||||
});
|
||||
}
|
||||
|
||||
void DomainHandler::setInterstitialModeEnabled(bool enableInterstitialMode) {
|
||||
_interstitialModeSettingLock.withWriteLock([&] {
|
||||
_enableInterstitialMode.set(enableInterstitialMode);
|
||||
});
|
||||
}
|
||||
|
||||
void DomainHandler::setErrorDomainURL(const QUrl& url) {
|
||||
_errorDomainURL = url;
|
||||
return;
|
||||
|
@ -340,11 +356,15 @@ void DomainHandler::loadedErrorDomain(std::map<QString, QString> namedPaths) {
|
|||
DependencyManager::get<AddressManager>()->goToViewpointForPath(viewpoint, QString());
|
||||
}
|
||||
|
||||
void DomainHandler::setRedirectErrorState(QUrl errorUrl, int reasonCode) {
|
||||
_errorDomainURL = errorUrl;
|
||||
void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, int reasonCode, const QString& extraInfo) {
|
||||
_lastDomainConnectionError = reasonCode;
|
||||
_isInErrorState = true;
|
||||
emit redirectToErrorDomainURL(_errorDomainURL);
|
||||
if (getInterstitialModeEnabled()) {
|
||||
_errorDomainURL = errorUrl;
|
||||
_isInErrorState = true;
|
||||
emit redirectToErrorDomainURL(_errorDomainURL);
|
||||
} else {
|
||||
emit domainConnectionRefused(reasonMessage, reasonCode, extraInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void DomainHandler::requestDomainSettings() {
|
||||
|
@ -485,13 +505,9 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
|||
#if defined(Q_OS_ANDROID)
|
||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||
#else
|
||||
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) {
|
||||
// ingest the error - this is a "hard" connection refusal.
|
||||
setRedirectErrorState(_errorDomainURL, (int)reasonCode);
|
||||
} else {
|
||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||
}
|
||||
_lastDomainConnectionError = (int)reasonCode;
|
||||
|
||||
// ingest the error - this is a "hard" connection refusal.
|
||||
setRedirectErrorState(_errorDomainURL, reasonMessage, (int)reasonCode, extraInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include <QtCore/QUrl>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
|
||||
#include <shared/ReadWriteLockable.h>
|
||||
#include <SettingHandle.h>
|
||||
|
||||
#include "HifiSockAddr.h"
|
||||
#include "NetworkPeer.h"
|
||||
#include "NLPacket.h"
|
||||
|
@ -83,6 +86,8 @@ public:
|
|||
bool isConnected() const { return _isConnected; }
|
||||
void setIsConnected(bool isConnected);
|
||||
bool isServerless() const { return _domainURL.scheme() != URL_SCHEME_HIFI; }
|
||||
bool getInterstitialModeEnabled() const;
|
||||
void setInterstitialModeEnabled(bool enableInterstitialMode);
|
||||
|
||||
void connectedToServerless(std::map<QString, QString> namedPaths);
|
||||
|
||||
|
@ -171,7 +176,7 @@ public slots:
|
|||
void processDomainServerConnectionDeniedPacket(QSharedPointer<ReceivedMessage> message);
|
||||
|
||||
// sets domain handler in error state.
|
||||
void setRedirectErrorState(QUrl errorUrl, int reasonCode);
|
||||
void setRedirectErrorState(QUrl errorUrl, QString reasonMessage = "", int reason = -1, const QString& extraInfo = "");
|
||||
|
||||
bool isInErrorState() { return _isInErrorState; }
|
||||
|
||||
|
@ -224,6 +229,8 @@ private:
|
|||
QJsonObject _settingsObject;
|
||||
QString _pendingPath;
|
||||
QTimer _settingsTimer;
|
||||
mutable ReadWriteLockable _interstitialModeSettingLock;
|
||||
Setting::Handle<bool> _enableInterstitialMode{ "enableInterstitialMode", false };
|
||||
|
||||
QSet<QString> _domainConnectionRefusals;
|
||||
bool _hasCheckedForAccessToken { false };
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace NetworkingConstants {
|
|||
|
||||
const QString URL_SCHEME_ABOUT = "about";
|
||||
const QString URL_SCHEME_HIFI = "hifi";
|
||||
const QString URL_SCHEME_HIFIAPP = "hifiapp";
|
||||
const QString URL_SCHEME_QRC = "qrc";
|
||||
const QString URL_SCHEME_FILE = "file";
|
||||
const QString URL_SCHEME_HTTP = "http";
|
||||
|
|
|
@ -68,7 +68,8 @@ void Pointer::update(unsigned int pointerID) {
|
|||
// This only needs to be a read lock because update won't change any of the properties that can be modified from scripts
|
||||
withReadLock([&] {
|
||||
auto pickResult = getPrevPickResult();
|
||||
auto visualPickResult = getVisualPickResult(pickResult);
|
||||
// Pointer needs its own PickResult object so it doesn't modify the cached pick result
|
||||
auto visualPickResult = getVisualPickResult(getPickResultCopy(pickResult));
|
||||
updateVisuals(visualPickResult);
|
||||
generatePointerEvents(pointerID, visualPickResult);
|
||||
});
|
||||
|
|
|
@ -91,6 +91,7 @@ protected:
|
|||
|
||||
virtual bool shouldHover(const PickResultPointer& pickResult) { return true; }
|
||||
virtual bool shouldTrigger(const PickResultPointer& pickResult) { return true; }
|
||||
virtual PickResultPointer getPickResultCopy(const PickResultPointer& pickResult) const = 0;
|
||||
virtual PickResultPointer getVisualPickResult(const PickResultPointer& pickResult) { return pickResult; };
|
||||
|
||||
static const float POINTER_MOVE_DELAY;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<@include Highlight_shared.slh@>
|
||||
|
||||
layout(binding=RENDER_UTILS_BUFFER_HIGHLIGHT_PARAMS) uniform highlightParamsBuffer {
|
||||
layout(std140, binding=RENDER_UTILS_BUFFER_HIGHLIGHT_PARAMS) uniform highlightParamsBuffer {
|
||||
HighlightParameters params;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace gr {
|
|||
|
||||
#define OUTLINE_STENCIL_MASK 1
|
||||
|
||||
extern void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state);
|
||||
|
||||
HighlightRessources::HighlightRessources() {
|
||||
}
|
||||
|
||||
|
@ -180,6 +182,7 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
|
|||
|
||||
auto maskPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder);
|
||||
auto maskSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned());
|
||||
auto maskSkinnedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned().withDualQuatSkinned());
|
||||
|
||||
// Setup camera, projection and viewport for all items
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
|
@ -187,14 +190,17 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
|
|||
batch.setProjectionJitter(jitter.x, jitter.y);
|
||||
batch.setViewTransform(viewMat);
|
||||
|
||||
std::vector<ShapeKey> skinnedShapeKeys{};
|
||||
std::vector<ShapeKey> skinnedShapeKeys;
|
||||
std::vector<ShapeKey> skinnedDQShapeKeys;
|
||||
|
||||
// Iterate through all inShapes and render the unskinned
|
||||
args->_shapePipeline = maskPipeline;
|
||||
batch.setPipeline(maskPipeline->pipeline);
|
||||
for (const auto& items : inShapes) {
|
||||
itemBounds.insert(itemBounds.end(), items.second.begin(), items.second.end());
|
||||
if (items.first.isSkinned()) {
|
||||
if (items.first.isSkinned() && items.first.isDualQuatSkinned()) {
|
||||
skinnedDQShapeKeys.push_back(items.first);
|
||||
} else if (items.first.isSkinned()) {
|
||||
skinnedShapeKeys.push_back(items.first);
|
||||
} else {
|
||||
renderItems(renderContext, items.second);
|
||||
|
@ -202,10 +208,21 @@ void DrawHighlightMask::run(const render::RenderContextPointer& renderContext, c
|
|||
}
|
||||
|
||||
// Reiterate to render the skinned
|
||||
args->_shapePipeline = maskSkinnedPipeline;
|
||||
batch.setPipeline(maskSkinnedPipeline->pipeline);
|
||||
for (const auto& key : skinnedShapeKeys) {
|
||||
renderItems(renderContext, inShapes.at(key));
|
||||
if (skinnedShapeKeys.size() > 0) {
|
||||
args->_shapePipeline = maskSkinnedPipeline;
|
||||
batch.setPipeline(maskSkinnedPipeline->pipeline);
|
||||
for (const auto& key : skinnedShapeKeys) {
|
||||
renderItems(renderContext, inShapes.at(key));
|
||||
}
|
||||
}
|
||||
|
||||
// Reiterate to render the DQ skinned
|
||||
if (skinnedDQShapeKeys.size() > 0) {
|
||||
args->_shapePipeline = maskSkinnedDQPipeline;
|
||||
batch.setPipeline(maskSkinnedDQPipeline->pipeline);
|
||||
for (const auto& key : skinnedDQShapeKeys) {
|
||||
renderItems(renderContext, inShapes.at(key));
|
||||
}
|
||||
}
|
||||
|
||||
args->_shapePipeline = nullptr;
|
||||
|
@ -488,7 +505,7 @@ void DrawHighlightTask::build(JobModel& task, const render::Varying& inputs, ren
|
|||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setColorWriteMask(false, false, false, false);
|
||||
|
||||
initMaskPipelines(*shapePlumber, state);
|
||||
initZPassPipelines(*shapePlumber, state);
|
||||
}
|
||||
auto sharedParameters = std::make_shared<HighlightSharedParameters>();
|
||||
|
||||
|
@ -548,16 +565,4 @@ const render::Varying DrawHighlightTask::addSelectItemJobs(JobModel& task, const
|
|||
const auto selectedMetasAndOpaques = task.addJob<SelectItems>("OpaqueSelection", selectMetaAndOpaqueInput);
|
||||
const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques, selectionName).asVarying();
|
||||
return task.addJob<SelectItems>("TransparentSelection", selectItemInput);
|
||||
}
|
||||
|
||||
void DrawHighlightTask::initMaskPipelines(render::ShapePlumber& shapePlumber, gpu::StatePointer state) {
|
||||
gpu::ShaderPointer modelProgram = gpu::Shader::createProgram(shader::render_utils::program::model_shadow);
|
||||
shapePlumber.addPipeline(
|
||||
ShapeKey::Filter::Builder().withoutSkinned(),
|
||||
modelProgram, state);
|
||||
|
||||
gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(shader::render_utils::program::skin_model_shadow);
|
||||
shapePlumber.addPipeline(
|
||||
ShapeKey::Filter::Builder().withSkinned(),
|
||||
skinProgram, state);
|
||||
}
|
||||
}
|
|
@ -208,8 +208,6 @@ public:
|
|||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
|
||||
|
||||
private:
|
||||
|
||||
static void initMaskPipelines(render::ShapePlumber& plumber, gpu::StatePointer state);
|
||||
static const render::Varying addSelectItemJobs(JobModel& task, const render::Varying& selectionName, const RenderFetchCullSortTask::BucketList& items);
|
||||
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ struct HighlightParameters {
|
|||
vec2 outlineWidth;
|
||||
};
|
||||
|
||||
layout(binding=0) uniform parametersBuffer {
|
||||
layout(std140, binding=0) uniform parametersBuffer {
|
||||
HighlightParameters _parameters;
|
||||
};
|
||||
|
||||
|
|
|
@ -1281,92 +1281,6 @@ QStringList Model::getJointNames() const {
|
|||
return isActive() ? getFBXGeometry().getJointNames() : QStringList();
|
||||
}
|
||||
|
||||
class Blender : public QRunnable {
|
||||
public:
|
||||
|
||||
Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients);
|
||||
|
||||
virtual void run() override;
|
||||
|
||||
private:
|
||||
|
||||
ModelPointer _model;
|
||||
int _blendNumber;
|
||||
Geometry::WeakPointer _geometry;
|
||||
QVector<float> _blendshapeCoefficients;
|
||||
};
|
||||
|
||||
Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients) :
|
||||
_model(model),
|
||||
_blendNumber(blendNumber),
|
||||
_geometry(geometry),
|
||||
_blendshapeCoefficients(blendshapeCoefficients) {
|
||||
}
|
||||
|
||||
void Blender::run() {
|
||||
QVector<glm::vec3> vertices;
|
||||
QVector<NormalType> normalsAndTangents;
|
||||
if (_model && _model->isLoaded()) {
|
||||
DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
|
||||
int offset = 0;
|
||||
int normalsAndTangentsOffset = 0;
|
||||
auto meshes = _model->getFBXGeometry().meshes;
|
||||
int meshIndex = 0;
|
||||
foreach (const FBXMesh& mesh, meshes) {
|
||||
auto modelMeshNormalsAndTangents = _model->_normalsAndTangents.find(meshIndex++);
|
||||
if (mesh.blendshapes.isEmpty() || modelMeshNormalsAndTangents == _model->_normalsAndTangents.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
vertices += mesh.vertices;
|
||||
normalsAndTangents += modelMeshNormalsAndTangents->second;
|
||||
glm::vec3* meshVertices = vertices.data() + offset;
|
||||
NormalType* meshNormalsAndTangents = normalsAndTangents.data() + normalsAndTangentsOffset;
|
||||
offset += mesh.vertices.size();
|
||||
normalsAndTangentsOffset += modelMeshNormalsAndTangents->second.size();
|
||||
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
||||
for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) {
|
||||
float vertexCoefficient = _blendshapeCoefficients.at(i);
|
||||
const float EPSILON = 0.0001f;
|
||||
if (vertexCoefficient < EPSILON) {
|
||||
continue;
|
||||
}
|
||||
float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
|
||||
const FBXBlendshape& blendshape = mesh.blendshapes.at(i);
|
||||
tbb::parallel_for(tbb::blocked_range<int>(0, blendshape.indices.size()), [&](const tbb::blocked_range<int>& range) {
|
||||
for (auto j = range.begin(); j < range.end(); j++) {
|
||||
int index = blendshape.indices.at(j);
|
||||
meshVertices[index] += blendshape.vertices.at(j) * vertexCoefficient;
|
||||
|
||||
glm::vec3 normal = mesh.normals.at(index) + blendshape.normals.at(j) * normalCoefficient;
|
||||
glm::vec3 tangent;
|
||||
if (index < mesh.tangents.size()) {
|
||||
tangent = mesh.tangents.at(index);
|
||||
if ((int)j < blendshape.tangents.size()) {
|
||||
tangent += blendshape.tangents.at(j) * normalCoefficient;
|
||||
}
|
||||
}
|
||||
#if FBX_PACK_NORMALS
|
||||
glm::uint32 finalNormal;
|
||||
glm::uint32 finalTangent;
|
||||
buffer_helpers::packNormalAndTangent(normal, tangent, finalNormal, finalTangent);
|
||||
#else
|
||||
const auto& finalNormal = normal;
|
||||
const auto& finalTangent = tangent;
|
||||
#endif
|
||||
meshNormalsAndTangents[2 * index] = finalNormal;
|
||||
meshNormalsAndTangents[2 * index + 1] = finalTangent;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// post the result to the ModelBlender, which will dispatch to the model if still alive
|
||||
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>().data(), "setBlendedVertices",
|
||||
Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber), Q_ARG(QVector<glm::vec3>, vertices),
|
||||
Q_ARG(QVector<NormalType>, normalsAndTangents));
|
||||
}
|
||||
|
||||
void Model::setScaleToFit(bool scaleToFit, const glm::vec3& dimensions, bool forceRescale) {
|
||||
if (forceRescale || _scaleToFit != scaleToFit || _scaleToFitDimensions != dimensions) {
|
||||
_scaleToFit = scaleToFit;
|
||||
|
@ -1531,45 +1445,6 @@ void Model::updateClusterMatrices() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Model::maybeStartBlender() {
|
||||
if (isLoaded()) {
|
||||
const FBXGeometry& fbxGeometry = getFBXGeometry();
|
||||
if (fbxGeometry.hasBlendedMeshes()) {
|
||||
QThreadPool::globalInstance()->start(new Blender(getThisPointer(), ++_blendNumber, _renderGeometry, _blendshapeCoefficients));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Model::setBlendedVertices(int blendNumber, const QVector<glm::vec3>& vertices, const QVector<NormalType>& normalsAndTangents) {
|
||||
if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendedVertexBuffersInitialized) {
|
||||
return;
|
||||
}
|
||||
_appliedBlendNumber = blendNumber;
|
||||
const FBXGeometry& fbxGeometry = getFBXGeometry();
|
||||
int index = 0;
|
||||
int normalAndTangentIndex = 0;
|
||||
for (int i = 0; i < fbxGeometry.meshes.size(); i++) {
|
||||
const FBXMesh& mesh = fbxGeometry.meshes.at(i);
|
||||
auto meshNormalsAndTangents = _normalsAndTangents.find(i);
|
||||
if (mesh.blendshapes.isEmpty() || meshNormalsAndTangents == _normalsAndTangents.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto vertexCount = mesh.vertices.size();
|
||||
const auto verticesSize = vertexCount * sizeof(glm::vec3);
|
||||
const auto& buffer = _blendedVertexBuffers.find(i);
|
||||
assert(buffer != _blendedVertexBuffers.end());
|
||||
buffer->second->resize(mesh.vertices.size() * sizeof(glm::vec3) + meshNormalsAndTangents->second.size() * sizeof(NormalType));
|
||||
buffer->second->setSubData(0, verticesSize, (gpu::Byte*) vertices.constData() + index * sizeof(glm::vec3));
|
||||
buffer->second->setSubData(verticesSize, meshNormalsAndTangents->second.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data() + normalAndTangentIndex * sizeof(NormalType));
|
||||
|
||||
index += vertexCount;
|
||||
normalAndTangentIndex += meshNormalsAndTangents->second.size();
|
||||
}
|
||||
}
|
||||
|
||||
void Model::deleteGeometry() {
|
||||
_deleteGeometryCounter++;
|
||||
_blendedVertexBuffers.clear();
|
||||
|
@ -1606,42 +1481,6 @@ const render::ItemIDs& Model::fetchRenderItemIDs() const {
|
|||
return _modelMeshRenderItemIDs;
|
||||
}
|
||||
|
||||
void Model::initializeBlendshapes(const FBXMesh& mesh, int index) {
|
||||
_blendedVertexBuffers[index] = std::make_shared<gpu::Buffer>();
|
||||
QVector<NormalType> normalsAndTangents;
|
||||
normalsAndTangents.resize(2 * mesh.normals.size());
|
||||
|
||||
// Interleave normals and tangents
|
||||
// Parallel version for performance
|
||||
tbb::parallel_for(tbb::blocked_range<int>(0, mesh.normals.size()), [&](const tbb::blocked_range<int>& range) {
|
||||
auto normalsRange = std::make_pair(mesh.normals.begin() + range.begin(), mesh.normals.begin() + range.end());
|
||||
auto tangentsRange = std::make_pair(mesh.tangents.begin() + range.begin(), mesh.tangents.begin() + range.end());
|
||||
auto normalsAndTangentsIt = normalsAndTangents.begin() + 2 * range.begin();
|
||||
|
||||
for (auto normalIt = normalsRange.first, tangentIt = tangentsRange.first;
|
||||
normalIt != normalsRange.second;
|
||||
++normalIt, ++tangentIt) {
|
||||
#if FBX_PACK_NORMALS
|
||||
glm::uint32 finalNormal;
|
||||
glm::uint32 finalTangent;
|
||||
buffer_helpers::packNormalAndTangent(*normalIt, *tangentIt, finalNormal, finalTangent);
|
||||
#else
|
||||
const auto& finalNormal = *normalIt;
|
||||
const auto& finalTangent = *tangentIt;
|
||||
#endif
|
||||
*normalsAndTangentsIt = finalNormal;
|
||||
++normalsAndTangentsIt;
|
||||
*normalsAndTangentsIt = finalTangent;
|
||||
++normalsAndTangentsIt;
|
||||
}
|
||||
});
|
||||
const auto verticesSize = mesh.vertices.size() * sizeof(glm::vec3);
|
||||
_blendedVertexBuffers[index]->resize(mesh.vertices.size() * sizeof(glm::vec3) + normalsAndTangents.size() * sizeof(NormalType));
|
||||
_blendedVertexBuffers[index]->setSubData(0, verticesSize, (const gpu::Byte*) mesh.vertices.constData());
|
||||
_blendedVertexBuffers[index]->setSubData(verticesSize, normalsAndTangents.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data());
|
||||
_normalsAndTangents[index] = normalsAndTangents;
|
||||
}
|
||||
|
||||
void Model::createRenderItemSet() {
|
||||
assert(isLoaded());
|
||||
const auto& meshes = _renderGeometry->getMeshes();
|
||||
|
@ -1775,6 +1614,164 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
class Blender : public QRunnable {
|
||||
public:
|
||||
|
||||
Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients);
|
||||
|
||||
virtual void run() override;
|
||||
|
||||
private:
|
||||
|
||||
ModelPointer _model;
|
||||
int _blendNumber;
|
||||
Geometry::WeakPointer _geometry;
|
||||
QVector<float> _blendshapeCoefficients;
|
||||
};
|
||||
|
||||
Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry, const QVector<float>& blendshapeCoefficients) :
|
||||
_model(model),
|
||||
_blendNumber(blendNumber),
|
||||
_geometry(geometry),
|
||||
_blendshapeCoefficients(blendshapeCoefficients) {
|
||||
}
|
||||
|
||||
void Blender::run() {
|
||||
QVector<glm::vec3> vertices;
|
||||
QVector<NormalType> normalsAndTangents;
|
||||
if (_model && _model->isLoaded()) {
|
||||
DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
|
||||
int offset = 0;
|
||||
int normalsAndTangentsOffset = 0;
|
||||
auto meshes = _model->getFBXGeometry().meshes;
|
||||
int meshIndex = 0;
|
||||
foreach(const FBXMesh& mesh, meshes) {
|
||||
auto modelMeshNormalsAndTangents = _model->_normalsAndTangents.find(meshIndex++);
|
||||
if (mesh.blendshapes.isEmpty() || modelMeshNormalsAndTangents == _model->_normalsAndTangents.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
vertices += mesh.vertices;
|
||||
normalsAndTangents += modelMeshNormalsAndTangents->second;
|
||||
glm::vec3* meshVertices = vertices.data() + offset;
|
||||
NormalType* meshNormalsAndTangents = normalsAndTangents.data() + normalsAndTangentsOffset;
|
||||
offset += mesh.vertices.size();
|
||||
normalsAndTangentsOffset += modelMeshNormalsAndTangents->second.size();
|
||||
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
||||
for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) {
|
||||
float vertexCoefficient = _blendshapeCoefficients.at(i);
|
||||
const float EPSILON = 0.0001f;
|
||||
if (vertexCoefficient < EPSILON) {
|
||||
continue;
|
||||
}
|
||||
float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
|
||||
const FBXBlendshape& blendshape = mesh.blendshapes.at(i);
|
||||
tbb::parallel_for(tbb::blocked_range<int>(0, blendshape.indices.size()), [&](const tbb::blocked_range<int>& range) {
|
||||
for (auto j = range.begin(); j < range.end(); j++) {
|
||||
int index = blendshape.indices.at(j);
|
||||
meshVertices[index] += blendshape.vertices.at(j) * vertexCoefficient;
|
||||
|
||||
glm::vec3 normal = mesh.normals.at(index) + blendshape.normals.at(j) * normalCoefficient;
|
||||
glm::vec3 tangent;
|
||||
if (index < mesh.tangents.size()) {
|
||||
tangent = mesh.tangents.at(index);
|
||||
if ((int)j < blendshape.tangents.size()) {
|
||||
tangent += blendshape.tangents.at(j) * normalCoefficient;
|
||||
}
|
||||
}
|
||||
#if FBX_PACK_NORMALS
|
||||
glm::uint32 finalNormal;
|
||||
glm::uint32 finalTangent;
|
||||
buffer_helpers::packNormalAndTangent(normal, tangent, finalNormal, finalTangent);
|
||||
#else
|
||||
const auto& finalNormal = normal;
|
||||
const auto& finalTangent = tangent;
|
||||
#endif
|
||||
meshNormalsAndTangents[2 * index] = finalNormal;
|
||||
meshNormalsAndTangents[2 * index + 1] = finalTangent;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// post the result to the ModelBlender, which will dispatch to the model if still alive
|
||||
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>().data(), "setBlendedVertices",
|
||||
Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber), Q_ARG(QVector<glm::vec3>, vertices),
|
||||
Q_ARG(QVector<NormalType>, normalsAndTangents));
|
||||
}
|
||||
|
||||
bool Model::maybeStartBlender() {
|
||||
if (isLoaded()) {
|
||||
QThreadPool::globalInstance()->start(new Blender(getThisPointer(), ++_blendNumber, _renderGeometry, _blendshapeCoefficients));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Model::setBlendedVertices(int blendNumber, const QVector<glm::vec3>& vertices, const QVector<NormalType>& normalsAndTangents) {
|
||||
if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendedVertexBuffersInitialized) {
|
||||
return;
|
||||
}
|
||||
_appliedBlendNumber = blendNumber;
|
||||
const FBXGeometry& fbxGeometry = getFBXGeometry();
|
||||
int index = 0;
|
||||
int normalAndTangentIndex = 0;
|
||||
for (int i = 0; i < fbxGeometry.meshes.size(); i++) {
|
||||
const FBXMesh& mesh = fbxGeometry.meshes.at(i);
|
||||
auto meshNormalsAndTangents = _normalsAndTangents.find(i);
|
||||
const auto& buffer = _blendedVertexBuffers.find(i);
|
||||
if (mesh.blendshapes.isEmpty() || meshNormalsAndTangents == _normalsAndTangents.end() || buffer == _blendedVertexBuffers.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto vertexCount = mesh.vertices.size();
|
||||
const auto verticesSize = vertexCount * sizeof(glm::vec3);
|
||||
buffer->second->resize(mesh.vertices.size() * sizeof(glm::vec3) + meshNormalsAndTangents->second.size() * sizeof(NormalType));
|
||||
buffer->second->setSubData(0, verticesSize, (gpu::Byte*) vertices.constData() + index * sizeof(glm::vec3));
|
||||
buffer->second->setSubData(verticesSize, meshNormalsAndTangents->second.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data() + normalAndTangentIndex * sizeof(NormalType));
|
||||
|
||||
index += vertexCount;
|
||||
normalAndTangentIndex += meshNormalsAndTangents->second.size();
|
||||
}
|
||||
}
|
||||
|
||||
void Model::initializeBlendshapes(const FBXMesh& mesh, int index) {
|
||||
_blendedVertexBuffers[index] = std::make_shared<gpu::Buffer>();
|
||||
QVector<NormalType> normalsAndTangents;
|
||||
normalsAndTangents.resize(2 * mesh.normals.size());
|
||||
|
||||
// Interleave normals and tangents
|
||||
// Parallel version for performance
|
||||
tbb::parallel_for(tbb::blocked_range<int>(0, mesh.normals.size()), [&](const tbb::blocked_range<int>& range) {
|
||||
auto normalsRange = std::make_pair(mesh.normals.begin() + range.begin(), mesh.normals.begin() + range.end());
|
||||
auto tangentsRange = std::make_pair(mesh.tangents.begin() + range.begin(), mesh.tangents.begin() + range.end());
|
||||
auto normalsAndTangentsIt = normalsAndTangents.begin() + 2 * range.begin();
|
||||
|
||||
for (auto normalIt = normalsRange.first, tangentIt = tangentsRange.first;
|
||||
normalIt != normalsRange.second;
|
||||
++normalIt, ++tangentIt) {
|
||||
#if FBX_PACK_NORMALS
|
||||
glm::uint32 finalNormal;
|
||||
glm::uint32 finalTangent;
|
||||
buffer_helpers::packNormalAndTangent(*normalIt, *tangentIt, finalNormal, finalTangent);
|
||||
#else
|
||||
const auto& finalNormal = *normalIt;
|
||||
const auto& finalTangent = *tangentIt;
|
||||
#endif
|
||||
*normalsAndTangentsIt = finalNormal;
|
||||
++normalsAndTangentsIt;
|
||||
*normalsAndTangentsIt = finalTangent;
|
||||
++normalsAndTangentsIt;
|
||||
}
|
||||
});
|
||||
const auto verticesSize = mesh.vertices.size() * sizeof(glm::vec3);
|
||||
_blendedVertexBuffers[index]->resize(mesh.vertices.size() * sizeof(glm::vec3) + normalsAndTangents.size() * sizeof(NormalType));
|
||||
_blendedVertexBuffers[index]->setSubData(0, verticesSize, (const gpu::Byte*) mesh.vertices.constData());
|
||||
_blendedVertexBuffers[index]->setSubData(verticesSize, normalsAndTangents.size() * sizeof(NormalType), (const gpu::Byte*) normalsAndTangents.data());
|
||||
_normalsAndTangents[index] = normalsAndTangents;
|
||||
}
|
||||
|
||||
ModelBlender::ModelBlender() :
|
||||
_pendingBlenders(0) {
|
||||
}
|
||||
|
@ -1784,14 +1781,23 @@ ModelBlender::~ModelBlender() {
|
|||
|
||||
void ModelBlender::noteRequiresBlend(ModelPointer model) {
|
||||
Lock lock(_mutex);
|
||||
if (_pendingBlenders < QThread::idealThreadCount()) {
|
||||
if (model->maybeStartBlender()) {
|
||||
_pendingBlenders++;
|
||||
return;
|
||||
}
|
||||
if (_modelsRequiringBlendsSet.find(model) == _modelsRequiringBlendsSet.end()) {
|
||||
_modelsRequiringBlendsQueue.push(model);
|
||||
_modelsRequiringBlendsSet.insert(model);
|
||||
}
|
||||
|
||||
_modelsRequiringBlends.insert(model);
|
||||
if (_pendingBlenders < QThread::idealThreadCount()) {
|
||||
while (!_modelsRequiringBlendsQueue.empty()) {
|
||||
auto weakPtr = _modelsRequiringBlendsQueue.front();
|
||||
_modelsRequiringBlendsQueue.pop();
|
||||
_modelsRequiringBlendsSet.erase(weakPtr);
|
||||
ModelPointer nextModel = weakPtr.lock();
|
||||
if (nextModel && nextModel->maybeStartBlender()) {
|
||||
_pendingBlenders++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModelBlender::setBlendedVertices(ModelPointer model, int blendNumber, QVector<glm::vec3> vertices, QVector<NormalType> normalsAndTangents) {
|
||||
|
@ -1801,20 +1807,15 @@ void ModelBlender::setBlendedVertices(ModelPointer model, int blendNumber, QVect
|
|||
{
|
||||
Lock lock(_mutex);
|
||||
_pendingBlenders--;
|
||||
_modelsRequiringBlends.erase(model);
|
||||
std::set<ModelWeakPointer, std::owner_less<ModelWeakPointer>> modelsToErase;
|
||||
for (auto i = _modelsRequiringBlends.begin(); i != _modelsRequiringBlends.end(); i++) {
|
||||
auto weakPtr = *i;
|
||||
while (!_modelsRequiringBlendsQueue.empty()) {
|
||||
auto weakPtr = _modelsRequiringBlendsQueue.front();
|
||||
_modelsRequiringBlendsQueue.pop();
|
||||
_modelsRequiringBlendsSet.erase(weakPtr);
|
||||
ModelPointer nextModel = weakPtr.lock();
|
||||
if (nextModel && nextModel->maybeStartBlender()) {
|
||||
_pendingBlenders++;
|
||||
break;
|
||||
} else {
|
||||
modelsToErase.insert(weakPtr);
|
||||
}
|
||||
}
|
||||
for (auto& weakPtr : modelsToErase) {
|
||||
_modelsRequiringBlends.erase(weakPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -530,7 +530,8 @@ private:
|
|||
ModelBlender();
|
||||
virtual ~ModelBlender();
|
||||
|
||||
std::set<ModelWeakPointer, std::owner_less<ModelWeakPointer>> _modelsRequiringBlends;
|
||||
std::queue<ModelWeakPointer> _modelsRequiringBlendsQueue;
|
||||
std::set<ModelWeakPointer, std::owner_less<ModelWeakPointer>> _modelsRequiringBlendsSet;
|
||||
int _pendingBlenders;
|
||||
Mutex _mutex;
|
||||
|
||||
|
|
18
libraries/render-utils/src/parabola_translucent.slf
Normal file
18
libraries/render-utils/src/parabola_translucent.slf
Normal file
|
@ -0,0 +1,18 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
//
|
||||
// Created by Sam Gondelman on 9/10/2018
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include DeferredBufferWrite.slh@>
|
||||
|
||||
layout(location=0) in vec4 _color;
|
||||
|
||||
void main(void) {
|
||||
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), _color.a, _color.rgb, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
VERTEX parabola
|
|
@ -2442,6 +2442,8 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
// if we got this far, then call the preload method
|
||||
callEntityScriptMethod(entityID, "preload");
|
||||
|
||||
emit entityScriptPreloadFinished(entityID);
|
||||
|
||||
_occupiedScriptURLs.remove(entityScript);
|
||||
processDeferredEntityLoads(entityScript, entityID);
|
||||
}
|
||||
|
|
|
@ -712,6 +712,13 @@ signals:
|
|||
// script is updated (goes from RUNNING to ERROR_RUNNING_SCRIPT, for example)
|
||||
void entityScriptDetailsUpdated();
|
||||
|
||||
/**jsdoc
|
||||
* @function Script.entityScriptPreloadFinished
|
||||
* @returns {Signal}
|
||||
*/
|
||||
// Emitted when an entity script has finished running preload
|
||||
void entityScriptPreloadFinished(const EntityItemID& entityID);
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Setting {
|
|||
if (_pendingChanges.contains(key) && _pendingChanges[key] != UNSET_VALUE) {
|
||||
loadedValue = _pendingChanges[key];
|
||||
} else {
|
||||
loadedValue = value(key);
|
||||
loadedValue = _qSettings.value(key);
|
||||
}
|
||||
if (loadedValue.isValid()) {
|
||||
handle->setVariant(loadedValue);
|
||||
|
@ -92,32 +92,115 @@ namespace Setting {
|
|||
}
|
||||
|
||||
void Manager::saveAll() {
|
||||
bool forceSync = false;
|
||||
withWriteLock([&] {
|
||||
bool forceSync = false;
|
||||
for (auto key : _pendingChanges.keys()) {
|
||||
auto newValue = _pendingChanges[key];
|
||||
auto savedValue = value(key, UNSET_VALUE);
|
||||
auto savedValue = _qSettings.value(key, UNSET_VALUE);
|
||||
if (newValue == savedValue) {
|
||||
continue;
|
||||
}
|
||||
forceSync = true;
|
||||
if (newValue == UNSET_VALUE || !newValue.isValid()) {
|
||||
forceSync = true;
|
||||
remove(key);
|
||||
_qSettings.remove(key);
|
||||
} else {
|
||||
forceSync = true;
|
||||
setValue(key, newValue);
|
||||
_qSettings.setValue(key, newValue);
|
||||
}
|
||||
}
|
||||
_pendingChanges.clear();
|
||||
});
|
||||
|
||||
if (forceSync) {
|
||||
sync();
|
||||
}
|
||||
if (forceSync) {
|
||||
_qSettings.sync();
|
||||
}
|
||||
});
|
||||
|
||||
// Restart timer
|
||||
if (_saveTimer) {
|
||||
_saveTimer->start();
|
||||
}
|
||||
}
|
||||
|
||||
QString Manager::fileName() const {
|
||||
return resultWithReadLock<QString>([&] {
|
||||
return _qSettings.fileName();
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::remove(const QString &key) {
|
||||
withWriteLock([&] {
|
||||
_qSettings.remove(key);
|
||||
});
|
||||
}
|
||||
|
||||
QStringList Manager::childGroups() const {
|
||||
return resultWithReadLock<QStringList>([&] {
|
||||
return _qSettings.childGroups();
|
||||
});
|
||||
}
|
||||
|
||||
QStringList Manager::childKeys() const {
|
||||
return resultWithReadLock<QStringList>([&] {
|
||||
return _qSettings.childKeys();
|
||||
});
|
||||
}
|
||||
|
||||
QStringList Manager::allKeys() const {
|
||||
return resultWithReadLock<QStringList>([&] {
|
||||
return _qSettings.allKeys();
|
||||
});
|
||||
}
|
||||
|
||||
bool Manager::contains(const QString &key) const {
|
||||
return resultWithReadLock<bool>([&] {
|
||||
return _qSettings.contains(key);
|
||||
});
|
||||
}
|
||||
|
||||
int Manager::beginReadArray(const QString &prefix) {
|
||||
return resultWithReadLock<int>([&] {
|
||||
return _qSettings.beginReadArray(prefix);
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::beginGroup(const QString &prefix) {
|
||||
withWriteLock([&] {
|
||||
_qSettings.beginGroup(prefix);
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::beginWriteArray(const QString &prefix, int size) {
|
||||
withWriteLock([&] {
|
||||
_qSettings.beginWriteArray(prefix, size);
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::endArray() {
|
||||
withWriteLock([&] {
|
||||
_qSettings.endArray();
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::endGroup() {
|
||||
withWriteLock([&] {
|
||||
_qSettings.endGroup();
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::setArrayIndex(int i) {
|
||||
withWriteLock([&] {
|
||||
_qSettings.setArrayIndex(i);
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::setValue(const QString &key, const QVariant &value) {
|
||||
withWriteLock([&] {
|
||||
_qSettings.setValue(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
QVariant Manager::value(const QString &key, const QVariant &defaultValue) const {
|
||||
return resultWithReadLock<QVariant>([&] {
|
||||
return _qSettings.value(key, defaultValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,28 @@
|
|||
namespace Setting {
|
||||
class Interface;
|
||||
|
||||
class Manager : public QSettings, public ReadWriteLockable, public Dependency {
|
||||
class Manager : public QObject, public ReadWriteLockable, public Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void customDeleter() override;
|
||||
|
||||
// thread-safe proxies into QSettings
|
||||
QString fileName() const;
|
||||
void remove(const QString &key);
|
||||
QStringList childGroups() const;
|
||||
QStringList childKeys() const;
|
||||
QStringList allKeys() const;
|
||||
bool contains(const QString &key) const;
|
||||
int beginReadArray(const QString &prefix);
|
||||
void beginGroup(const QString &prefix);
|
||||
void beginWriteArray(const QString &prefix, int size = -1);
|
||||
void endArray();
|
||||
void endGroup();
|
||||
void setArrayIndex(int i);
|
||||
void setValue(const QString &key, const QVariant &value);
|
||||
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
|
||||
|
||||
protected:
|
||||
~Manager();
|
||||
void registerHandle(Interface* handle);
|
||||
|
@ -52,6 +68,9 @@ namespace Setting {
|
|||
friend class Interface;
|
||||
friend void cleanupSettingsSaveThread();
|
||||
friend void setupSettingsSaveThread();
|
||||
|
||||
|
||||
QSettings _qSettings;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include <time.h>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <chrono>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
|
@ -127,82 +127,10 @@ void usecTimestampNowForceClockSkew(qint64 clockSkew) {
|
|||
::usecTimestampNowAdjust = clockSkew;
|
||||
}
|
||||
|
||||
static std::atomic<qint64> TIME_REFERENCE { 0 }; // in usec
|
||||
static std::once_flag usecTimestampNowIsInitialized;
|
||||
static QElapsedTimer timestampTimer;
|
||||
|
||||
quint64 usecTimestampNow(bool wantDebug) {
|
||||
std::call_once(usecTimestampNowIsInitialized, [&] {
|
||||
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * USECS_PER_MSEC; // ms to usec
|
||||
timestampTimer.start();
|
||||
});
|
||||
|
||||
quint64 now;
|
||||
quint64 nsecsElapsed = timestampTimer.nsecsElapsed();
|
||||
quint64 usecsElapsed = nsecsElapsed / NSECS_PER_USEC; // nsec to usec
|
||||
|
||||
// QElapsedTimer may not advance if the CPU has gone to sleep. In which case it
|
||||
// will begin to deviate from real time. We detect that here, and reset if necessary
|
||||
quint64 msecsCurrentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
quint64 msecsEstimate = (TIME_REFERENCE + usecsElapsed) / USECS_PER_MSEC; // usecs to msecs
|
||||
int possibleSkew = msecsEstimate - msecsCurrentTime;
|
||||
const int TOLERANCE = 10 * MSECS_PER_SECOND; // up to 10 seconds of skew is tolerated
|
||||
if (abs(possibleSkew) > TOLERANCE) {
|
||||
// reset our TIME_REFERENCE and timer
|
||||
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * USECS_PER_MSEC; // ms to usec
|
||||
timestampTimer.restart();
|
||||
now = TIME_REFERENCE + ::usecTimestampNowAdjust;
|
||||
|
||||
if (wantDebug) {
|
||||
qCDebug(shared) << "usecTimestampNow() - resetting QElapsedTimer. ";
|
||||
qCDebug(shared) << " msecsCurrentTime:" << msecsCurrentTime;
|
||||
qCDebug(shared) << " msecsEstimate:" << msecsEstimate;
|
||||
qCDebug(shared) << " possibleSkew:" << possibleSkew;
|
||||
qCDebug(shared) << " TOLERANCE:" << TOLERANCE;
|
||||
|
||||
qCDebug(shared) << " nsecsElapsed:" << nsecsElapsed;
|
||||
qCDebug(shared) << " usecsElapsed:" << usecsElapsed;
|
||||
|
||||
QDateTime currentLocalTime = QDateTime::currentDateTime();
|
||||
|
||||
quint64 msecsNow = now / 1000; // usecs to msecs
|
||||
QDateTime nowAsString;
|
||||
nowAsString.setMSecsSinceEpoch(msecsNow);
|
||||
|
||||
qCDebug(shared) << " now:" << now;
|
||||
qCDebug(shared) << " msecsNow:" << msecsNow;
|
||||
|
||||
qCDebug(shared) << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
qCDebug(shared) << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
}
|
||||
} else {
|
||||
now = TIME_REFERENCE + usecsElapsed + ::usecTimestampNowAdjust;
|
||||
}
|
||||
|
||||
if (wantDebug) {
|
||||
QDateTime currentLocalTime = QDateTime::currentDateTime();
|
||||
|
||||
quint64 msecsNow = now / 1000; // usecs to msecs
|
||||
QDateTime nowAsString;
|
||||
nowAsString.setMSecsSinceEpoch(msecsNow);
|
||||
|
||||
quint64 msecsTimeReference = TIME_REFERENCE / 1000; // usecs to msecs
|
||||
QDateTime timeReferenceAsString;
|
||||
timeReferenceAsString.setMSecsSinceEpoch(msecsTimeReference);
|
||||
|
||||
qCDebug(shared) << "usecTimestampNow() - details... ";
|
||||
qCDebug(shared) << " TIME_REFERENCE:" << TIME_REFERENCE;
|
||||
qCDebug(shared) << " timeReferenceAsString:" << timeReferenceAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
qCDebug(shared) << " usecTimestampNowAdjust:" << usecTimestampNowAdjust;
|
||||
qCDebug(shared) << " nsecsElapsed:" << nsecsElapsed;
|
||||
qCDebug(shared) << " usecsElapsed:" << usecsElapsed;
|
||||
qCDebug(shared) << " now:" << now;
|
||||
qCDebug(shared) << " msecsNow:" << msecsNow;
|
||||
qCDebug(shared) << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
qCDebug(shared) << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
}
|
||||
|
||||
return now;
|
||||
using namespace std::chrono;
|
||||
static const auto unixEpoch = system_clock::from_time_t(0);
|
||||
return duration_cast<microseconds>(system_clock::now() - unixEpoch).count() + usecTimestampNowAdjust;
|
||||
}
|
||||
|
||||
float secTimestampNow() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
/*global Tablet, Script*/
|
||||
/* global Tablet, Script */
|
||||
//
|
||||
// libraries/appUi.js
|
||||
//
|
||||
|
@ -11,6 +11,7 @@
|
|||
//
|
||||
|
||||
function AppUi(properties) {
|
||||
var request = Script.require('request').request;
|
||||
/* Example development order:
|
||||
1. var AppUi = Script.require('appUi');
|
||||
2. Put appname-i.svg, appname-a.svg in graphicsDirectory (where non-default graphicsDirectory can be added in #3).
|
||||
|
@ -31,37 +32,63 @@ function AppUi(properties) {
|
|||
var that = this;
|
||||
function defaultButton(name, suffix) {
|
||||
var base = that[name] || (that.buttonPrefix + suffix);
|
||||
that[name] = (base.indexOf('/') >= 0) ? base : (that.graphicsDirectory + base); //poor man's merge
|
||||
that[name] = (base.indexOf('/') >= 0) ? base : (that.graphicsDirectory + base); // poor man's merge
|
||||
}
|
||||
|
||||
// Defaults:
|
||||
that.tabletName = "com.highfidelity.interface.tablet.system";
|
||||
that.inject = "";
|
||||
that.graphicsDirectory = "icons/tablet-icons/"; // Where to look for button svgs. See below.
|
||||
that.additionalAppScreens = [];
|
||||
that.checkIsOpen = function checkIsOpen(type, tabletUrl) { // Are we active? Value used to set isOpen.
|
||||
return (type === that.type) && that.currentUrl && (tabletUrl.indexOf(that.currentUrl) >= 0); // Actual url may have prefix or suffix.
|
||||
// Actual url may have prefix or suffix.
|
||||
return (type === that.currentVisibleScreenType) &&
|
||||
that.currentVisibleUrl &&
|
||||
((that.home.indexOf(that.currentVisibleUrl) > -1) ||
|
||||
(that.additionalAppScreens.indexOf(that.currentVisibleUrl) > -1));
|
||||
};
|
||||
that.setCurrentData = function setCurrentData(url) {
|
||||
that.currentUrl = url;
|
||||
that.type = /.qml$/.test(url) ? 'QML' : 'Web';
|
||||
}
|
||||
that.open = function open(optionalUrl) { // How to open the app.
|
||||
that.setCurrentVisibleScreenMetadata = function setCurrentVisibleScreenMetadata(type, url) {
|
||||
that.currentVisibleScreenType = type;
|
||||
that.currentVisibleUrl = url;
|
||||
};
|
||||
that.open = function open(optionalUrl, optionalInject) { // How to open the app.
|
||||
var url = optionalUrl || that.home;
|
||||
that.setCurrentData(url);
|
||||
if (that.isQML()) {
|
||||
var inject = optionalInject || that.inject;
|
||||
|
||||
if (that.isQMLUrl(url)) {
|
||||
that.tablet.loadQMLSource(url);
|
||||
} else {
|
||||
that.tablet.gotoWebScreen(url, that.inject);
|
||||
that.tablet.gotoWebScreen(url, inject);
|
||||
}
|
||||
};
|
||||
// Opens some app on top of the current app (on desktop, opens new window)
|
||||
that.openNewAppOnTop = function openNewAppOnTop(url, optionalInject) {
|
||||
var inject = optionalInject || "";
|
||||
if (that.isQMLUrl(url)) {
|
||||
that.tablet.loadQMLOnTop(url);
|
||||
} else {
|
||||
that.tablet.loadWebScreenOnTop(url, inject);
|
||||
}
|
||||
};
|
||||
that.close = function close() { // How to close the app.
|
||||
that.currentUrl = "";
|
||||
that.currentVisibleUrl = "";
|
||||
// for toolbar-mode: go back to home screen, this will close the window.
|
||||
that.tablet.gotoHomeScreen();
|
||||
};
|
||||
that.buttonActive = function buttonActive(isActive) { // How to make the button active (white).
|
||||
that.button.editProperties({isActive: isActive});
|
||||
};
|
||||
that.isQMLUrl = function isQMLUrl(url) {
|
||||
var type = /.qml$/.test(url) ? 'QML' : 'Web';
|
||||
return type === 'QML';
|
||||
};
|
||||
that.isCurrentlyOnQMLScreen = function isCurrentlyOnQMLScreen() {
|
||||
return that.currentVisibleScreenType === 'QML';
|
||||
};
|
||||
|
||||
//
|
||||
// START Notification Handling Defaults
|
||||
//
|
||||
that.messagesWaiting = function messagesWaiting(isWaiting) { // How to indicate a message light on button.
|
||||
// Note that waitingButton doesn't have to exist unless someone explicitly calls this with isWaiting true.
|
||||
that.button.editProperties({
|
||||
|
@ -69,16 +96,132 @@ function AppUi(properties) {
|
|||
activeIcon: isWaiting ? that.activeMessagesButton : that.activeButton
|
||||
});
|
||||
};
|
||||
that.isQML = function isQML() { // We set type property in onClick.
|
||||
return that.type === 'QML';
|
||||
that.notificationPollTimeout = false;
|
||||
that.notificationPollTimeoutMs = 60000;
|
||||
that.notificationPollEndpoint = false;
|
||||
that.notificationPollStopPaginatingConditionMet = false;
|
||||
that.notificationDataProcessPage = function (data) {
|
||||
return data;
|
||||
};
|
||||
that.eventSignal = function eventSignal() { // What signal to hook onMessage to.
|
||||
return that.isQML() ? that.tablet.fromQml : that.tablet.webEventReceived;
|
||||
that.notificationPollCallback = that.ignore;
|
||||
that.notificationPollCaresAboutSince = false;
|
||||
that.notificationInitialCallbackMade = false;
|
||||
that.notificationDisplayBanner = function (message) {
|
||||
if (!that.isOpen) {
|
||||
Window.displayAnnouncement(message);
|
||||
}
|
||||
};
|
||||
//
|
||||
// END Notification Handling Defaults
|
||||
//
|
||||
|
||||
// Handlers
|
||||
that.onScreenChanged = function onScreenChanged(type, url) {
|
||||
// Set isOpen, wireEventBridge, set buttonActive as appropriate,
|
||||
// and finally call onOpened() or onClosed() IFF defined.
|
||||
that.setCurrentVisibleScreenMetadata(type, url);
|
||||
|
||||
if (that.checkIsOpen(type, url)) {
|
||||
that.wireEventBridge(true);
|
||||
if (!that.isOpen) {
|
||||
that.buttonActive(true);
|
||||
if (that.onOpened) {
|
||||
that.onOpened();
|
||||
}
|
||||
that.isOpen = true;
|
||||
}
|
||||
} else { // Not us. Should we do something for type Home, Menu, and particularly Closed (meaning tablet hidden?
|
||||
that.wireEventBridge(false);
|
||||
if (that.isOpen) {
|
||||
that.buttonActive(false);
|
||||
if (that.onClosed) {
|
||||
that.onClosed();
|
||||
}
|
||||
that.isOpen = false;
|
||||
}
|
||||
}
|
||||
console.debug(that.buttonName + " app reports: Tablet screen changed.\nNew screen type: " + type +
|
||||
"\nNew screen URL: " + url + "\nCurrent app open status: " + that.isOpen + "\n");
|
||||
};
|
||||
|
||||
// Overwrite with the given properties:
|
||||
Object.keys(properties).forEach(function (key) { that[key] = properties[key]; });
|
||||
|
||||
//
|
||||
// START Notification Handling
|
||||
//
|
||||
var METAVERSE_BASE = Account.metaverseServerURL;
|
||||
var currentDataPageToRetrieve = 1;
|
||||
var concatenatedServerResponse = new Array();
|
||||
that.notificationPoll = function () {
|
||||
if (!that.notificationPollEndpoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
// User is "appearing offline" or is offline
|
||||
if (GlobalServices.findableBy === "none" || Account.username === "") {
|
||||
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
|
||||
return;
|
||||
}
|
||||
|
||||
var url = METAVERSE_BASE + that.notificationPollEndpoint;
|
||||
|
||||
var settingsKey = "notifications/" + that.buttonName + "/lastPoll";
|
||||
var currentTimestamp = new Date().getTime();
|
||||
var lastPollTimestamp = Settings.getValue(settingsKey, currentTimestamp);
|
||||
if (that.notificationPollCaresAboutSince) {
|
||||
url = url + "&since=" + lastPollTimestamp/1000;
|
||||
}
|
||||
Settings.setValue(settingsKey, currentTimestamp);
|
||||
|
||||
console.debug(that.buttonName, 'polling for notifications at endpoint', url);
|
||||
|
||||
function requestCallback(error, response) {
|
||||
if (error || (response.status !== 'success')) {
|
||||
print("Error: unable to get", url, error || response.status);
|
||||
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!that.notificationPollStopPaginatingConditionMet || that.notificationPollStopPaginatingConditionMet(response)) {
|
||||
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
|
||||
|
||||
var notificationData;
|
||||
if (concatenatedServerResponse.length) {
|
||||
notificationData = concatenatedServerResponse;
|
||||
} else {
|
||||
notificationData = that.notificationDataProcessPage(response);
|
||||
}
|
||||
console.debug(that.buttonName, 'notification data for processing:', JSON.stringify(notificationData));
|
||||
that.notificationPollCallback(notificationData);
|
||||
that.notificationInitialCallbackMade = true;
|
||||
currentDataPageToRetrieve = 1;
|
||||
concatenatedServerResponse = new Array();
|
||||
} else {
|
||||
concatenatedServerResponse = concatenatedServerResponse.concat(that.notificationDataProcessPage(response));
|
||||
currentDataPageToRetrieve++;
|
||||
request({ json: true, uri: (url + "&page=" + currentDataPageToRetrieve) }, requestCallback);
|
||||
}
|
||||
}
|
||||
|
||||
request({ json: true, uri: url }, requestCallback);
|
||||
};
|
||||
|
||||
// This won't do anything if there isn't a notification endpoint set
|
||||
that.notificationPoll();
|
||||
|
||||
function restartNotificationPoll() {
|
||||
that.notificationInitialCallbackMade = false;
|
||||
if (that.notificationPollTimeout) {
|
||||
Script.clearTimeout(that.notificationPollTimeout);
|
||||
that.notificationPollTimeout = false;
|
||||
}
|
||||
that.notificationPoll();
|
||||
}
|
||||
//
|
||||
// END Notification Handling
|
||||
//
|
||||
|
||||
// Properties:
|
||||
that.tablet = Tablet.getTablet(that.tabletName);
|
||||
// Must be after we gather properties.
|
||||
|
@ -100,65 +243,58 @@ function AppUi(properties) {
|
|||
}
|
||||
that.button = that.tablet.addButton(buttonOptions);
|
||||
that.ignore = function ignore() { };
|
||||
|
||||
// Handlers
|
||||
that.onScreenChanged = function onScreenChanged(type, url) {
|
||||
// Set isOpen, wireEventBridge, set buttonActive as appropriate,
|
||||
// and finally call onOpened() or onClosed() IFF defined.
|
||||
console.debug(that.buttonName, 'onScreenChanged', type, url, that.isOpen);
|
||||
if (that.checkIsOpen(type, url)) {
|
||||
if (!that.isOpen) {
|
||||
that.wireEventBridge(true);
|
||||
that.buttonActive(true);
|
||||
if (that.onOpened) {
|
||||
that.onOpened();
|
||||
}
|
||||
that.isOpen = true;
|
||||
}
|
||||
|
||||
} else { // Not us. Should we do something for type Home, Menu, and particularly Closed (meaning tablet hidden?
|
||||
if (that.isOpen) {
|
||||
that.wireEventBridge(false);
|
||||
that.buttonActive(false);
|
||||
if (that.onClosed) {
|
||||
that.onClosed();
|
||||
}
|
||||
that.isOpen = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
that.hasEventBridge = false;
|
||||
that.hasOutboundEventBridge = false;
|
||||
that.hasInboundQmlEventBridge = false;
|
||||
that.hasInboundHtmlEventBridge = false;
|
||||
// HTML event bridge uses strings, not objects. Here we abstract over that.
|
||||
// (Although injected javascript still has to use JSON.stringify/JSON.parse.)
|
||||
that.sendToHtml = function (messageObject) { that.tablet.emitScriptEvent(JSON.stringify(messageObject)); };
|
||||
that.fromHtml = function (messageString) { that.onMessage(JSON.parse(messageString)); };
|
||||
that.sendToHtml = function (messageObject) {
|
||||
that.tablet.emitScriptEvent(JSON.stringify(messageObject));
|
||||
};
|
||||
that.fromHtml = function (messageString) {
|
||||
var parsedMessage = JSON.parse(messageString);
|
||||
parsedMessage.messageSrc = "HTML";
|
||||
that.onMessage(parsedMessage);
|
||||
};
|
||||
that.sendMessage = that.ignore;
|
||||
that.wireEventBridge = function wireEventBridge(on) {
|
||||
// Uniquivocally sets that.sendMessage(messageObject) to do the right thing.
|
||||
// Sets hasEventBridge and wires onMessage to eventSignal as appropriate, IFF onMessage defined.
|
||||
var handler, isQml = that.isQML();
|
||||
// Sets has*EventBridge and wires onMessage to the proper event bridge as appropriate, IFF onMessage defined.
|
||||
var isCurrentlyOnQMLScreen = that.isCurrentlyOnQMLScreen();
|
||||
// Outbound (always, regardless of whether there is an inbound handler).
|
||||
if (on) {
|
||||
that.sendMessage = isQml ? that.tablet.sendToQml : that.sendToHtml;
|
||||
that.sendMessage = isCurrentlyOnQMLScreen ? that.tablet.sendToQml : that.sendToHtml;
|
||||
that.hasOutboundEventBridge = true;
|
||||
} else {
|
||||
that.sendMessage = that.ignore;
|
||||
that.hasOutboundEventBridge = false;
|
||||
}
|
||||
|
||||
if (!that.onMessage) { return; }
|
||||
if (!that.onMessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Inbound
|
||||
handler = isQml ? that.onMessage : that.fromHtml;
|
||||
if (on) {
|
||||
if (!that.hasEventBridge) {
|
||||
console.debug(that.buttonName, 'connecting', that.eventSignal());
|
||||
that.eventSignal().connect(handler);
|
||||
that.hasEventBridge = true;
|
||||
if (isCurrentlyOnQMLScreen && !that.hasInboundQmlEventBridge) {
|
||||
console.debug(that.buttonName, 'connecting', that.tablet.fromQml);
|
||||
that.tablet.fromQml.connect(that.onMessage);
|
||||
that.hasInboundQmlEventBridge = true;
|
||||
} else if (!isCurrentlyOnQMLScreen && !that.hasInboundHtmlEventBridge) {
|
||||
console.debug(that.buttonName, 'connecting', that.tablet.webEventReceived);
|
||||
that.tablet.webEventReceived.connect(that.fromHtml);
|
||||
that.hasInboundHtmlEventBridge = true;
|
||||
}
|
||||
} else {
|
||||
if (that.hasEventBridge) {
|
||||
console.debug(that.buttonName, 'disconnecting', that.eventSignal());
|
||||
that.eventSignal().disconnect(handler);
|
||||
that.hasEventBridge = false;
|
||||
if (that.hasInboundQmlEventBridge) {
|
||||
console.debug(that.buttonName, 'disconnecting', that.tablet.fromQml);
|
||||
that.tablet.fromQml.disconnect(that.onMessage);
|
||||
that.hasInboundQmlEventBridge = false;
|
||||
}
|
||||
if (that.hasInboundHtmlEventBridge) {
|
||||
console.debug(that.buttonName, 'disconnecting', that.tablet.webEventReceived);
|
||||
that.tablet.webEventReceived.disconnect(that.fromHtml);
|
||||
that.hasInboundHtmlEventBridge = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -175,6 +311,8 @@ function AppUi(properties) {
|
|||
} : that.ignore;
|
||||
that.onScriptEnding = function onScriptEnding() {
|
||||
// Close if necessary, clean up any remaining handlers, and remove the button.
|
||||
GlobalServices.myUsernameChanged.disconnect(restartNotificationPoll);
|
||||
GlobalServices.findableByChanged.disconnect(restartNotificationPoll);
|
||||
if (that.isOpen) {
|
||||
that.close();
|
||||
}
|
||||
|
@ -185,10 +323,22 @@ function AppUi(properties) {
|
|||
}
|
||||
that.tablet.removeButton(that.button);
|
||||
}
|
||||
if (that.notificationPollTimeout) {
|
||||
Script.clearInterval(that.notificationPollTimeout);
|
||||
that.notificationPollTimeout = false;
|
||||
}
|
||||
};
|
||||
// Set up the handlers.
|
||||
that.tablet.screenChanged.connect(that.onScreenChanged);
|
||||
that.button.clicked.connect(that.onClicked);
|
||||
Script.scriptEnding.connect(that.onScriptEnding);
|
||||
GlobalServices.findableByChanged.connect(restartNotificationPoll);
|
||||
GlobalServices.myUsernameChanged.connect(restartNotificationPoll);
|
||||
if (that.buttonName == Settings.getValue("startUpApp")) {
|
||||
Settings.setValue("startUpApp", "");
|
||||
Script.setTimeout(function () {
|
||||
that.open();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
module.exports = AppUi;
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
|
||||
// ------------------------------------------------------------------
|
||||
request: function (options, callback) { // cb(error, responseOfCorrectContentType) of url. A subset of npm request.
|
||||
var httpRequest = new XMLHttpRequest(), key;
|
||||
var httpRequest = new XMLHttpRequest(), key;
|
||||
// QT bug: apparently doesn't handle onload. Workaround using readyState.
|
||||
httpRequest.onreadystatechange = function () {
|
||||
var READY_STATE_DONE = 4;
|
||||
|
@ -72,7 +72,7 @@ module.exports = {
|
|||
}
|
||||
httpRequest.open(options.method, options.uri, true);
|
||||
httpRequest.send(options.body || null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ===========================================================================================
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,7 +37,7 @@
|
|||
this.highlightedEntities = [];
|
||||
|
||||
this.parameters = dispatcherUtils.makeDispatcherModuleParameters(
|
||||
120,
|
||||
480,
|
||||
this.hand === dispatcherUtils.RIGHT_HAND ? ["rightHand"] : ["leftHand"],
|
||||
[],
|
||||
100);
|
||||
|
|
|
@ -29,7 +29,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
this.reticleMaxY;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
200,
|
||||
160,
|
||||
this.hand === RIGHT_HAND ? ["rightHand", "rightHandEquip", "rightHandTrigger"] : ["leftHand", "leftHandEquip", "leftHandTrigger"],
|
||||
[],
|
||||
100,
|
||||
|
@ -73,21 +73,22 @@ Script.include("/~/system/libraries/utils.js");
|
|||
method: "clearSelection",
|
||||
hand: hand
|
||||
}));
|
||||
} else {
|
||||
if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "selectEntity",
|
||||
entityID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
}));
|
||||
} else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "selectOverlay",
|
||||
overlayID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "selectEntity",
|
||||
entityID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
}));
|
||||
} else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "selectOverlay",
|
||||
overlayID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
}));
|
||||
}
|
||||
|
||||
this.triggerClicked = true;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
this.disableModules = false;
|
||||
var NO_HAND_LASER = -1; // Invalid hand parameter so that default laser is not displayed.
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
240, // Not too high otherwise the tablet laser doesn't work.
|
||||
200, // Not too high otherwise the tablet laser doesn't work.
|
||||
this.hand === RIGHT_HAND
|
||||
? ["rightHand", "rightHandEquip", "rightHandTrigger"]
|
||||
: ["leftHand", "leftHandEquip", "leftHandTrigger"],
|
||||
|
|
|
@ -26,7 +26,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
|||
this.hapticTargetID = null;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
140,
|
||||
500,
|
||||
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
|
||||
[],
|
||||
100);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
this.hyperlink = "";
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
125,
|
||||
485,
|
||||
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
|
||||
[],
|
||||
100);
|
||||
|
|
|
@ -57,7 +57,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.cloneAllowed = true;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
140,
|
||||
500,
|
||||
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
|
||||
[],
|
||||
100);
|
||||
|
|
|
@ -29,7 +29,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
this.startSent = false;
|
||||
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
120,
|
||||
480,
|
||||
this.hand === RIGHT_HAND ? ["rightHandTrigger", "rightHand"] : ["leftHandTrigger", "leftHand"],
|
||||
[],
|
||||
100);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue