Skip to content

Commit

Permalink
Fixed morphGeometry plugin API
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed May 22, 2013
1 parent 61e82d6 commit c3d9657
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
28 changes: 15 additions & 13 deletions build/latest/scenejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9286,26 +9286,28 @@ new (function () {

self._source = sourceService.getSource();

if (!self._source.onUpdate) {
if (!self._source.subscribe) {
throw SceneJS_error.fatalError(
SceneJS.errors.PLUGIN_INVALID,
"morphGeometry: 'onUpdate' method not found on source provided by plugin type '" + params.source.type + "'");
"morphGeometry: 'subscribe' method not found on source provided by plugin type '" + params.source.type + "'");
}

self._source.onCreate(// Get notification when factory creates the morph
var created = false;

self._source.subscribe(// Get notification when factory creates the morph
function (data) {

self._buildNodeCore(data);
if (!created) {
self._buildNodeCore(data);

self._core._loading = false;
self._fireEvent("loaded");
self._core._loading = false;
self._fireEvent("loaded");

self._engine.branchDirty(self); // TODO
});
self._engine.branchDirty(self); // TODO

created = true;

if (self._source.onUpdate) {
self._source.onUpdate(// Reload factory updates to the morph
function (data) {
} else {

if (data.targets) {

Expand All @@ -9331,8 +9333,8 @@ new (function () {
// self.setFactor(params.factor);

self._display.imageDirty = true;
});
}
}
});

self._core._loading = true;

Expand Down
28 changes: 15 additions & 13 deletions src/core/scene/morphGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,28 @@ new (function () {

self._source = sourceService.getSource();

if (!self._source.onUpdate) {
if (!self._source.subscribe) {
throw SceneJS_error.fatalError(
SceneJS.errors.PLUGIN_INVALID,
"morphGeometry: 'onUpdate' method not found on source provided by plugin type '" + params.source.type + "'");
"morphGeometry: 'subscribe' method not found on source provided by plugin type '" + params.source.type + "'");
}

self._source.onCreate(// Get notification when factory creates the morph
var created = false;

self._source.subscribe(// Get notification when factory creates the morph
function (data) {

self._buildNodeCore(data);
if (!created) {
self._buildNodeCore(data);

self._core._loading = false;
self._fireEvent("loaded");
self._core._loading = false;
self._fireEvent("loaded");

self._engine.branchDirty(self); // TODO
});
self._engine.branchDirty(self); // TODO

created = true;

if (self._source.onUpdate) {
self._source.onUpdate(// Reload factory updates to the morph
function (data) {
} else {

if (data.targets) {

Expand All @@ -113,8 +115,8 @@ new (function () {
// self.setFactor(params.factor);

self._display.imageDirty = true;
});
}
}
});

self._core._loading = true;

Expand Down

0 comments on commit c3d9657

Please sign in to comment.