Skip to content

Commit 7284a42

Browse files
committed
optimized lua render
1 parent bffb308 commit 7284a42

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/objects/scripting/LuaScript.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ void LuaScript::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjec
175175
saveScript(lastLuaScript);
176176
}
177177

178+
if(!loaded && ofGetElapsedTimeMillis()-loadTime > 1000){
179+
loaded = true;
180+
prevW = this->getCustomVar("WIDTH");
181+
prevH = this->getCustomVar("HEIGHT");
182+
this->width = prevW;
183+
this->height = prevH;
184+
reloadScriptThreaded();
185+
}
186+
}
187+
188+
//--------------------------------------------------------------
189+
void LuaScript::drawObjectContent(ofxFontStash *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
190+
178191
///////////////////////////////////////////
179192
// LUA UPDATE
180193
if(scriptLoaded && !isError){
@@ -247,18 +260,6 @@ void LuaScript::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjec
247260
*static_cast<ofTexture *>(_outletParams[0]) = fbo->getTexture();
248261
///////////////////////////////////////////
249262

250-
if(!loaded && ofGetElapsedTimeMillis()-loadTime > 1000){
251-
loaded = true;
252-
prevW = this->getCustomVar("WIDTH");
253-
prevH = this->getCustomVar("HEIGHT");
254-
this->width = prevW;
255-
this->height = prevH;
256-
reloadScriptThreaded();
257-
}
258-
}
259-
260-
//--------------------------------------------------------------
261-
void LuaScript::drawObjectContent(ofxFontStash *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
262263
ofSetColor(255);
263264
if(static_cast<ofTexture *>(_outletParams[0])->isAllocated()){
264265
// draw node texture preview with OF

0 commit comments

Comments
 (0)