Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kasen Plugin Infrastructure v½ Codename "Modkit Mini" #15906

Merged
merged 10 commits into from Sep 11, 2019

Conversation

@kasenvr
Copy link
Contributor

commented Jul 10, 2019

Kasen Plugin Infrastructure v½ Codename "Modkit Mini"

http://roadmap.highfidelity.com/open-source-project-proposals/p/open-source-modkit

Summary

We want to split up and make the Modkit integration more manageable. Per hifi://roundtable discussions the next overall steps with Modkit include meeting with internal developers to help identify exact plugin API specifications.

In the meantime, to highlight one available strategy and foster community interest, this PR includes just enough to demonstrate a working example of adding a local JS API using the existing Qt Plugin + Hifi ScriptInitializer system.

Before, it was only practical to integrate this kind of plugin with Interface client scripts. Now, with the changes in this PR, it becomes possible to use local plugins to extend the functionality of any primary scripting context:

Comparison table between supported script contexts

KasenAPIExample

A new plugin named plugins/KasenAPIExample.dll builds with this PR and implements some potentially useful methods:

  • KasenAPIExample.now() -- current time in microseconds (1/1000th milliseconds)
  • KasenAPIExample.getBlendshapeNames(avatarID) -- avatar's blendshape names
  • KasenAPIExample.getBlendshapes(avatarID) -- avatar's current blendshape coefficients

Note: Similar to other stock Hifi plugins, the produced DLL is likely only compatible with the exact version of Interface.exe / assignment-client.exe it is built for.

Recognizing Qt and High Fidelity intend to migrate away from QtScript at some point, this example also suggests one way to compartmentalize new code that steers clear of unnecessary QtScript APIs. KasenAPIExample.cpp itself does not depend on QtScript at all... and is 100% forward-compatible with use as-is from both QJSEngine and QML contexts.

Testing

https://gist.github.com/humbletim/2965e3c7dea30570a2b425f789ec4bf6#file-common-js (use the Raw button URL)

All client tests use the raw version of this bootstrapping script. The success indication will appear as follows according to the script type:

=== TEST === {"type":"entity_server","api":"[KasenAPIExample version=0.0.1]","now":"1563152502769440"}

All tests must have the "Enable custom script plugins" setting toggled on/off via the checkbox shown here, a restart is required on toggle:

Settings > Security

Interface / client

  • Open interface
  • Ensure your CTRL+SHIFT+L is displayed
  • Go to running scripts and add this script
  • Confirm: Watch the log for a version number and timestamp from the script

Interface / avatar

  • Add this script to your avatar's .fst file
  • Open interface
  • Ensure your CTRL+SHIFT+L is displayed
  • Switch to the avatar that has the edited .fst file
  • Confirm: Watch the log for a version number and timestamp from the script

If your edited avatar loaded by default, you may have to search the log. You may have to switch the avatar and then switch back, whichever is easier.

Interface / entity_client

  • Open interface
  • Create a simple entity such as a cube
  • Ensure your CTRL+SHIFT+L is displayed
  • Attach this script to the entity in its client entity script field
  • Confirm: Watch the debug log for a version number and timestamp from the script

Testing Server

You will need to run the local sandbox server supplied in the PR build by Gustavo. All tests from here will be conducted using that. For servers, an environment variable must be set in lieu of a checkbox since there is no interface:

SET enableScriptingPlugins=1

assignment-client / entity_server

  • Open interface
  • Create a simple entity such as a cube
  • Ensure your developer, scripting, entity-server script log is displayed
  • Attach this script to it in its server entity script field
  • Confirm: Watch the log for a version number and timestamp from the script

assignment-client / agent

  • Open the domain-server webpanel
  • Go to Content > Scripts
  • Add the script, one instance, and leave the pool field blank
  • Confirm: Restart the server and in the log for the server should have the output with a version number and timestamp from the script

assignment-client / edit_filter

  • Open interface
  • Create a zone
  • In the filter field of the zone properties, add the filter script
  • Create a simple entity such as a cube within this zone
  • Confirm: Check the user data for the newly created cube, it should have a version and timestamp outputted to it by the filter script.
@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

Can someone from High Fidelity approve this PR?

1 similar comment
@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

Can someone from High Fidelity approve this PR?

@CLAassistant

This comment has been minimized.

Copy link

commented Jul 10, 2019

CLA assistant check
All committers have signed the CLA.

@kasenvr

This comment has been minimized.

Copy link
Contributor Author

commented Jul 10, 2019

@ZappoMan Hey there! This is the PR related to what we discussed in Canny. :)

@ZappoMan

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

add to whitelist


#include <functional>
#include <memory>
#include <QtCore/QDebug>

This comment has been minimized.

Copy link
@ZappoMan

ZappoMan Jul 10, 2019

Contributor

If the goal of modkit is to not have dependencies on Qt, then we shouldn't be adding these headers.

It would seem preferable to the mission of modkit to only use native C++ types, and not Qt types.

This comment has been minimized.

Copy link
@kasenvr

kasenvr Jul 10, 2019

Author Contributor

Essentially, the goal of “Modkit” is not to get rid of dependencies but rather to optimize the process for making modifications and distributing them for High Fidelity software -- Reducing dependencies where practical, improving quality of life is the paramount goal.

As proposed v1.0 “Modkit” depends on Qt and only Qt. Items like Python, vcpkg, etc. are not required to make a “Modkit” native plugin. Plugins compiled with 5.9.1 for example continue to work as is on latest Interface+Qt runtimes. Overall the goal is to increase the possibility for rapid iteration and decrease the barriers to creation and distribution of extensions.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

Android build is available here. Quest build is available here

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

Android build is available here. Quest build is available here

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

modkit core changes initial commit
whitespace corrections + warnings
updated cmake plugin
rework with focus on JS API integration example
cleanup edit_filter scope
separate-out edit_filter wantsScope stuff
-plugin metadata
split scriptengines out separately
cleanup __url/__filename sets
additional cleanup
fix typo; consolidate ScriptInitializerMixin inits
add more example API protoypes
cleanup pass; fix entity_server / agent init
fix whitespace
remove technically unnessary plugin filtering
+EDIT_FILTER_SCRIPT; cleanup
reorder public/slot/private
use std::count_if
formatting
better debug output; cleanup
fix msvc compiler warning
cleanup
eradicate QtScript references from API Example
updated header comments
Updated KasenAPIExample

@humbletim humbletim force-pushed the kasenvr:kpi-v1-modkit-rc branch from 9247856 to e9e9607 Jul 15, 2019

@kasenvr kasenvr changed the title Kasen Plugin Infrastructure v1.0 Codename "Modkit" Initial Kasen Plugin Infrastructure v½ Codename "Modkit Mini" Jul 15, 2019

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 15, 2019

Android build is available here. Quest build is available here

@ctrlaltdavid

This comment has been minimized.

Copy link
Collaborator

commented Jul 23, 2019

The PR's installer (Windows) results in two copies of the KaisenAPIExample.dll file: one in the root install directory and one in the plugins subdirectory.

@kasenvr

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

The PR's installer (Windows) results in two copies of the KaisenAPIExample.dll file: one in the root install directory and one in the plugins subdirectory.

Thanks for finding that! We were modeling the CMake after the other server-side plugins (pcmCodec.dll & hifiCodec.dll). It turns out that you discovered a larger bug since those dlls are also duplicated by the installer. We have fixed our plugin specifically in our latest commit and will file a bug report regarding the others.

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

Android build is available here. Quest build is available here

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2019

Android build is available here. Quest build is available here

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@ZappoMan ZappoMan added this to the v0.84.0 milestone Jul 31, 2019

@ZappoMan
Copy link
Contributor

left a comment

project approved

@kasenvr

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2019

@ctrlaltdavid Does everything look a-okay to get an star of approval? :)

@ctrlaltdavid

This comment has been minimized.

Copy link
Collaborator

commented Aug 11, 2019

@kasenvr It looks good to me but the final ticks and merge need to come from an internal dev.

@kasenvr

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

@ctrlaltdavid Ah gotcha, thank you! @ZappoMan Who might be the chosen one to get this through ASAP? :)

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

@hifi-gustavo

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

Android build is available here. Quest build is available here

@ZappoMan
Copy link
Contributor

left a comment

CR Approved

@shanzzam
Copy link
Contributor

left a comment

PA

@shanzzam shanzzam merged commit 65d0bb1 into highfidelity:master Sep 11, 2019

2 checks passed

default Build finished.
Details
license/cla Contributor License Agreement is signed.
Details

@shanzzam shanzzam modified the milestones: v0.84.0, v0.85.0 Sep 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.