bug fixes and python enhancements

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sun Mar 07, 2010 2:24 am

I have several more fixes here:

[size=150:9dbubh4w]#1[/size:9dbubh4w]
Problem: Rotation is accelerated when using corner filters on sprites.
Example: [url:9dbubh4w]http://www.box.net/shared/565m9reptj[/url:9dbubh4w]
Fix: "Runtime\RenderLayer.cpp" (line 213) "angle" was not converted to radians.
[code:9dbubh4w] //quad q((r - hotspot).rotate_to_quad(angle, r.topleft()));
quad q((r - hotspot).rotate_to_quad(cr::to_radians(angle), r.topleft()));[/code:9dbubh4w]


[size=150:9dbubh4w]#2[/size:9dbubh4w]
Problem: When using python many of the actions in "System" are different in the IDE editor than at runtime. The "action" names as listed in the IDE are defined in "IDE\Structure\SystemObject.cpp" and the "action" names used at runtime are defined in "Runtime\System.cpp"(lines 209-265).

Fix: I tweaked the files so that the names match.
Here's the modified "IDE\Structure\SystemObject.cpp" file: SystemObject.cpp
and here is the section of code to replace "Runtime\System.cpp"(lines 209-265): fixSystem.cpp


[size=150:9dbubh4w]#3[/size:9dbubh4w]
Problem: I didn't modify any of the expression names in "IDE\Structure\SystemObject.cpp"(line 694-788) as it looks like they are the names used it construct itself outside of python. In "Runtime\System.cpp" (lines 436-512) the runtime uses the same expression names as the IDE but in all lowercase. Which is fine except for "global" on line 444. "global" is a reserved name in python.

Fix: change "IDE\Structure\SystemObject.cpp"(line 444) to:
[code:9dbubh4w] {"globalvar", &SystemObject::eGlobalValue},[/code:9dbubh4w]


[size=150:9dbubh4w]#4[/size:9dbubh4w]
Problem: Accessing private variables in python don't work and cause crashes. Global variable are accessible but only by an integer. It seems that for private variables the parameter type is checked and only works if the type is "EXPTYPE_VARIABLENAME" otherwise it uses "-1" as an index, which explains the crashes because python will never return a "EXPTYPE_VARIABLENAME" and "-1" is out of bounds.

Fix: I made it so variables can be accessed via vaiablename, integer or string.
Outline of changes: variableFixes
I added 2 functions to simplify:
GetVariableIndexFromName: which is just an overloaded function of the same name but takes takes CRunObjType instead of CRunObject as a parameter.
getGlobalVarIndex: to group the type checking for global variables in one place.


PS:
I hope this is easy enough to follow, but if it isn't let me know. Also is there a better or preferred method to submit fixes to construct's source code.
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711

Post » Sun Mar 07, 2010 5:44 am

great work rojo
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Mar 08, 2010 7:00 am

Well it's finally all committed to the SVN. :D
Had to rework some of the fixes, but now they're working good now.
All that's left to do now is wait... or fix more stuff.

cheers
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711

Post » Wed Mar 10, 2010 3:01 am

*High five*

People like you deserve cookies. By any chance, do you look into bugs by request?
B
2
G
3
Posts: 20
Reputation: 890

Post » Wed Mar 10, 2010 4:13 am

Cookies indeed! great work!
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Thu Mar 11, 2010 8:08 pm

Thanks for the cookies. As for requests, the short answer is no. But as I get more familiar with construct's code I will be able to do more, time permitting.
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests