Upgraded VRViewer:
- upgraded vrviewer to latest master (ffbc9ff4bf0c550cc79003ec188ca16e9e83c31e) - added some notes on how to upgrade to the readme - added support for setting default yaw angle - added support for float properties
This commit is contained in:
parent
ddfb69edb2
commit
fcaa4fb936
@ -7,6 +7,11 @@ node_type_hdri = {
|
|||||||
'description': 'HDR Image',
|
'description': 'HDR Image',
|
||||||
'parent': ['group_hdri'],
|
'parent': ['group_hdri'],
|
||||||
'dyn_schema': {
|
'dyn_schema': {
|
||||||
|
# Default yaw angle in degrees.
|
||||||
|
'default_yaw': {
|
||||||
|
'type': 'float',
|
||||||
|
'default': 0.0
|
||||||
|
},
|
||||||
'status': {
|
'status': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'allowed': [
|
'allowed': [
|
||||||
|
@ -85,7 +85,7 @@ def add_form_properties(form_class, node_type):
|
|||||||
elif field_type == 'integer':
|
elif field_type == 'integer':
|
||||||
field = IntegerField(prop_name, default=0)
|
field = IntegerField(prop_name, default=0)
|
||||||
elif field_type == 'float':
|
elif field_type == 'float':
|
||||||
field = FloatField(prop_name, default=0)
|
field = FloatField(prop_name, default=0.0)
|
||||||
elif field_type == 'boolean':
|
elif field_type == 'boolean':
|
||||||
field = BooleanField(prop_name)
|
field = BooleanField(prop_name)
|
||||||
elif field_type == 'objectid' and 'data_relation' in schema_prop:
|
elif field_type == 'objectid' and 'data_relation' in schema_prop:
|
||||||
@ -172,6 +172,11 @@ def process_node_form(form, node_id=None, node_type=None, user=None):
|
|||||||
data = 0
|
data = 0
|
||||||
else:
|
else:
|
||||||
data = int(form[prop_name].data)
|
data = int(form[prop_name].data)
|
||||||
|
elif schema_prop['type'] == 'float':
|
||||||
|
if not data:
|
||||||
|
data = None
|
||||||
|
else:
|
||||||
|
data = float(form[prop_name].data)
|
||||||
elif schema_prop['type'] == 'datetime':
|
elif schema_prop['type'] == 'datetime':
|
||||||
data = datetime.strftime(data, current_app.config['RFC1123_DATE_FORMAT'])
|
data = datetime.strftime(data, current_app.config['RFC1123_DATE_FORMAT'])
|
||||||
elif schema_prop['type'] == 'list':
|
elif schema_prop['type'] == 'list':
|
||||||
|
11
pillar/web/static/assets/vrview/embed.min.js
vendored
Normal file
11
pillar/web/static/assets/vrview/embed.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
pillar/web/static/assets/vrview/loading.gif
Normal file
BIN
pillar/web/static/assets/vrview/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 KiB |
511
pillar/web/static/assets/vrview/three.min.js
vendored
Normal file
511
pillar/web/static/assets/vrview/three.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
19
readme.md
19
readme.md
@ -35,3 +35,22 @@ pip install -e ../pillar-python-sdk
|
|||||||
pip install -U -r requirements.txt
|
pip install -U -r requirements.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## HDRi viewer
|
||||||
|
|
||||||
|
The HDRi viewer uses [Google VRView](https://github.com/googlevr/vrview). To upgrade,
|
||||||
|
get those files:
|
||||||
|
|
||||||
|
* [three.min.js](https://raw.githubusercontent.com/googlevr/vrview/master/build/three.min.js)
|
||||||
|
* [embed.min.js](https://raw.githubusercontent.com/googlevr/vrview/master/build/embed.min.js)
|
||||||
|
* [loading.gif](https://raw.githubusercontent.com/googlevr/vrview/master/images/loading.gif)
|
||||||
|
|
||||||
|
and place them in `pillar/web/static/assets/vrview`. Replace `images/loading.gif` in `embed.min.js` with `static/pillar/assets/vrview/loading.gif`.
|
||||||
|
|
||||||
|
You may also want to compare their
|
||||||
|
[index.html](https://raw.githubusercontent.com/googlevr/vrview/master/index.html) to our
|
||||||
|
`src/templates/vrview.jade`.
|
||||||
|
|
||||||
|
When on a HDRi page with the viewer embedded, use this JavaScript code to find the current
|
||||||
|
yaw: `vrview_window.contentWindow.yaw()`. This can be passed as `default_yaw` parameter to
|
||||||
|
the iframe.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5,12 +5,13 @@
|
|||||||
section.node-preview
|
section.node-preview
|
||||||
| {% if node.picture %}
|
| {% if node.picture %}
|
||||||
iframe(
|
iframe(
|
||||||
|
id='vrview_window'
|
||||||
width='100%',
|
width='100%',
|
||||||
height='450px',
|
height='450px',
|
||||||
scrolling='no',
|
scrolling='no',
|
||||||
frameborder='0',
|
frameborder='0',
|
||||||
allowfullscreen='',
|
allowfullscreen='',
|
||||||
src="{{url_for('main.vrview', preview=node.picture.thumbnail('l', api=api), image=node.picture.thumbnail('h', api=api), is_stereo='false')}}")
|
src="{{url_for('main.vrview', preview=node.picture.thumbnail('l', api=api), image=node.picture.thumbnail('h', api=api), default_yaw=(node.properties.default_yaw or 0))}}")
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
|
||||||
section.node-details-container
|
section.node-details-container
|
||||||
@ -130,4 +131,3 @@ script.
|
|||||||
});
|
});
|
||||||
|
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
|
@ -13,4 +13,13 @@ html(lang='en')
|
|||||||
.wrap
|
.wrap
|
||||||
h1.title Error
|
h1.title Error
|
||||||
p.message An unknown error occurred.
|
p.message An unknown error occurred.
|
||||||
script(src="{{url_for('static_pillar', filename='assets/js/vrview-analytics.min.js')}}")
|
script(src="{{url_for('static_pillar', filename='assets/vrview/three.min.js')}}")
|
||||||
|
script(src="{{url_for('static_pillar', filename='assets/vrview/embed.min.js')}}")
|
||||||
|
script.
|
||||||
|
/** Returns the current yaw in degrees. */
|
||||||
|
function yaw() {
|
||||||
|
console.log('default yaw:', worldRenderer.sceneInfo.defaultYaw * 180 / Math.PI);
|
||||||
|
console.log('camera rotation: ', worldRenderer.camera.rotation.y * 180 / Math.PI);
|
||||||
|
var the_yaw = worldRenderer.sceneInfo.defaultYaw + worldRenderer.camera.rotation.y;
|
||||||
|
return the_yaw * 180 / Math.PI;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user