Modeling best practices - aframe

I worked some days on models that should be used with aframe, built with blender, exported to .obj. All went mostly very well, so the experience so far was very positive.
Until an object started to throw exceptions after some small changes at a model that worked well so far. The stacktrace is
aframe.js:sourcemap:27095 Uncaught TypeError: Cannot set property 'value' of undefined
at initMaterial (aframe.js:sourcemap:27095)
at setProgram (aframe.js:sourcemap:27191)
at WebGLRenderer.renderBufferDirect (aframe.js:sourcemap:26139)
at renderObjects (aframe.js:sourcemap:26961)
at WebGLRenderer.render (aframe.js:sourcemap:26698)
at THREE.VREffect.render (aframe.js:sourcemap:79772)
at HTMLElement.value (aframe.js:sourcemap:74829)
at bound (aframe.js:sourcemap:78097)
56aframe.js:sourcemap:27732 Uncaught TypeError: Cannot set property 'needsUpdate' of undefined
at markUniformsLightsNeedsUpdate (aframe.js:sourcemap:27732)
at setProgram (aframe.js:sourcemap:27325)
at WebGLRenderer.renderBufferDirect (aframe.js:sourcemap:26139)
at renderObjects (aframe.js:sourcemap:26961)
at WebGLRenderer.render (aframe.js:sourcemap:26698)
at THREE.VREffect.render (aframe.js:sourcemap:79772)
at HTMLElement.value (aframe.js:sourcemap:74829)
at bound (aframe.js:sourcemap:78097)
I found the problematic object, so I just rebuild it, no big deal this time.
But: When such a problem pops up later in the process, it might not be so easy to just rebuild. So my question is if there are any general tips to prevent such breakage. For example what to watch out for or what blender features to stay away from.
It's easy to rebuild the model now, but might be much harder later in the production process. I'd like to prevent this in the future.
Exporting from blender to gltf failed for me with pretty simple objects already.

Related

Axon Framework Event Package Refactoring

I have a set of events that have been refactored to another package. This works as is until I execute the event replay. Digging deeper I noticed a payloadtype in the domainevententry table and figure changing this would be sufficient but alas it seems the xml root element of the event needs to be changed as well. I am hoping there is a simple way to do this.
I cannot find any examples on upcasting to different packages or using XStream aliasing so any help would be greatly appreciated.
Thanks
As you noticed, the default payload type stored in events is the fully qualified class name. This ensures that out of the box serialization and deserialization work as intended. However, moving classes around thus means the payload type can no longer be found, requiring some adjustment to be made.
You could have used the EventTypeUpcaster, as referred to in the Reference Guide. The EventTypeUpcaster is dedicated to adjusting the payload type, and thus can also be used to deal with changing package names.
When using (the default) XStreamSerializer, aliasing the tags would indeed also work. How to set aliases can be seen here for example. AS noticed in that sample, the alias is added to the XStream instance. The XStreamSerializer uses an XStream instance to support de-/serialization from/to XML. To adjust the XStream instance, you can simply use the builder paradigm on the XStreamSerializer. The JavaDoc of the builder should be specific enough to help you out how to use it.
Went the long way round with this but it seems to work. As always, backup your database before executing large volume changes. I also restarted the service using the database on completion. Needless to say I will make sure the events are in logical packages before deploying next time :)
Database Engine: Postgres 10
Table: domainevententry
update domainevententry
set
payloadtype = '<new.package.Classname>',
payload = lo_from_bytea(0, decode(REPLACE(
subquery.output,
'<old.package.Classname>',
'<new.package.Classname>'
), 'escape'))
from (
SELECT eventidentifier, payloadtype, encode(lo_get(payload::oid), 'escape') as output FROM domainevententry
WHERE eventidentifier in (
'<event guid 1>',
'<event guid 2>'
)
AND payloadtype = '<old.package.Classname>'
) as subquery
where domainevententry.eventidentifier = subquery.eventidentifier;
Once that is completed I needed to update the OWNER of the large object:
ALTER LARGE OBJECT <LargeObjectId> OWNER TO database_role;
Probably not the most elegant solution but based on the time constraints I have, it did the job. There are probably encoding issues with this solution for the large object but it all worked out for me in the end. Feel free to share any optimizations that would make the above more suitable.
Firing off the Axon Framework replays rebuilt the projections and everything lined up.

Spark Video Player null Object Error After Playback Error

I'm having a problem with the Spark VideoPlayer. If the player encounters a playback error (maybe due to it not being able to play the file) and I then try to set the source again I get a null object error. The error occurs here:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at spark.components::VideoDisplay/cleanUpSource()
E:\dev\4.y\frameworks\projects\spark\src\spark\components\VideoDisplay.as:1956]
which points to
videoPlayer.displayObject.visible = true;
where the displayObject is null.
I can't seem to find a way around this problem other than ditching the VideoPlayer component and creating my own.
I've seen a few post relating to this problem but I've not found a solution which work for me.

QtSQL: "prepared statement "qpsqlpstmt_1" does not exist" on clear() of model

I am getting the following error message printed in the console:
Unable to free statement: ERROR: prepared statement "qpsqlpstmt_1" does not exist
It is printed when the the following function is called in the application (or when the object is deleted (if clear() is not called before delete):
sqlQueryModel->clear();
sqlQueryModel object is of type QSqlQueryModel and is used throughout a derived class to communicated with a PostgreSQL database. It also serves as a model for QCompleter. I have never declared or used the name "qpsqlpstmt_1".
Could someone help me interpret the error message please, and explain what might be causing it? Is this indicative of a problem in my code or a Qt bug? (likely the former :))
On reviewing the PostgreSQL log file on the server, the exact same statement appears plus an additional line:
STATEMENT: DEALLOCATE pqsqlpstmt_1
See these Qt issue tracker entries:
https://bugreports.qt.io/browse/QTBUG-8860
https://bugreports.qt.io/browse/QTBUG-16007
https://bugreports.qt.io/browse/QTBUG-15979
... all of which mention your prepared statement name and relate to deletion.
After a considerable amount of time, I realized that I was simply closing the connection to the database before calling clear... not a good strategy.

Flex Error #1009: Cannot access a property or method of a null object reference

I'm getting error while running a game I created with flex.
I know there has been some question about this, but my case is quite weird. I created a simple typing game that is running OK on my computer, but when I tried to deploy it online to facebook, I got those errors. I used code from the tutorial from adobe here http://www.adobe.com/devnet/facebook/articles/flex_fbgraph_pt4.html to deploy my flex game to facebook
This is the error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FacebookUserStatusWeb/init()
at FacebookUserStatusWeb/___FacebookUserStatusWeb_Application1_creationComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
And here is snippet of the init() function:
protected var text1:String="Text to be typed"; //hard-coded temporarily
protected const TIMER_INTERVAL:int = 10;
protected var t:Timer = new Timer(TIMER_INTERVAL);
protected var topURL:String=ExternalInterface.call('top.location.toString');
protected function init():void
{
t.addEventListener(TimerEvent.TIMER, updateTimer);
ProblemText.text = new String(text1);
Facebook.init("<my app id>",loginHandler);
currentState = (topURL) ? "loggedout": "loggedoutonfacebook";
}
Some notes:
1.my app id is my facebook app id which I prefer not to show
2.ProblemText is a richtext which I placed the paragraph to be typed by the player.
3.I have deleted the method Application1_creationComplete() but it still appears at the error listing
And also I am curious about the errors other than the first two. What do they mean?
Ah, and if it is helpful, I can post some more of the code
First: You're only seeing one error. Everything you see below the #1009 error is your stack trace, not additional errors.
The stack trace basically tells you the series of things that happened prior to the error occurring, with the most recent at the top. This is useful because often things which happen prior to the actual error you see will contribute to said error.
Second: The null object reference is occurring because something in your init() function tried to access a property in an object that doesn't exist, or an object that doesn't exist. One (slightly messy but effective) way to debug this would be to drop some trace statements in the code to see how far it gets before barfing with the error -- the idea being to isolate the specific line that's causing the problem. Once you've done that, you need to work backwards to figure out why the object or property you're trying to use is null. It could be something simple, like a typo, or it could be more complex. You'll have to sleuth it out, one way or another =)
Good luck!
Finally got the bug. Just in case people have the same case with me, what exactly happened is at my computer I simulated the game with just one state, but when I'm deploying to facebook I have several states (loggedin,loggedout,etc). In the init() I tried to access ProblemText Label that is not present in the current state.

Very odd null object RTE on FocusManager

I am getting this error, randomly when I start my application (and it's sub applications). As you can see the stack trace is rather useless, although through the debugger I can see the parent of container (second in the stack) is an MXML class that has a repeater that repeats another component.
Therefore I guess the component with the problem is that repeated component, although I am unsure what I can change to stop this from happening. If anyone can give me some insight to the FocusManager or the getFocus() function it would be really handy.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.managers::FocusManager/getFocus()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:542]
at mx.core::Container/createOrDestroyScrollbars()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:4571]
at mx.core::Container/createScrollbarsIfNeeded()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:4402]
at mx.core::Container/createContentPaneAndScrollbarsIfNeeded()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:4218]
at mx.core::Container/validateDisplayList()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2734]
at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\LayoutManager.as:677]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8733]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8673]
Thanks
Rob
It seems that the problem was related to removing a SWF from the stage whilst is was still loading.
http://tech.groups.yahoo.com/group/flexcoders/message/147691
The solution would be to only remove SWFs from the stage once they are fully loaded.

Resources