diff --git a/client/ajax-er.js b/client/ajax-er.js new file mode 100644 index 0000000..04cbe71 --- /dev/null +++ b/client/ajax-er.js @@ -0,0 +1,109 @@ +/* ajax-er.js -- provides ajax interface for the frontend to connect to the backend. + * basic work is to propagate sensor data from client to server. + * + * written by samar -- 060321011 + * + */ +debug = true; + +function sensorRequestHandler(sensorName,dataString) +{ + //which sensor said ? sensorName + //what did it say ? dataString + + //make proper url + + url = "/appy/engine/AJAXSensor.py?sensorName="+sensorName+"&q="+dataString; + + //create ajax request object + var sensorRequest; + if (window.XMLHttpRequest) { // Mozilla, Safari, ... + sensorRequest = new XMLHttpRequest(); + if (sensorRequest.overrideMimeType) { + sensorRequest.overrideMimeType('text/xml'); + // See note below about this line + } + } + else if (window.ActiveXObject) { // IE + try { + sensorRequest = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch (e) { + try { + sensorRequest = new ActiveXObject("Microsoft.XMLHTTP"); + } + catch (e) {} + } + } + + if (!sensorRequest) { + alert('Giving up :( Cannot create an XMLHTTP instance! AppY won\'t work'); + return false; + } + + sensorRequest.onreadystatechange = function() + { + if (sensorRequest.readyState == 4) + { + if (sensorRequest.status == 200) + { + response = sensorRequest.responseXML; + if (debug) alert(response); + var element = response.getElementsByTagName('root').item(0); // Read the first element + document.ajax.dyn.value = element.firstChild.data; // Assign the content to the form + + exec(actuator(sensorRequestHandler.responseText)); + } else { + alert('There was a problem with the request.'); + } + } + }; + + //send request + sensorRequest.open('GET', url, true); + sensorRequest.send(''); + + + + //attach actuator + +} + +//this is the beginning of all things +function beginGame() +{ + //get status from server + //if working + //ask to start game + //get user details + getUserDetails() + //get the number of words in the movie title + //create guessBoxes + createGuessBoxes() + //hand-over control to the GameController + //else + //say the error + //give contact details +} + +function userEnteredWordSensor(word) +{ + //what word ? + alert(word); + sensorRequestHandler("userEnteredWordSensor",word); +} + +function userIdleForLongTimeSensor(idle_time) +{ + //how much time was the user idle for ? +} + +function userEnteredNonPerformedWordSensor() +{ + //which word did he enter ? +} + +function userGuessedtheMovieTitle() +{ + +} diff --git a/client/appy.html b/client/appy.html new file mode 100644 index 0000000..05bd063 --- /dev/null +++ b/client/appy.html @@ -0,0 +1,123 @@ + + + + + + + AppY/dumb_charades_ai + + + + + + + +
+
+ +
+
+
+
+
+
+
+ + Press TAB to submit your guess. +
+
+ +
+ +
+ + diff --git a/engine/AJAXSensor.py b/engine/AJAXSensor.py new file mode 100644 index 0000000..ffa3d82 --- /dev/null +++ b/engine/AJAXSensor.py @@ -0,0 +1,56 @@ +#AJAXSensor.py -- +# handles the sensor requests from the front-end and propages it to the proper sensor on the backend +# then responds back to the client with the response in XML form. + +# written by samar - 060321011 +# This file is under Apache License. + +#uses the mod_python libraries for all cgi dealings +from mod_python import util, apache, Session; +from urllib import unquote; +from sensors import *; + +debug = True; + + +def handler(req): + '''this is sort of main(char args[]) in C -- req is the request object''' + global debug #refer to the global instance + + session = Session.Session(req); + try: + if session.is_new(): + session['user_name'] = req. + session['type'] + session['waypoint_info'] + session['uid'], + session['wordid'] + + req.content_type = "text/html"; + query_string = util.parse_qs(req.parsed_uri[7]); + + req.write(str(query_string)); + sensorName = query_string['sensorName'][0]; + if debug: req.write("Sensor = " + sensorName); + senseString = query_string['q'][0]; + + #dynamic calls implemented for the first time in history of SICSR! + if (len(q.strip())) == 0: + prepareandsendResponse('Error: You need to enter something!'); + else: + call = "responseDict = %s(req,'%s')" % (sensorName,senseString); + exec(call); #call the right function and stores the response in responseList; + req.write("You said %s and the response is %s" % senseString, responseList ); + return apache.OK; + +def prepareandsendResponse(responseDict): + response = """ + + %s + %s + + {path} + {paths-seperated-by-semicolon} + {word_info} + + """; diff --git a/engine/AJAXSensor.pyc b/engine/AJAXSensor.pyc new file mode 100644 index 0000000..a3f65de Binary files /dev/null and b/engine/AJAXSensor.pyc differ diff --git a/engine/AJAXSensor.pyc-before-removal b/engine/AJAXSensor.pyc-before-removal new file mode 100644 index 0000000..42d1c56 Binary files /dev/null and b/engine/AJAXSensor.pyc-before-removal differ diff --git a/engine/appy.py b/engine/appy.py new file mode 100644 index 0000000..96aa7c1 --- /dev/null +++ b/engine/appy.py @@ -0,0 +1,58 @@ +import re; +import nltk; +from functions import *; + +###take the movie title +#movie_title = raw_input("Enter Movie Title ==>") +file = open("../test_data/movie_250","r") #take it from the top 250 db of IMDB +#read the movie title +movie_title = file.readline() + +###start processing. +print 'Shh! I am going to enact-->', movie_title; + +#where is the user from ? -- take this from client.html +user_location = raw_input("Where are you from ?"); + +#have we already performed this movie title ? + +#start individual word processing +while True: + #get the intividual words + word_list = nltk.word_tokenize(movie_title) + + #remove the extraApostrophes + word_list = removeExtraApostropheS(movie_title,word_list); + print "After removeExtraApostropheS -->", word_list + + #scan the list for determining the EASIEST one and so on... -- the order of performance + #this is an ordered tuple(word, priority(default 0), action_seq_id) + ordered_list = [] + t = 0; + + ordered_list = determineOrder(word_list) + for w in ordered_list: + #convert to singular --> no need, nltk CAN process plurals as well. + print "Processing %s" % w + + #do we have a corresponding action sequence in db ? + + #database search -- + #somethign like --> if x in databaseList(): + #if yes, assign +1 + #if no, assign -1 + + + inDatabase, action_seq_id, length = findinDatabase(w) #tuple unpacking + + if inDatabase: + ordered_list += [w, +1, action_seq_id, length] + else: + ordered_list += [w, -1, None, None] + + #sort on the basis of length of action sequence + + print ordered_list; + break; + +print "Done" diff --git a/engine/appy_db.py b/engine/appy_db.py new file mode 100644 index 0000000..aba8dcf --- /dev/null +++ b/engine/appy_db.py @@ -0,0 +1,333 @@ +############################################################################## +# This is the database connector class file that appy uses to make +# transactions with the mysql database. +# +# Created By : Gayatri Venugopal +# Date : 02-04-2009 +# +# Modified By : Deepak Shakya & Samarendra Manohar Hedaoo +############################################################################## + +class accessDb: + ########################## All important members ######################### + connection = None # stores the connection + cursor = None # makes all transactions with the database + host = 'localhost' # MySQL server host + username = 'appy' # MySQL server username + password = 'dumb_charades_ai' # MySQL server password + database = 'appy' # MySQL server database + debug_mode = False # Determines the mode of operation. If true, details messages are returned + #for various operations + + #################################################################### + # openConnection - Opens the connection to the MySQL database + # In debug mode - returns the explanatory information + # In normal mode - returns True if successfully connected, False otherwise + #################################################################### + def openConnection: + try: + connection = MySQLdb.connect(host,username,password,database) + cursor = connection.cursor() + if (debug_mode) + return "Successfully connected to the database" + else + return True + except MySQLdb.Error e + if (debug_mode) + return "Unable to connect to the database - Error %d: %s" % (e.args[0], e.args[1]) + else + return False + else: + connection.close() + + + #################################################################### + # closeConnection - terminates the connection to the MySQL database + # In debug mode - returns the explanatory information + # In normal mode - returns True if successfully connected, False otherwise + #################################################################### + + def closeConnection: + try: + cursor.close() # close the cursor + connection.commit() # commit database changes + connection.close() # close the connection to the database + if (debug_mode) + return "Successfully connected to the database" + else + return True + except MySQLdb.Error e + if (debug_mode) + return "Unable to connect to the database - Error %d: %s" % (e.args[0], e.args[1]) + else + return False + else: + connection.close() + + + def setDebugMode(mode): + debug_mode = mode + + def getDebugMode(mode): + return debug_mode + + def executeQuery(sqlString): + openConnection() + try: + cursor.execute(sqlString) + result_set = cursor.fetchall () + #for row in result_set: + # print "%s, %s" % (row["name"], row["category"]) + # print "Number of rows returned: %d" % cursor.rowcount + #if(debug_mode): + #return "query executed successfully" + return result_set; + except MySQLdb.Error e: + if (debug_mode + return False + else: + closeConnection() + + def createAcSeq: + cursor.execute("DROP TABLE IF EXISTS `action_sequence`") + cursor.execute(""" + CREATE TABLE `action_sequence` + ( `actionseqid` int(10) NOT NULL, + `actionseq` blob NOT NULL, + `tags` varchar(500) NOT NULL, + PRIMARY KEY (`actionseqid`) + ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + def createMovPath: + cursor.execute("DROP TABLE IF EXISTS `movie_path'") + cursor.execute(""" + CREATE TABLE `movie_path` + ( `movieid` int(10) NOT NULL, + `wordid` int(10) NOT NULL, + `pathid` int(10) NOT NULL) + ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + def createMovTitles: + cursor.execute("DROP TABLE IF EXISTS `movie_titles`") + cursor.execute(""" + CREATE TABLE `movie_titles` + ( `movieid` int(10) NOT NULL, + `movietitle` varchar(300) NOT NULL, + PRIMARY KEY (`movieid`)) + ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + def createPath: + cursor.execute("DROP TABLE IF EXISTS `path`") + cursor.execute(""" + CREATE TABLE `path` + ( `pathid` int(10) NOT NULL, + `userid` int(10) NOT NULL, + `wordid` int(10) NOT NULL, + `successrate` float(5,2) NOT NULL, + PRIMARY KEY (`pathid`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + def createTags: + cursor.execute("DROP TABLE IF EXISTS `tags`") + cursor.execute(""" + CREATE TABLE `tags` + ( `tagid` int(10) NOT NULL, + `tag` varchar(100) NOT NULL, + PRIMARY KEY (`tagid`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + + def createTime: + cursor.execute("DROP TABLE IF EXISTS `time`") + cursor.execute(""" + CREATE TABLE `time` + ( `userid` int(10) NOT NULL, + `responsetime` time NOT NULL + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + def createUsers: + cursor.execute("DROP TABLE IF EXISTS `users`") + cursor.execute(""" + CREATE TABLE `users` + ( `userid` int(10) NOT NULL, + `username` varchar(100) NOT NULL, + `location` int(90) NOT NULL, + PRIMARY KEY (`userid`)) + ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + + def createWayPt: + cursor.execute("DROP TABLE IF EXISTS `waypoint`") + cursor.execute(""" + CREATE TABLE `waypoint` + ( `pathid` int(10) NOT NULL, + `type` enum('AS','Image','WI') NOT NULL COMMENT 'AS-ActionSequence, Image - ImageNo, WI - Word Info', + `waypointinfo` varchar(10) NOT NULL COMMENT 'ASid/ImageNo/WordId', + `responsetime` time NOT NULL COMMENT 'time for correst response or to go to next waypoint' + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + + def createWords: + cursor.execute("DROP TABLE IF EXISTS `words`") + cursor.execute(""" + CREATE TABLE `words` + ( `wordid` int(10) NOT NULL, + `word` varchar(100) NOT NULL, + `category` varchar(50) NOT NULL, + `tags` varchar(500) NOT NULL, + PRIMARY KEY (`wordid`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 + """) + + + + def updateAcSeq: + cursor.execute(""" + update action_sequence set = where + """) + + + def updateMovPath: + cursor.execute(""" + update movie_path set = where + """) + + + + def updateMovTitles: + cursor.execute(""" + update movie_titles set = where + """) + + + + def updatePath: + cursor.execute(""" + update path set = where + """) + + + + def updateTags: + cursor.execute(""" + update tags set = where + """) + + + + def updateTime: + cursor.execute(""" + update time set = where + """) + + + + def updateUsers: + cursor.execute(""" + update users set = where + """) + + + + def updateWayPt: + cursor.execute(""" + update waypoint set = where + """) + + + + def updateWords: + cursor.execute(""" + update words set = where + """) + + + + + def insertAcSeq: + cursor.execute(""" + INSERT INTO action_sequence (cols) VALUES ('') + """) + + + + def insertMovPath: + cursor.execute(""" + INSERT INTO movie_path (cols) VALUES ('') + """) + + + def insertMovTitles: + cursor.execute(""" + INSERT INTO movie_titles (cols) VALUES ('') + """) + + + + def insertPath: + cursor.execute(""" + INSERT INTO path (cols) VALUES ('') + """) + + + + def insertTags: + cursor.execute(""" + INSERT INTO tags (cols) VALUES ('') + """) + + + + + def insertTime: + cursor.execute(""" + INSERT INTO time (cols) VALUES ('') + """) + + + + def insertUsers: + cursor.execute(""" + INSERT INTO users (cols) VALUES ('') + """) + + + + def insertWayPt: + cursor.execute(""" + INSERT INTO waypoint (cols) VALUES ('') + """) + + + + + def insertWords: + cursor.execute(""" + INSERT INTO words (cols) VALUES ('') + """) + + + + def delete: + pass; + + def alter: + pass; + + diff --git a/engine/blender/Actions.txt b/engine/blender/Actions.txt new file mode 100644 index 0000000..3e71ae3 --- /dev/null +++ b/engine/blender/Actions.txt @@ -0,0 +1,98 @@ +I - Seq(RightArm("FRONT_DOWN"),RightElbow("BEND"),RightThumbFront("DEFAULT"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +we - Seq(Seq(RightArm("FRONT_DOWN"),RightElbow("BEND"),RightThumbFront("DEFAULT"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")),Par(RightArm("FRONT"),(RightThumbFront("FOLD"),RightIndexFingerFront("DEFAULT"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"))) +You - Par(RightArm("FRONT"),(RightThumbFront("FOLD"),RightIndexFingerFront("DEFAULT"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +Walk - Seq(RightArm("FRONT_DOWN"),LeftThigh("FRONT"),LeftArm("BACK_DOWN"),RightThigh("BACK"),Par(LeftArm("FRONT_DOWN"),RightThigh("FRONT"),RightArm("BACK_DOWN"),LeftThigh("BACK"))) +Run - Seq(Par(RightElbow("BEND","FAST"),LeftElbow("BEND","FAST")),LeftThigh("FRONT","FAST"),RightThigh("FRONT","FAST"),LeftThigh("FRONT","FAST"),RightThigh("FRONT","FAST")) +Eat - Par(Seq(RightArm("DIAGONAL_FRONT_DOWN"),RightElbow("FULL_BEND")),RightThumbRear("DOWN")) +Drink - Par(Seq(Head("BACK"),RightArm(DIAGONAL_FRONT_UP"),RightElbow("BEND")),RightThumbRear("UP")) +Find - Seq(Head("FRONT"),RightArm("DIAGONAL_FRONT_DOWN"),Par(RightWrist("FLIP"),RightElbow("FULL_BEND"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightElbow("DEFAULT"),seq(RightElbow("BEND"),RightElbow("DEFAULT")))) +Jump - Seq(Seq(Par(RightThigh("FRONT_UP"),LeftThigh("FRONT_UP")),Par(KneeLeft("BEND"),KneeRight("BEND")),Par( +Par(RightThigh("DEFAULT"),LeftThigh("DEFAULT")),Par(KneeLeft("DEFAULT"),KneeRight("DEFAULT")))),Seq(Par(RightThigh("FRONT_UP"),LeftThigh("FRONT_UP")),Par(KneeLeft("BEND"),KneeRight("BEND")),Par(Par(RightThigh("DEFAULT"),LeftThigh("DEFAULT")),Par(KneeLeft("DEFAULT"),KneeRight("DEFAULT"))))) +Smile - Seq(RightArm("DIAGONAL_FRONT"),Par(RightElbow("BEND"),RightThumbRear("DOWN"),RightMiddleRear("DOWN"),Finger4RightRear(Down))) +Cry - Seq(Par(RightArm("DIAGONAL_FRONT"),LeftArm("DIAGONAL_FRONT")),Par(RightElbow("FULL_BEND"),LeftElbow("FULL_BEND")),Par(RightWrist("FLIP"),LeftWrist("FLIP")),Par(RightWrist("FLIP"),LeftWrist("FLIP"))) +Giggle - Seq(Par(RightArm("DIAGONAL_FRONT_UP"),LeftArm("DIAGONAL_FRONT_UP")),Par(RightShoulder("UP"),LeftShoulder("UP")),Par(RightShoulder("DEFAULT"),Shoulder("DOWN"))) +Angry - Seq(Par(RightArm("RIGHT_DOWN"),LeftArm("LEFT_DOWN")),Par(RightElbow("FULL_BEND"),LeftElbow("FULL_BEND")),Par(RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightMiddleFinger("FOLD"),RightSmallFinger("FOLD"),LeftThumbFront("FOLD"),LeftIndexFingerFront("FOLD"),LeftMiddleFingerFront("FOLD"),LeftSmallFingerFront("FOLD")),Par(Head("FRONT_LEFT"),Head("FRONT_RIGHT"),Par(Head("FRONT_LEFT"),Head("FRONT_RIGHT")) +Mad - Show tongue +Bend - Waist("FRONT") +Exercise - Par("FRONT_DOWN"),RightWrist("FLIP"),RightThumbFront("FOLD"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightElbow("FULL_BEND"),LeftArm("LEFT_DOWN"),LeftWrist("FLIP"),LeftThumbFront("FOLD"),LeftIndexFingerFront("FOLD"),LeftMiddleFingerFront("FOLD"),LeftSmallFingerFront("FOLD"),RightElbow("FULL_BEND"))))) +Study - Par(LeftWrist("FLIP"),RightWrist("FLIP"),LeftElbow("BEND"),RightElbow("BEND"),Head("FRONT_LEFT"),Head("FRONT_RIGHT"),Head("FRONT_LEFT"),Head("FRONT_RIGHT")) +Kick - Par(RightThigh("FRONT"),RightKnee("BEND"),RightKnee("STRAIGHT")) +Punch - Par(RightArm("RIGHT"),Par(RightArm("BACK"),RightElbow("FULL_BEND")),Par(RightArm("FRONT"),RightElbow("DEFAULT"))) +Strong - Par(RightArm("RIGHT"),LeftArm("LEFT"),RightWrist("FLIP"),LeftWrist("FLIP"),LeftElbow("BEND"),RightElbow("BEND")) +Tired - Par(LeftShoulder("DOWN"),RightShoulder("Down"),Head(Front)) +Fly - Par(ArmMiddle(RightFrontRightUp),ArmMiddle(LeftFrontLeftUp),ArmMiddle(RightFrontRightDown),ArmMiddle(LeftFrontLeftDown)) +Punish - Par(LeftArm("LEFT"),RightArm("RIGHT"),LeftElbow("FULL_BEND"),RightElbow("FULL_BEND"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),LeftIndexFingerFront("FOLD"),LeftMiddleFingerFront("FOLD"),LeftSmallFingerFront("FOLD")) +Love - Par(RightArm("SIDE"),RightElbow("BEND")),LeftArm("LEFT_DOWN"),LeftElbow("FULL_BEND")) +Think - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +Intelligent - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightIndexFingerRear("UP"),RightIndexFingerRear("DEFAULT")) +Hand - RightArm("UP") + +Shoulder - Par(LeftShoulder("UP"),RightShoulder("UP")) +Torso - +Back - Par(RightArm("DIAGONAL_BACK"),RightElbow("LESS_BEND")) +Elbow - RightElbow("FULL_BEND") +Fingers - Par(RightIndexFingerRear("UP"),RightMiddleFingerRear("UP"),RightSmallFingerFront("UP"),RightThumbRear("UP"))) +Stomach - Par(RightArm("DIAGONAL_FRONT_DOWN"),RightElbow("BEND"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightThumbRear("UP")) +Thigh - Par(RightThigh("FRONT"),RightKnee("BEND")) +Legs - RightThigh("FRONT") +Feet - Par(RightThigh("FRONT_UP")) +Toes - Seq(Par(ToeLeft("UP"),ToeRight("UP")),Par(ToeLeft("DOWN"),ToeRight("DOWN"))) +Face - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +Lips - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightIndexFingerRear("UP")) +Kiss - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightWrist("FLIP"),RightArm("DIAGONAL_FRONT")) +Eyes - +Ears - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightWrist("FLIP")) +Nose - Par(RightArm("FRONT_UP"),RightWrist("FLIP"),RightElbow("FULL_BEND"),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +Cheeks - Par(RightArm("DIAGONAL_FRONT_UP"),RightElbow("FULL_BEND"),RightIndexFinger("FOLD"),RightMiddleFinger("FOLD"),RightSmallFinger("FOLD")) +Skin - Par(RightArm("DIAGONAL_FRONT_DOWN"),LeftArm("DIAGONAL_FRONT_DOWN").RightWrist("FLIP"),LeftWrist("FLIP")) +Pull - Par(RightArm("FRONT"),LeftArm("FRONT"),RightArm("FRONT_UP"),LeftArm("FRONT_DOWN"),RightThumbFront("FOLD"),RightIndexFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),LeftThumbFront("FOLD"),LeftIndexFingerFront("FOLD"),LeftSmallfingerFront("FOLD"),LeftMiddlefingerFront("FOLD")) +Push - Par(RightArm("FRONT_DOWN"),RightWrist("UP"),LeftArm("FRONT_DOWN"),LeftWrist("UP"),Waist("FRONT"),Head("FRONT")) +Talk - +Move - Seq(Par(RightArm("RIGHT"),LeftThigh("FRONT_LEFT")),Par(LeftArm("LEFT"),RightThigh("FRONT_RIGHT"))) +Still - Default +Yawn - Seq(Par(RightWrist("UP"),RightArm("FRONT_UP"),ArmMiddle(LeftSideFront),Elbow(LeftDiagonal45Up)),Head(FrontRight)) +Turn - Seq(Waist("LEFT"),Waist("RIGHT"))) +Shrug - Par(LeftShoulder("LEFT"),RightShoulder("UP")) +Neck-Seq(Head("TILT_LEFT"),Head("TILT_RIGHT")) +Sigh- Seq(Head("BACK"),Head("FRONT")) +Dance- +Yes-Seq(Head("BACK"),Head("FRONT")) +No-Seq(Head("RIGHT"),Head("LEFT")) +Sing-Seq(Par(RightArm("FRONT"),LeftArm("FRONT")),Seq(Par(RightWrist("LEFT"),LeftWrist("LEFT")),Par(RightWrist("UP"),LeftWrist("UP")),Par(RightWrist("RIGHT"),LeftWrist("RIGHT")),Par(RightWrist("UP"),LeftWrist("UP")))) +Scared-Par(Par(RightArm("FRONT_DOWN"),LeftArm("FRONT_DOWN")),Par(RightElbow("FULL_BEND"),LeftElbow("FULL_BEND")),Par(LeftThumbFront("FOLD"),LeftIndexFingerFront("FOLD"),LeftMiddleFingerFront("FOLD"),LeftSmallFingerFront("FOLD"),RightThumbFront("FOLD"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"),RightWrist("RIGHT"),LeftWrist("LEFT"))) +Play-Seq(Par(RightArm("RIGHT"),RightWrist("FLIP")),Par(RightElbow("BEND"),RightThumbFront("FOLD"),RightIndexFingerFront("FOLD"),RightMiddleFinger("FOLD"),RightSmallFinger("FOLD")),RightWrist("RIGHT"),RightArm("FRONT"),Par(RightThumbFront("DEFAULT"),RightIndexFingerFront("DEFAULT"),RightMiddleFingerFront("DEFAULT"),RightSmallFingerFront("DEFAULT")),RightElbow("DEFAULT")) +Hide-Seq(Par(RightArm("FRONT"),LeftArm("FRONT")) +Yoga-Seq(Par(RightThigh("FRONT_RIGHT"),LeftThigh("FRONT_LEFT")),Par(RightKnee("FULL_BEND"),LeftKnee("FULL_BEND"))) +Cross-Seq(Par(LeftArm("FRONT"),LeftElbow("BEND"),LeftWrist("RIGHT")),Par(RightArm("SIDE"),RightElbow("BEND"))) +High-Par(ToeLeft("DOWN"),ToeRight("DOWN"),RightArm("UP"),LeftArm("UP")) +Magic-Seq(Par(RightArm("FRONT"),LeftArm("FRONT"),RightElbow("BEND"),LeftElbow("BEND"),Seq(RightThumbRear("UP"),RightIndexFingerRear("UP"),RightMiddleFingerRear("UP"),RightSmallFingerRear("UP")),Seq(LeftThumbRear("UP"),LeftIndexFingerRear("UP"),LeftMiddleFingerRear("UP"),LeftSmallFingerRear("UP"))),Seq(RightThumbRear("DOWN"),RightIndexFingerRear("DOWN"),RightMiddleFingerRear("DOWN"),RightSmallFingerRear("DOWN")),Seq(LeftThumbRear("DOWN"),LeftIndexFingerRear("DOWN"),LeftMiddleFingerRear("DOWN"),LeftSmallFingerRear("DOWN"))) +0-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightWrist("LEFT"),RightThumbRear("DOWN"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +1-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +2-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightThumbFront("FOLD"),RightSmallFingerFront("FOLD")) +3-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightThumbRear("DOWN"),RightIndexFingerFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD")) +4-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightThumbRear("DOWN")) +5-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),Par(LeftArm("FRONT"),LeftElbow("BEND")),LeftThumbFront("FOLD"),LeftMiddleFingerFront("FOLD"),LeftSmallFingerFront("FOLD"))) +6-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),Par(LeftArm("FRONT"),LeftElbow("BEND")),LeftThumbFront("FOLD"),LeftSmallFingerFront("FOLD"))) +7-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),Par(LeftArm("FRONT"),LeftElbow("BEND")),LeftThumbFront("FOLD"))) +8-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),Par(LeftArm("FRONT"),LeftElbow("BEND")))) +9-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),Par(LeftArm("FRONT"),LeftElbow("BEND")),RightThumbFront("FOLD"),RightMiddleFingerFront("FOLD"),RightSmallFingerFront("FOLD"))) +Big-Par(LeftArm("LEFT_UP"),RightArm("RIGHT_UP"),LeftWrist("RIGHT"),RightWrist("RIGHT")) +Small-Par(RightArm("FRONT"),RightElbow("FULL_BEND"),RightWrist("LEFT"),RightIndexFingerRear("DOWN"),RightMiddleFingerRear("DOWN"),RightSmallFingerRear("DOWN")) +Type-Par(RightArm("FRONT"),RightElbow("BEND"),Par(LeftArm("FRONT"),RightElbow("BEND"),Seq(RightIndexFingerRear("DOWN"),LeftMiddleFingerRear("DOWN"),RightMiddleFingerRear("DOWN")) +Open-Seq(Par(RightArm("FRONT"),RightElbow("FULL_BEND"),Par(LeftArm("FRONT"),LeftElbow("FULL_BEND")),Par(LeftArm("LEFT"),RightArm("RIGHT"))) +Close-Seq(Par(RightArm("FRONT"),RightElbow("FULL_BEND"),Par(LeftArm("FRONT"),LeftElbow("FULL_BEND")),Par(LeftArm("SIDE"),RightArm("SIDE"))) +Tease-Show Tongue +Stop-Par(RightArm("FRONT"),RightWrist("UP")) +Next-Seq(Par(RightArm("FRONT"),RightElbow("BEND")),RightWrist("LEFT"),RightWrist("DOWN"),RightWrist("UP"),RightWrist("RIGHT")) +A-Par(LeftArm("SIDE_UP"),LeftWrist("LEFT),RightArm("SIDE_UP"),RightWrist("RIGHT")) +The-Seq(Par(RightArm("FRONT"),RightWrist("LEFT")RightArm("BEND")),LeftArm("SIDE"),LeftWrist("BEND")) +In-Seq(Par(RightArm("FRONT"),RightKnee("BEND"),RightWrist("DOWN"),RightThumbRear("DOWN"),RightMiddleFingerRear("DOWN"),RightSmallFingerRear("DOWN")),RightArm("FRONT_DOWN")) +See- +Animal- +Lift- +Clap- +Pride- +Salute- +Quiet- +Rain- + diff --git a/engine/blender/scripts/Arm.py b/engine/blender/scripts/Arm.py new file mode 100644 index 0000000..4bcb374 --- /dev/null +++ b/engine/blender/scripts/Arm.py @@ -0,0 +1,105 @@ +################################################################################################## +# SCRIPT TO ANIMATE ARMS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Arms +# +# Armature_Object - The Bone Armature from which it selects the Arm Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Arm +def LEFTARM(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Arm + # first attribute - i am still guessing(nothing happens if changed from 1.0) - rotation in other direction + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FRONT"] = [1.0,0.75,0.0,0.75] + Positions["FRONT_UP"] = [1.0,0.25,0.0,1.25] + Positions["FRONT_DOWN"] = [1.0,1.0,0.0,0.0] + Positions["BACK"] = [1.0,-0.7,0.0,-0.5] + Positions["BACK_UP"] = [1.0,-0.7,0.0,0.25] + Positions["BACK_DOWN"] = [1.0,-0.25,0.0,-1.0] + Positions["SIDE"] = [1.0,1.25,0.0,0.75] + Positions["SIDE_UP"] = [1.0,1.25,0.0,2.0] + Positions["SIDE_DOWN"] = [1.0,1.25,0.0,-0.25] + Positions["UP"] = [1.0,-0.5,0.0,0.5] + Positions["LEFT"] = [1.0,0.0,0.0,0.0] + Positions["LEFT_UP"] = [1.0,-0.25,0.0,0.25] + Positions["LEFT_DOWN"] = [1.0,0.25,0.0,-0.25] + Positions["DIAGONAL_FRONT"] = [1.0,0.4,0.0,0.4] + Positions["DIAGONAL_FRONT_UP"] = [1.0,0.15,0.0,0.5] + Positions["DIAGONAL_FRONT_DOWN"] = [1.0,0.5,0.0,0.0] + Positions["DIAGONAL_BACK"] = [1.0,-0.5,0.0,-0.25] + Positions["DIAGONAL_BACK_UP"] = [1.0,-0.5,0.0,0.0] + Positions["DIAGONAL_BACK_DOWN"] = [1.0,-0.25,0.0,-0.5] + Positions["DEFAULT"] = [1.0,0.25,0.0,-0.5] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LArm = [bone for bone in all_bones if bone.name == "Bone.002_R.001"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LArm.quat[:] = x,y,z,r + LArm.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Arm +def RIGHTARM(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Arm + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FRONT"] = [1.0,0.75,0.0,-0.75] + Positions["FRONT_UP"] = [1.0,0.25,0.0,-1.25] + Positions["FRONT_DOWN"] = [1.0,1.0,0.0,0.0] + Positions["BACK"] = [1.0,-0.7,0.0,0.5] + Positions["BACK_UP"] = [1.0,-0.7,0.0,-0.25] + Positions["BACK_DOWN"] = [1.0,-0.25,0.0,1.0] + Positions["SIDE"] = [1.0,1.25,0.0,-0.75] + Positions["SIDE_UP"] = [1.0,1.25,0.0,-2.0] + Positions["SIDE_DOWN"] = [1.0,1.25,0.0,0.25] + Positions["UP"] = [1.0,-0.5,0.0,-0.5] + Positions["RIGHT"] = [1.0,0.0,0.0,0.0] + Positions["RIGHT_UP"] = [1.0,-0.25,0.0,-0.25] + Positions["RIGHT_DOWN"] = [1.0,0.25,0.0,0.25] + Positions["DIAGONAL_FRONT"] = [1.0,0.4,0.0,-0.4] + Positions["DIAGONAL_FRONT_UP"] = [1.0,0.15,0.0,-0.5] + Positions["DIAGONAL_FRONT_DOWN"] = [1.0,0.5,0.0,0.0] + Positions["DIAGONAL_BACK"] = [1.0,-0.5,0.0,0.25] + Positions["DIAGONAL_BACK_UP"] = [1.0,-0.5,0.0,0.0] + Positions["DIAGONAL_BACK_DOWN"] = [1.0,-0.25,0.0,0.5] + Positions["DEFAULT"] = [1.0,0.25,0.0,0.5] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RArm = [bone for bone in all_bones if bone.name == "Bone.002_L.001"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RArm.quat[:] = x,y,z,r + RArm.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Body.py b/engine/blender/scripts/Body.py new file mode 100644 index 0000000..ff83bef --- /dev/null +++ b/engine/blender/scripts/Body.py @@ -0,0 +1,43 @@ +################################################################################################## +# SCRIPT TO ANIMATE BODY(FRONT ABDOMEN PART) +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Body(Front Abdomen Part) +# +# Armature_Object - The Bone Armature from which it selects the Body(Abdomen) Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Body - Front Abdomen Part +def BODY(Armature_Object, direction, endFrame): + #Defining all possible positions for the Body(Mainly the Abdomen part) + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LEFT"] = [1.0,0.0,0.5,0.0] + Positions["RIGHT"] = [1.0,0.0,-0.5,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + Body = [bone for bone in all_bones if bone.name == "Bone.001"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + Body.quat[:] = x,y,z,r + Body.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Elbow.py b/engine/blender/scripts/Elbow.py new file mode 100644 index 0000000..2dd36d8 --- /dev/null +++ b/engine/blender/scripts/Elbow.py @@ -0,0 +1,73 @@ +################################################################################################## +# SCRIPT TO ANIMATE ELBOWS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Elbows +# +# Armature_Object - The Bone Armature from which it selects the Elbow Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Elbow +def LEFTELBOW(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Elbow + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LESS_BEND"] = [2.5,0.5,0.0,-1.0] + Positions["BEND"] = [1.0,0.5,0.0,-1.0] + Positions["FULL_BEND"] = [0.25,0.5,0.0,-1.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Head Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LElbow = [bone for bone in all_bones if bone.name == "Bone.002_R.002"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LElbow.quat[:] = x,y,z,r + LElbow.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Elbow +def RIGHTELBOW(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Elbow + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LESS_BEND"] = [2.5,0.5,0.0,1.0] + Positions["BEND"] = [1.0,0.5,0.0,1.0] + Positions["FULL_BEND"] = [0.25,0.5,0.0,1.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Head Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RElbow = [bone for bone in all_bones if bone.name == "Bone.002_L.002"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RElbow.quat[:] = x,y,z,r + RElbow.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Feet.py b/engine/blender/scripts/Feet.py new file mode 100644 index 0000000..c9a3b29 --- /dev/null +++ b/engine/blender/scripts/Feet.py @@ -0,0 +1,79 @@ +################################################################################################## +# SCRIPT TO ANIMATE FEETS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Feets +# +# Armature_Object - The Bone Armature from which it selects the Feet Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Feet Left +def LEFTFEET(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Feet + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LEFT"] = [1.0,0.0,0.0,-0.5] + Positions["RIGHT"] = [1.0,0.0,0.0,0.5] + Positions["UP"] = [1.0,-0.15,0.0,0.0] + Positions["DOWN"] = [1.0,0.25,0.0,0.0] + Positions["LEFT_DIAGONAL"] = [1.0,0.0,0.0,-0.25] + Positions["RIGHT_DIAGONAL"] = [1.0,0.0,0.0,0.25] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LFeet = [bone for bone in all_bones if bone.name == "Bone_R.003"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LFeet.quat[:] = x,y,z,r + LFeet.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Feet Right +def RIGHTFEET(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Feet + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LEFT"] = [1.0,0.0,0.0,-0.5] + Positions["RIGHT"] = [1.0,0.0,0.0,0.5] + Positions["UP"] = [1.0,-0.15,0.0,0.0] + Positions["DOWN"] = [1.0,0.25,0.0,0.0] + Positions["LEFT_DIAGONAL"] = [1.0,0.0,0.0,-0.25] + Positions["RIGHT_DIAGONAL"] = [1.0,0.0,0.0,0.25] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RFeet = [bone for bone in all_bones if bone.name == "Bone_L.003"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RFeet.quat[:] = x,y,z,r + RFeet.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Finger_Front.py b/engine/blender/scripts/Finger_Front.py new file mode 100644 index 0000000..f8359bb --- /dev/null +++ b/engine/blender/scripts/Finger_Front.py @@ -0,0 +1,239 @@ +################################################################################################## +# SCRIPT TO ANIMATE FRONT PART OF FINGERS +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Front Part of Finger Bones - All of them +# +# Armature_Object - The Bone Armature from which it selects the Finger Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +########################################## +# ALL LEFT BONES ARE SCRIPTED BELOW # +########################################## + +from Blender import * +import Blender + +# Left Thumb - Front Part +def LEFTTHUMBFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Thumb - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.8,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LThumbFront = [bone for bone in all_bones if bone.name == "Bone.002_R.005"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LThumbFront.quat[:] = x,y,z,r + LThumbFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Index Finger - Front Part +def LEFTINDEXFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Index Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,-1.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LIndexFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_R.011"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LIndexFingerFront.quat[:] = x,y,z,r + LIndexFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Middle Finger - Front Part +def LEFTMIDDLEFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Middle Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,-1.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LMiddleFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_R.007"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LMiddleFingerFront.quat[:] = x,y,z,r + LMiddleFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Small Finger - Front Part +def LEFTSMALLFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Small Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,-0.8] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LSmallFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_R.009"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LSmallFingerFront.quat[:] = x,y,z,r + LSmallFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +########################################### +# ALL RIGHT BONES ARE SCRIPTED BELOW # +########################################### + +# Right Thumb - Front Part +def RIGHTTHUMBFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Thumb - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.8,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RThumbFront = [bone for bone in all_bones if bone.name == "Bone.002_L.005"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RThumbFront.quat[:] = x,y,z,r + RThumbFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Index Finger - Front Part +def RIGHTINDEXFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Index Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,1.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RIndexFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_L.011"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RIndexFingerFront.quat[:] = x,y,z,r + RIndexFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Middle Finger - Front Part +def RIGHTMIDDLEFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Middle Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,1.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RMiddleFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_L.007"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RMiddleFingerFront.quat[:] = x,y,z,r + RMiddleFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Small Finger - Front Part +def RIGHTSMALLFINGERFRONT(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Small Finger - Front Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FOLD"] = [1.0,0.0,0.0,0.8] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RSmallFingerFront = [bone for bone in all_bones if bone.name == "Bone.002_L.009"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RSmallFingerFront.quat[:] = x,y,z,r + RSmallFingerFront.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Finger_Rear.py b/engine/blender/scripts/Finger_Rear.py new file mode 100644 index 0000000..c73fa38 --- /dev/null +++ b/engine/blender/scripts/Finger_Rear.py @@ -0,0 +1,264 @@ +################################################################################################## +# SCRIPT TO ANIMATE REAR PART OF FINGERS +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Rear Part of Finger Bones - All of them +# +# Armature_Object - The Bone Armature from which it selects the Finger Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +########################################## +# ALL LEFT BONES ARE SCRIPTED BELOW # +########################################## + +from Blender import * +import Blender + +# Left Thumb - Rear Part +def LEFTTHUMBREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Thumb - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.3,0.0,0.0] + Positions["DOWN"] = [1.0,0.6,0.0,0.0] + Positions["LEFT"] = [1.0,0.0,0.0,-0.15] + Positions["RIGHT"] = [1.0,0.0,0.0,0.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LThumbRear = [bone for bone in all_bones if bone.name == "Bone.002_R.004"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LThumbRear.quat[:] = x,y,z,r + LThumbRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Index Finger - Rear Part +def LEFTINDEXFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Index Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.3,0.0,0.3] + Positions["DOWN"] = [1.0,-0.3,0.0,-0.3] + Positions["LEFT"] = [1.0,-0.05,0.0,0.05] + Positions["RIGHT"] = [1.0,0.3,0.0,-0.3] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LIndexFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_R.010"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LIndexFingerRear.quat[:] = x,y,z,r + LIndexFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Middle Finger - Rear Part +def LEFTMIDDLEFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Middle Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.1,0.0,0.3] + Positions["DOWN"] = [1.0,0.1,0.0,-0.3] + Positions["LEFT"] = [1.0,-0.1,0.0,0.0] + Positions["RIGHT"] = [1.0,0.1,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LMiddleFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_R.006"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LMiddleFingerRear.quat[:] = x,y,z,r + LMiddleFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Left Small Finger - Rear Part +def LEFTSMALLFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Small Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.1,0.0,0.3] + Positions["DOWN"] = [1.0,0.0,0.0,-0.4] + Positions["LEFT"] = [1.0,-0.3,0.0,0.0] + Positions["RIGHT"] = [1.0,0.1,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LSmallFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_R.008"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LSmallFingerRear.quat[:] = x,y,z,r + LSmallFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + + +########################################### +# ALL RIGHT BONES ARE SCRIPTED BELOW # +########################################### + +# Right Thumb - Rear Part +def RIGHTTHUMBREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Thumb - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.3,0.0,0.0] + Positions["DOWN"] = [1.0,0.6,0.0,0.0] + Positions["LEFT"] = [1.0,0.0,0.0,0.15] + Positions["RIGHT"] = [1.0,0.0,0.0,-0.5] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RThumbRear = [bone for bone in all_bones if bone.name == "Bone.002_L.004"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RThumbRear.quat[:] = x,y,z,r + RThumbRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Index Finger - Rear Part +def RIGHTINDEXFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Index Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.3,0.0,-0.3] + Positions["DOWN"] = [1.0,-0.3,0.0,0.3] + Positions["LEFT"] = [1.0,0.3,0.0,0.3] + Positions["RIGHT"] = [1.0,-0.05,0.0,-0.05] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RIndexFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_L.010"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RIndexFingerRear.quat[:] = x,y,z,r + RIndexFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Middle Finger - Rear Part +def RIGHTMIDDLEFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Middle Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.1,0.0,-0.3] + Positions["DOWN"] = [1.0,0.1,0.0,0.3] + Positions["LEFT"] = [1.0,0.1,0.0,0.0] + Positions["RIGHT"] = [1.0,-0.1,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RMiddleFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_L.006"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RMiddleFingerRear.quat[:] = x,y,z,r + RMiddleFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Small Finger - Rear Part +def RIGHTSMALLFINGERREAR(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Small Finger - Rear Part + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.1,0.0,-0.3] + Positions["DOWN"] = [1.0,-0.1,0.0,0.3] + Positions["LEFT"] = [1.0,0.05,0.0,0.0] + Positions["RIGHT"] = [1.0,-0.3,0.0,-0.1] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RSmallFingerRear = [bone for bone in all_bones if bone.name == "Bone.002_L.008"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RSmallFingerRear.quat[:] = x,y,z,r + RSmallFingerRear.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Head.py b/engine/blender/scripts/Head.py new file mode 100644 index 0000000..41c9aec --- /dev/null +++ b/engine/blender/scripts/Head.py @@ -0,0 +1,51 @@ +################################################################################################## +# SCRIPT TO ANIMATE HEAD +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Head Bone +# Armature_Object - The Bone Armature from which it selects the Head Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +def HEAD(Armature_Object, direction, endFrame): + # Defining all possible positions for the Head movements + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LEFT"] = [1.0,0.0,0.5,-0.8] + Positions["RIGHT"] = [1.0,0.0,-0.5,0.8] + Positions["BACK"] = [1.0,-0.35,0.0,0.0] + Positions["FRONT"] = [1.0,0.4,0.0,0.0] + Positions["FRONT_LEFT"] = [1.0,0.3,0.0,0.35] + Positions["FRONT_RIGHT"] = [1.0,0.3,0.0,-0.35] + Positions["BACK_LEFT"] = [1.0,-0.15,0.0,0.35] + Positions["BACK_RIGHT"] = [1.0,-0.15,0.0,-0.35] + Positions["TILT_LEFT"] = [1.0,0.0,-0.25,-0.25] + Positions["TILT_RIGHT"] = [1.0,0.0,0.25,0.25] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + Positions["STRAIGHT_LEFT"] = [1.0,0.0,0.20,-0.3] + Positions["STRAIGHT_RIGHT"] = [1.0,0.0,-0.20,0.3] + + #Get the Head Bone from the Armature Objects + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + HeadBone = [bone for bone in all_bones if bone.name == "Bone.004"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + HeadBone.quat[:] = x,y,z,r + HeadBone.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Knees.py b/engine/blender/scripts/Knees.py new file mode 100644 index 0000000..b33f1ae --- /dev/null +++ b/engine/blender/scripts/Knees.py @@ -0,0 +1,75 @@ +################################################################################################## +# SCRIPT TO ANIMATE Knees - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Shoulders +# +# Armature_Object - The Bone Armature from which it selects the Knee Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Knee +def LEFTKNEE(Armature_Object, direction, endFrame): + #Defining all possible positions for the Knee movements + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["HALF_BEND"] = [1.0,0.25,0.0,0.0] + Positions["BEND"] = [1.0,0.5,0.0,0.0] + Positions["FULL_BEND"] = [1.0,0.8,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + KneeBoneL = [bone for bone in all_bones if bone.name == "Bone_R.002"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + + KneeBoneL.quat[:] = x,y,z,r + KneeBoneL.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +#Right Knee +def RIGHTKNEE(Armature_Object, direction, endFrame): + #Defining all possible positions for the Knee movements + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["HALF_BEND"] = [1.0,0.25,0.0,0.0] + Positions["BEND"] = [1.0,0.5,0.0,0.0] + Positions["FULL_BEND"] = [1.0,0.8,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + KneeBoneR = [bone for bone in all_bones if bone.name == "Bone_L.002"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + KneeBoneR.quat[:] = x,y,z,r + KneeBoneR.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Process_XML.py b/engine/blender/scripts/Process_XML.py new file mode 100644 index 0000000..229742e --- /dev/null +++ b/engine/blender/scripts/Process_XML.py @@ -0,0 +1,130 @@ +##################################################################################################### +# +# This script reads the action sequence XML file and generates the action sequence corresponding +# to the script. +# Created By :- Deepak Shakya +# Date :- 10th April 2009, 04:38 Hrs +# +# If you dont recognize the importance of comments, try coding after a power nap of 2 hrs and +# and getting to know that your pen drive that contains all your code has malfunctioned and +# all your data is lost. You will know what I mean. +# +# ALGORITHM +# I devised this stuff early in the morning so you could find the better way. My +# requirements was to traverse an XML file that could generate the list of function calls +# in the cuteBEAR.blend that could generate the animation for the action sequences in the +# XML file. +# Basically, I drew a flowchart considering all possible sequence patterns so that this +# file gets more generic. I found following things - +# - If a 'seq' tag is inside another 'seq' tag, the starting frame for the following nodes will +# be the ending frame of the parent node. +# - If a 'par' or 'body' tag is inside a 'seq' tag, the starting frame for the following nodes will +# be the starting frame of the parent node. +# +##################################################################################################### + +# Import the relevant packages +from xml.dom.ext.reader import Sax2 +from xml.dom import minidom,Node + +# Determines how the action should be performed +Frame = {} +Frame["VERY_FAST"] = 10 # The animation will be played VERY FAST +Frame["FAST"] = 20 # The animation will be played FAST +Frame["NORMAL"] = 30 # The animation will be played NORMAL +Frame["SLOW"] = 40 # The animation will be played SLOW +Frame["VERY_SLOW"] = 50 # The animation will be played VERY SLOW + +# the action sequence object - stores the actions +action_script = [] + + +# This function traverses the Nodes to get the Action Sequence details +def traverseNodes(xmlnodes,start_frame): + global action_script + max_length = 0 + last_frame = start_frame + for childNode in xmlnodes: + if childNode.nodeType == Node.ELEMENT_NODE: + if childNode.nodeName == "seq": + # Handle node - seq (sequence) + last_node = handleSequence(childNode,start_frame) + elif childNode.nodeName == "par": + # Handle node - par (parallel) + last_node = handleParallel(childNode,start_frame) + elif childNode.nodeName == "body": + # Handle node - body (action sequence tag) + last_node = handleBody(childNode,start_frame) + + if max_length < last_frame: + max_length = last_frame + + return action_script + + +# Handles the 'body' tag and gets the action sequence details from the tag +def handleBody(body_node,start_frame): + # Get all attributes of the node + attrs = body_node.attributes + + # Initialize my attribute fields + part = "" + direction = "" + speed = "" + + # Iterate through the attributes to get our attributes from the 'body' tag + for attrName in attrs.keys(): + attrNode = attrs.get(attrName) + if attrName[1] == "part": + part = attrNode.nodeValue + elif attrName[1] == "direction": + direction = attrNode.nodeValue + elif attrName[1] == "speed": + speed = attrNode.nodeValue + + if speed == "": + speed = "NORMAL" + + #print part,direction,speed + last_frame = Frame[speed.upper()] + start_frame + action_script.append([str(part.upper()),str(direction.upper()),start_frame,last_frame]) + + return last_frame + + +# Handles the 'par' tag - delegates(jsp mania) the control to appropriate functions +def handleParallel(par_node,start_frame): + max_length = 0 + last_frame = start_frame + for childNode in par_node.childNodes: + if childNode.nodeType == Node.ELEMENT_NODE: + if childNode.nodeName == "seq": + last_frame = handleSequence(childNode,start_frame) + elif childNode.nodeName == "par": + last_frame = handleParallel(childNode,start_frame) + elif childNode.nodeName == "body": + last_frame = handleBody(childNode,start_frame) + + if max_length < last_frame: + max_length = last_frame + + return max_length + + +# Handles the 'seq' tag - delegates(jsp mania) the control to appropriate function +def handleSequence(seq_node,start_frame): + max_length = 0 + last_frame = start_frame + for childNode in seq_node.childNodes: + if childNode.nodeType == Node.ELEMENT_NODE: + if childNode.nodeName == "seq": + last_frame = handleSequence(childNode,last_frame) + elif childNode.nodeName == "par": + last_frame = handleParallel(childNode,start_frame) + elif childNode.nodeName == "body": + last_frame = handleBody(childNode,last_frame) + + if max_length < last_frame: + max_length = last_frame + + return max_length diff --git a/engine/blender/scripts/Shoulder.py b/engine/blender/scripts/Shoulder.py new file mode 100644 index 0000000..d3bbf10 --- /dev/null +++ b/engine/blender/scripts/Shoulder.py @@ -0,0 +1,75 @@ +################################################################################################## +# SCRIPT TO ANIMATE SHOULDERS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Shoulders +# +# Armature_Object - The Bone Armature from which it selects the Shoulder Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Shoulder +def LEFTSHOULDER(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Shoulder + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.0,0.0,0.15] + Positions["FRONT"] = [1.0,0.15,0.0,0.0] + Positions["BACK"] = [1.0,-0.15,0.0,0.0] + Positions["DOWN"] = [1.0,0.0,0.0,-0.1] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LShoulder = [bone for bone in all_bones if bone.name == "Bone.002_R"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LShoulder.quat[:] = x,y,z,r + LShoulder.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Shoulder +def RIGHTSHOULDER(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Shoulder + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,0.0,0.0,-0.15] + Positions["FRONT"] = [1.0,0.15,0.0,0.0] + Positions["BACK"] = [1.0,-0.15,0.0,0.0] + Positions["DOWN"] = [1.0,0.0,0.0,0.1] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RShoulder = [bone for bone in all_bones if bone.name == "Bone.002_L"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RShoulder.quat[:] = x,y,z,r + RShoulder.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Thighs.py b/engine/blender/scripts/Thighs.py new file mode 100644 index 0000000..5bed16e --- /dev/null +++ b/engine/blender/scripts/Thighs.py @@ -0,0 +1,89 @@ +################################################################################################## +# SCRIPT TO ANIMATE TIGHS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Tighs +# +# Armature_Object - The Bone Armature from which it selects the Tigh Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Thigh +def LEFTTHIGH(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Thigh + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FRONT"] = [1.0,-0.4,0.0,0.0] + Positions["BACK"] = [1.0,0.4,0.0,0.0] + Positions["SIDE"] = [1.0,0.0,0.0,-0.35] + Positions["SIDE_UP"] = [1.0,0.0,0.0,-0.65] + Positions["FRONT_LEFT"] = [1.0,-0.35,0.0,-0.4] + Positions["FRONT_RIGHT"] = [1.0,-0.35,0.0,0.4] + Positions["FRONT_UP"] = [1.0,-0.8,0.0,0.0] + Positions["FRONT_LEFT_UP"] = [1.0,-0.8,0.0,-0.4] + Positions["FRONT_RIGHT_UP"] = [1.0,-0.8,0.0,0.4] + Positions["BACK_LEFT"] = [1.0,0.4,0.0,-0.3] + Positions["BACK_RIGHT"] = [1.0,0.4,0.0,0.3] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LThigh = [bone for bone in all_bones if bone.name == "Bone_R.001"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LThigh.quat[:] = x,y,z,r + LThigh.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Thigh +def RIGHTTHIGH(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Thigh + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["FRONT"] = [1.0,-0.4,0.0,0.0] + Positions["BACK"] = [1.0,0.4,0.0,0.0] + Positions["SIDE"] = [1.0,0.0,0.0,0.35] + Positions["SIDE_UP"] = [1.0,0.0,0.0,0.65] + Positions["FRONT_LEFT"] = [1.0,-0.35,0.0,-0.4] + Positions["FRONT_RIGHT"] = [1.0,-0.35,0.0,0.4] + Positions["FRONT_UP"] = [1.0,-0.8,0.0,0.0] + Positions["FRONT_LEFT_UP"] = [1.0,-0.8,0.0,-0.4] + Positions["FRONT_RIGHT_UP"] = [1.0,-0.8,0.0,0.4] + Positions["BACK_LEFT"] = [1.0,0.4,0.0,-0.3] + Positions["BACK_RIGHT"] = [1.0,0.4,0.0,0.3] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RThigh = [bone for bone in all_bones if bone.name == "Bone_L.001"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RThigh.quat[:] = x,y,z,r + RThigh.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Toes.py b/engine/blender/scripts/Toes.py new file mode 100644 index 0000000..c1e9a8b --- /dev/null +++ b/engine/blender/scripts/Toes.py @@ -0,0 +1,71 @@ +################################################################################################## +# SCRIPT TO ANIMATE TOES - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Toes +# +# Armature_Object - The Bone Armature from which it selects the Toe Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Toe +def LEFTTOE(Armature_Object, direction, endFrame): + #Defining all possible positions for the Toe movements + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.5,0.0,0.0] + Positions["DOWN"] = [1.0,0.5,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + ToeBoneL = [bone for bone in all_bones if bone.name == "Bone_R.004"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + ToeBoneL.quat[:] = x,y,z,r + ToeBoneL.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +#Right Toe +def RIGHTTOE(Armature_Object, direction, endFrame): + #Defining all possible positions for the Toe movements + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.5,0.0,0.0] + Positions["DOWN"] = [1.0,0.5,0.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Head Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + ToeBoneR = [bone for bone in all_bones if bone.name == "Bone_L.004"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + ToeBoneR.quat[:] = x,y,z,r + ToeBoneR.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Waist.py b/engine/blender/scripts/Waist.py new file mode 100644 index 0000000..cde07f4 --- /dev/null +++ b/engine/blender/scripts/Waist.py @@ -0,0 +1,45 @@ +################################################################################################## +# SCRIPT TO ANIMATE WAIST +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Waist +# +# Armature_Object - The Bone Armature from which it selects the Waist Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Body +def WAIST(Armature_Object, direction, endFrame): + #Defining all possible positions for the Waist + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["LEFT"] = [1.0,0.0,0.0,-0.1] + Positions["FRONT"] = [1.0,0.5,0.0,0.0] + Positions["BACK"] = [1.0,-0.5,0.0,0.0] + Positions["RIGHT"] = [1.0,0.0,0.0,0.1] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + BoneWaist = [bone for bone in all_bones if bone.name == "Bone"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + BoneWaist.quat[:] = x,y,z,r + BoneWaist.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/Wrist.py b/engine/blender/scripts/Wrist.py new file mode 100644 index 0000000..337aa08 --- /dev/null +++ b/engine/blender/scripts/Wrist.py @@ -0,0 +1,76 @@ +################################################################################################## +# SCRIPT TO ANIMATE WRISTS - LEFT AND RIGHT +# Created, Invented and Made Alive By : Deepak Shakya +# Date : 08-April-2008 +################################################################################################## + +################################################################################################## +# This function Animates the Wrists +# +# Armature_Object - The Bone Armature from which it selects the Wrist Bone to animate +# direction - The final direction where the Bone has to be moved() +# endFrame - The final frame at which the Bone has to be moved in the specified direction +################################################################################################## + +from Blender import * +import Blender + +# Left Wrist +def LEFTWRIST(Armature_Object, direction, endFrame): + #Defining all possible positions for the Left Wrist + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.8,0.0,0.0] + Positions["DOWN"] = [1.0,0.5,0.0,0.05] + Positions["LEFT"] = [1.0,0.0,0.0,-0.4] + Positions["RIGHT"] = [1.0,0.0,0.0,0.35] + Positions["FLIP"] = [1.0,0.0,-1.0,0.0] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Head Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + LWrist = [bone for bone in all_bones if bone.name == "Bone.002_R.003"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + LWrist.quat[:] = x,y,z,r + LWrist.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame + + +# Right Wrist +def RIGHTWRIST(Armature_Object, direction, endFrame): + #Defining all possible positions for the Right Wrist + # first attribute - i am still guessing(nothing happens if changed from 1.0) + # second attribute - it moves the head move up and down + # third attribute - it is making the bone to rotate on axis (0.5 corresponds to 90 degree rotation) + # fourth attribute - it is making the bone move left and right + Positions = {} + Positions["UP"] = [1.0,-0.8,0.0,0.0] + Positions["DOWN"] = [1.0,0.5,0.0,0.05] + Positions["LEFT"] = [1.0,0.0,0.0,-0.4] + Positions["RIGHT"] = [1.0,0.0,0.0,0.35] + Positions["DEFAULT"] = [1.0,0.0,0.0,0.0] + + #Get the Head Bone from the Armature Object + pose_bones = Armature_Object.getPose() + all_bones = pose_bones.bones.values() + RWrist = [bone for bone in all_bones if bone.name == "Bone.002_L.003"][0] + + #Set the frame in which the Position will be reached + x = Positions[direction][0] + y = Positions[direction][1] + z = Positions[direction][2] + r = Positions[direction][3] + RWrist.quat[:] = x,y,z,r + RWrist.insertKey(Armature_Object,endFrame,Object.Pose.ROT) + + return endFrame \ No newline at end of file diff --git a/engine/blender/scripts/documentation.txt b/engine/blender/scripts/documentation.txt new file mode 100644 index 0000000..adcb3c2 --- /dev/null +++ b/engine/blender/scripts/documentation.txt @@ -0,0 +1,217 @@ +##################################################################################################### +# +# This file gives list of names of parts of the body that can be handled by aPPy. +# You can consider it an informal documentation for the blender animation scripting using XML. +# +# Created By :- Deepak Shakya +# Date:- 11.04.2009 04:05:23 +# +##################################################################################################### + + + +####################################################################################### +# +# Following are the bones that the bear has and we have to move them +# +####################################################################################### +# +# LEFT ARM BONES +# +# Bone.002_R [Bone "Bone.002_R"] -- Left Arm Rear +# Bone.002_R.001 [Bone "Bone.002_R.001"] -- Left Arm Middle +# Bone.002_R.002 [Bone "Bone.002_R.002"] -- Left Arm Front +# Bone.002_R.003 [Bone "Bone.002_R.003"] -- Left Hand +# Bone.002_R.004 [Bone "Bone.002_R.004"] -- Left Thumb Rear +# Bone.002_R.005 [Bone "Bone.002_R.005"] -- Left Thumb Front +# Bone.002_R.010 [Bone "Bone.002_R.010"] -- Left Index Rear +# Bone.002_R.011 [Bone "Bone.002_R.011"] -- Left Index Front +# Bone.002_R.006 [Bone "Bone.002_R.006"] -- Left Middle Rear +# Bone.002_R.007 [Bone "Bone.002_R.007"] -- Left Middle Front +# Bone.002_R.008 [Bone "Bone.002_R.008"] -- Left Small Rear +# Bone.002_R.009 [Bone "Bone.002_R.009"] -- Left Small Front +# +####################################################################################### +# +# Right Arm Bones +# +# Bone.002_L [Bone "Bone.002_L"] -- Right Arm Rear +# Bone.002_L.001 [Bone "Bone.002_L.001"] -- Right Arm Middle +# Bone.002_L.002 [Bone "Bone.002_L.002"] -- Right Arm Front +# Bone.002_L.003 [Bone "Bone.002_L.003"] -- Right Hand +# Bone.002_L.004 [Bone "Bone.002_L.004"] -- Right Thumb Rear +# Bone.002_L.005 [Bone "Bone.002_L.005"] -- Right Thumb Front +# Bone.002_L.010 [Bone "Bone.002_L.010"] -- Right Index Rear +# Bone.002_L.011 [Bone "Bone.002_L.011"] -- Right Index Front +# Bone.002_L.006 [Bone "Bone.002_L.006"] -- Right Middle Rear +# Bone.002_L.007 [Bone "Bone.002_L.007"] -- Right Middle Front +# Bone.002_L.008 [Bone "Bone.002_L.008"] -- Right Small Rear +# Bone.002_L.009 [Bone "Bone.002_L.009"] -- Right Small Front +# +####################################################################################### +# +# HEAD +# +# Bone.004 [Bone "Bone.004"] -- Head +# +####################################################################################### +# +# BODY +# +# Bone [Bone "Bone"] -- Body Bottom (I Tthink this is the parent of all) +# Bone.001 [Bone "Bone.001"] -- Body Middle +# Bone.002 [Bone "Bone.002"] -- Body Top +# Bone.003 [Bone "Bone.003"] -- Body Upper - Neck +# +####################################################################################### +# +# Legs and Limbs -- Right +# +# Bone_L [Bone "Bone_L"] -- Right Connection to Thighs from apex +# Bone_L.001 [Bone "Bone_L.001"] -- Right Thigh +# Bone_L.002 [Bone "Bone_L.002"] -- Right Leg +# Bone_L.003 [Bone "Bone_L.003"] -- Right Feet +# Bone_L.004 [Bone "Bone_L.004"] -- Right Feet Fingers +# +####################################################################################### +# +# Legs and Limbs -- Right +# Bone_R [Bone "Bone_R"] -- Left Connection to Thighs from apex +# Bone_R.001 [Bone "Bone_R.001"] -- Left Thigh +# Bone_R.002 [Bone "Bone_R.002"] -- Left Leg +# Bone_R.003 [Bone "Bone_R.003"] -- Left Feet +# Bone_R.004 [Bone "Bone_R.004"] -- Left Feet Fingers +# +####################################################################################### + + + + +####################################################################################### +# +# FOLLOWING PARTS HAVE BEEN DEFINED FOR THE BONES +# +# These are used in the XML file that the script reads and then renders for animation +# +# HEAD - For Head +# Possible Positions - LEFT,RIGHT,BACK,FRONT,FRONT_LEFT,FRONT_RIGHT,BACK_LEFT,BACK_RIGHT,TILT_LEFT,TILT_RIGHT,STRAIGHT_LEFT,STRAIGHT_RIGHT,DEFAULT + +# LEFTTHUMBREAR - For Left Thumb Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# LEFTINDEXFINGERREAR - For Left Index Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# LEFTMIDDLEFINGERREAR - For Left Middle Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# LEFTSMALLFINGERREAR - For Left Small Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# RIGHTTHUMBREAR - For Right Thumb Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# RIGHTINDEXFINGERREAR - For Right Index Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# RIGHTMIDDLEFINGERREAR - For Right Middle Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# RIGHTSMALLFINGERREAR - For Right Small Finger Rear +# Possible Positions - UP,DOWN,LEFT,RIGHT,DEFAULT + +# LEFTTHUMBFRONT - For Left Thumb Front +# Possible Positions - FOLD,DEFAULT + +# LEFTINDEXFINGERFRONT - For Left Index Finger Front +# Possible Positions - FOLD,DEFAULT + +# LEFTMIDDLEFINGERFRONT - For Left Middle Finger Front +# Possible Positions - FOLD,DEFAULT + +# LEFTSMALLFINGERFRONT - For Left Small Finger Front +# Possible Positions - FOLD,DEFAULT + +# RIGHTTHUMBFRONT - For Right Thumb Front +# Possible Positions - FOLD,DEFAULT + +# RIGHTINDEXFINGERFRONT - For Right Index Finger Front +# Possible Positions - FOLD,DEFAULT + +# RIGHTMIDDLEFINGERFRONT - For Right Middle Finger Front +# Possible Positions - FOLD,DEFAULT + +# RIGHTSMALLFINGERFRONT - For Right Small Finger Front +# Possible Positions - FOLD,DEFAULT + +# LEFTFEET - For Left Feet +# Possible Positions - LEFT,RIGHT,UP,DOWN,LEFT_DIAGONAL,RIGHT_DIAGONAL,DEFAULT + +# RIGHTFEET - For Right Feet +# Possible Positions - LEFT,RIGHT,UP,DOWN,LEFT_DIAGONAL,RIGHT_DIAGONAL,DEFAULT + +# LEFTELBOW - For Left Elbow +# Possible Positions - HALF_BEND,BEND,FULL_BEND,DEFAULT + +# RIGHTELBOW - For Right Elbow +# Possible Positions - HALF_BEND,BEND,FULL_BEND,DEFAULT + +# BODY - For Body +# Possible Positions - LEFT,RIGHT,DEFAULT + +# LEFTARM - For Left Arm +# Possible Positions - FRONT,FRONT_UP,FRONT_DOWN,BACK,BACK_UP,BACK_DOWN,SIDE,SIDE_UP,SIDE_DOWN,UP,LEFT,LEFT_UP,LEFT_DOWN,DIAGONAL_FRONT,DIAGONAL_FRONT_UP,DIAGONAL_FRONT_DOWN,DIAGONAL_BACK,DIAGONAL_BACK_UP,DIAGONAL_BACK_DOWN,DEFAULT + +# RIGHTARM - For Right Arm +# Possible Positions - FRONT,FRONT_UP,FRONT_DOWN,BACK,BACK_UP,BACK_DOWN,SIDE,SIDE_UP,SIDE_DOWN,UP,RIGHT,RIGHT_UP,RIGHT_DOWN,DIAGONAL_FRONT,DIAGONAL_FRONT_UP,DIAGONAL_FRONT_DOWN,DIAGONAL_BACK,DIAGONAL_BACK_UP,DIAGONAL_BACK_DOWN,DEFAULT + +# LEFTWRIST - For Left Wrist +# Possible Positions - UP,DOWN,LEFT,RIGHT,FLIP,DEFAULT + +# RIGHTWRIST - For Right Wrist +# Possible Positions - UP,DOWN,LEFT,RIGHT,FLIP,DEFAULT + +# WAIST - For Waist +# Possible Positions - LEFT,RIGHT,FRONT,BACK,DEFAULT + +# LEFTTOE - For Left Toe +# Possible Positions - UP,DOWN,DEFAULT + +# RIGHTTOE - For Right Toe +# Possible Positions - UP,DOWN,DEFAULT + +# LEFTTHIGH - For Left Thigh +# Possible Positions - FRONT,BACK,SIDE,SIDE_UP,FRONT_LEFT,FRONT_RIGHT,FRONT_UP,FRONT_LEFT_UP,FRONT_RIGHT_UP,BACK_LEFT,BACK_RIGHT,DEFAULT + +# RIGHTTIGH - For Right Thigh +# Possible Positions - FRONT,BACK,SIDE,SIDE_UP,FRONT_LEFT,FRONT_RIGHT,FRONT_UP,FRONT_LEFT_UP,FRONT_RIGHT_UP,BACK_LEFT,BACK_RIGHT,DEFAULT + +# LEFTSHOULDER - For Left Shoulder +# Possible Positions - UP,FRONT,BACK,DOWN,DEFAULT + +# RIGHTSHOULDER - For Right Shoulder +# Possible Positions - UP,FRONT,BACK,DOWN,DEFAULT + +# LEFTKNEE - For Left Knee +# Possible Positions - HALF_BEND,BEND,FULL_BEND,DEFAULT + +# RIGHTKNEE - For Right Knee +# Possible Positions - HALF_BEND,BEND,FULL_BEND,DEFAULT + +####################################################################################### + + +####################################################################################### +# +# Also, one can define the speed with which the action has to be performed +# +# VERY_FAST - Perform the action very fast +# FAST - Perform the action fast +# NORMAL(Default) - Perform the action in normal speed +# SLOW - Perform the action slowly +# VERY_SLOW - Perform the action very slowly +# +####################################################################################### + + + diff --git a/engine/blender/scripts/master.py b/engine/blender/scripts/master.py new file mode 100644 index 0000000..4502c76 --- /dev/null +++ b/engine/blender/scripts/master.py @@ -0,0 +1,386 @@ +############################################################################################## +# +# This is the master script that creates the frames for the actions read by it in the +# XML file. +# +# Created By :- Deepak Shakya +# Moderated and Coordinated By :- Gayatri Venugopal and Samarendra Manohar Hedaoo +# Date :- 09 March 2009 +############################################################################################## + + +######################################################## +# Getting all the import modules used by the script # +######################################################## + +# Importing the packages required - Following are used for processing xml file +from xml.dom.ext.reader import Sax2 +from xml.dom import minidom,Node + +# Importing the packages required - Following are used for Blender and its internal working +import Blender +from Blender import * + +# Importing scripts that we have created +import Head # Animates the Head Bone +import Finger_Front # Animates the Front Part of Finger Bones +import Finger_Rear # Animates the Rear Part of Finger Bones +import Feet # Animates the Feet Bones +import Elbow # Animates the Elbow Bones +import Body # Animates the Body Bones +import Arm # Animates the Arm Bones +import Wrist # Animates the Wrist Bones +import Waist # Animates the Waist Bones +import Toes # Animates the Toe Bones +import Thighs # Animates the Thigh Bones +import Shoulder # Animates the Shoulder Bones +import Knees # Animates the Kness Bones + +# Import script that contains the node processing functions in xml file +import Process_XML + + +################################################################################ +# LETS FIRST READ THE XML FILE AND GET THE ACTIONS THAT ARE TO BE PERFORMED # +################################################################################ + +# Open the file that contains the action sequence specification +f = open("/home/anubhav/Desktop/blender/xml/walk.xml","r") + +# Read the data from the file +data = f.read() + +# Convert the case to lower case to account for improper case formation in the XML file +data = data.lower() + +# Close the file +f.close() + +# Create the XML reader to parse the XML data +reader = Sax2.Reader() + +# Get the documentNode +docnode = reader.fromString(data) + +# Get the root Element +root = docnode.documentElement + +# Traverse the xml data to process and nodes and prepare the action script list +# Action Script object that stores the whole action sequence +action_script = Process_XML.traverseNodes(root.childNodes,1) + +########################################################################################### +# AT THIS POINT THE action_seq[] LIST IS POPULATED WITH THE ACTIONS TO BE PERFORMED # +########################################################################################### + + +########################################################################################### +# LETS START PUTTING THE KEYFRAMES BY GETTING THE RELEVANT OBJECTS & CALLING FUNCTIONS # +########################################################################################### + +# Get current Scence +scene_obj = Blender.Scene.GetCurrent() + +# Get the JoOngle Armature so that we can have all the bones in it +armature_obj = scene_obj.objects[6] + +# Get the Pose instance so that we can pose the JoOngle +pose = armature_obj.getPose() + +# Get all the bones in the Pose of the JoOngle Armature +pose_bones = pose.bones.values() + +#Get the action being performed by the JoOngle +action = armature_obj.getAction() + +if not action: + action = Armature.NLA.NewAction() + action.setActive(armature_obj) + +# Initialize all the Bones so that we can start fresh +State = {} +State["HEAD"] = "DEFAULT" +State["LEFTTHUMBREAR"] = "DEFAULT" +State["LEFTINDEXFINGERREAR"] = "DEFAULT" +State["LEFTMIDDLEFINGERREAR"] = "DEFAULT" +State["LEFTSMALLFINGERREAR"] = "DEFAULT" +State["RIGHTTHUMBREAR"] = "DEFAULT" +State["RIGHTINDEXFINGERREAR"] = "DEFAULT" +State["RIGHTMIDDLEFINGERREAR"] = "DEFAULT" +State["RIGHTSMALLFINGERREAR"] = "DEFAULT" +State["LEFTTHUMBFRONT"] = "DEFAULT" +State["LEFTINDEXFINGERFRONT"] = "DEFAULT" +State["LEFTMIDDLEFINGERFRONT"] = "DEFAULT" +State["LEFTSMALLFINGERFRONT"] = "DEFAULT" +State["RIGHTTHUMBFRONT"] = "DEFAULT" +State["RIGHTINDEXFINGERFRONT"] = "DEFAULT" +State["RIGHTMIDDLEFINGERFRONT"] = "DEFAULT" +State["RIGHTSMALLFINGERFRONT"] = "DEFAULT" +State["LEFTFEET"] = "DEFAULT" +State["RIGHTFEET"] = "DEFAULT" +State["LEFTELBOW"] = "DEFAULT" +State["RIGHTELBOW"] = "DEFAULT" +State["BODY"] = "DEFAULT" +State["LEFTARM"] = "DEFAULT" +State["RIGHTARM"] = "DEFAULT" +State["LEFTWRIST"] = "DEFAULT" +State["RIGHTWRIST"] = "DEFAULT" +State["WAIST"] = "DEFAULT" +State["LEFTTOE"] = "DEFAULT" +State["RIGHTTOE"] = "DEFAULT" +State["LEFTTHIGH"] = "DEFAULT" +State["RIGHTTHIGH"] = "DEFAULT" +State["LEFTSHOULDER"] = "DEFAULT" +State["RIGHTSHOULDER"] = "DEFAULT" +State["LEFTKNEE"] = "DEFAULT" +State["RIGHTKNEE"] = "DEFAULT" + + +#Head.HEAD(armature_obj,"DEFAULT",1) +#Finger_Rear.LEFTTHUMBREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.LEFTINDEXFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.LEFTMIDDLEFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.LEFTSMALLFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.RIGHTTHUMBREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.RIGHTINDEXFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.RIGHTMIDDLEFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Rear.RIGHTSMALLFINGERREAR(armature_obj,"DEFAULT",1) +#Finger_Front.LEFTTHUMBFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.LEFTINDEXFINGERFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.LEFTMIDDLEFINGERFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.LEFTSMALLFINGERFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.RIGHTTHUMBFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.RIGHTINDEXFINGERFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.RIGHTMIDDLEFINGERFRONT(armature_obj,"DEFAULT",1) +#Finger_Front.RIGHTSMALLFINGERFRONT(armature_obj,"DEFAULT",1) +#Feet.LEFTFEET(armature_obj,"DEFAULT",1) +#Feet.RIGHTFEET(armature_obj,"DEFAULT",1) +#Elbow.LEFTELBOW(armature_obj,"DEFAULT",1) +#Elbow.RIGHTELBOW(armature_obj,"DEFAULT",1) +#Body.BODY(armature_obj,"DEFAULT",1) +#Arm.LEFTARM(armature_obj,"DEFAULT",1) +#Arm.RIGHTARM(armature_obj,"DEFAULT",1) +#Wrist.LEFTWRIST(armature_obj,"DEFAULT",1) +#Wrist.RIGHTWRIST(armature_obj,"DEFAULT",1) +#Waist.WAIST(armature_obj,"DEFAULT",1) +#Toes.LEFTTOE(armature_obj,"DEFAULT",1) +#Toes.RIGHTTOE(armature_obj,"DEFAULT",1) +#Thighs.LEFTTHIGH(armature_obj,"DEFAULT",1) +#Thighs.RIGHTTHIGH(armature_obj,"DEFAULT",1) +#Shoulder.LEFTSHOULDER(armature_obj,"DEFAULT",1) +#Shoulder.RIGHTSHOULDER(armature_obj,"DEFAULT",1) +#Knees.LEFTKNEE(armature_obj,"DEFAULT",1) +#Knees.RIGHTKNEE(armature_obj,"DEFAULT",1) + +for action in action_script: + print action + if action[0] == "HEAD": + Head.HEAD(armature_obj,State["HEAD"],State["HEAD"][1]) + Head.HEAD(armature_obj,action[1],action[3]) + State["HEAD"][0] = action[1] + State["HEAD"][1] = action[3] + print "Head",State["HEAD"] + + elif action[0] == "LEFTTHUMBREAR": + Finger_Rear.LEFTTHUMBREAR(armature_obj,State["LEFTTHUMBREAR"],action[2]) + Finger_Rear.LEFTTHUMBREAR(armature_obj,action[1],action[3]) + State["LEFTTHUMBREAR"] = action[1] + print "Left Thumb Rear",State["LEFTTHUMBREAR"] + + elif action[0] == "LEFTINDEXFINGERREAR": + Finger_Rear.LEFTINDEXFINGERREAR(armature_obj,State["LEFTINDEXFINGERREAR"],action[2]) + Finger_Rear.LEFTINDEXFINGERREAR(armature_obj,action[1],action[3]) + State["LEFTINDEXFINGERREAR"] = action[1] + print "Left Index Finger Rear",State["LEFTINDEXFINGERREAR"] + + elif action[0] == "LEFTMIDDLEFINGERREAR": + Finger_Rear.LEFTMIDDLEFINGERREAR(armature_obj,State["LEFTMIDDLEFINGERREAR"],action[2]) + Finger_Rear.LEFTMIDDLEFINGERREAR(armature_obj,action[1],action[3]) + State["LEFTMIDDLEFINGERREAR"] = action[1] + print "Left Middel Finger Rear",State["LEFTMIDDLEFINGERREAR"] + + elif action[0] == "LEFTSMALLFINGERREAR": + Finger_Rear.LEFTSMALLFINGERREAR(armature_obj,State["LEFTSMALLFINGERREAR"],action[2]) + Finger_Rear.LEFTSMALLFINGERREAR(armature_obj,action[1],action[3]) + State["LEFTSMALLFINGERREAR"] = action[1] + print "Left Small Finger Rear",State["LEFTSMALLFINGERREAR"] + + elif action[0] == "RIGHTTHUMBREAR": + Finger_Rear.RIGHTTHUMBREAR(armature_obj,State["RIGHTTHUMBREAR"],action[2]) + Finger_Rear.RIGHTTHUMBREAR(armature_obj,action[1],action[3]) + State["RIGHTTHUMBREAR"] = action[1] + print "Right Thumb Rear",State["RIGHTTHUMBREAR"] + + elif action[0] == "RIGHTINDEXFINGERREAR": + Finger_Rear.RIGHTINDEXFINGERREAR(armature_obj,State["RIGHTINDEXFINGERREAR"],action[2]) + Finger_Rear.RIGHTINDEXFINGERREAR(armature_obj,action[1],action[3]) + State["RIGHTINDEXFINGERREAR"] = action[1] + print "Right Index Finger Rear",State["RIGHTINDEXFINGERREAR"] + + elif action[0] == "RIGHTMIDDLEFINGERREAR": + Finger_Rear.RIGHTSMALLFINGERREAR(armature_obj,State["RIGHTMIDDLEFINGERREAR"],action[2]) + Finger_Rear.RIGHTSMALLFINGERREAR(armature_obj,action[1],action[3]) + State["RIGHTMIDDLEFINGERREAR"] = action[1] + print "Right Small Finger Rear",State["RIGHTMIDDLEFINGERREAR"] + + elif action[0] == "RIGHTSMALLFINGERREAR": + Finger_Rear.RIGHTSMALLFINGERREAR(armature_obj,State["RIGHTSMALLFINGERREAR"],action[2]) + Finger_Rear.RIGHTSMALLFINGERREAR(armature_obj,action[1],action[3]) + State["RIGHTSMALLFINGERREAR"] = action[1] + print "Right Small Finger Rear",State["RIGHTSMALLFINGERREAR"] + + elif action[0] == "LEFTTHUMBFRONT": + Finger_Front.LEFTTHUMBFRONT(armature_obj,State["LEFTTHUMBFRONT"],action[2]) + Finger_Front.LEFTTHUMBFRONT(armature_obj,action[1],action[3]) + State["LEFTTHUMBFRONT"] = action[1] + print "Left Thumb Front",State["LEFTTHUMBFRONT"] + + elif action[0] == "LEFTINDEXFINGERFRONT": + Finger_Front.LEFTINDEXFINGERFRONT(armature_obj,State["LEFTINDEXFINGERFRONT"],action[2]) + Finger_Front.LEFTINDEXFINGERFRONT(armature_obj,action[1],action[3]) + State["LEFTINDEXFINGERFRONT"] = action[1] + print "Left Index Finger Front",State["LEFTINDEXFINGERFRONT"] + + elif action[0] == "LEFTMIDDLEFINGERFRONT": + Finger_Front.LEFTMIDDLEFINGERFRONT(armature_obj,State["LEFTMIDDLEFINGERFRONT"],action[2]) + Finger_Front.LEFTMIDDLEFINGERFRONT(armature_obj,action[1],action[3]) + State["LEFTMIDDLEFINGERFRONT"] = action[1] + print "Left Middle Finger Front",State["LEFTMIDDLEFINGERFRONT"] + + elif action[0] == "LEFTSMALLFINGERFRONT": + Finger_Front.LEFTSMALLFINGERFRONT(armature_obj,State["LEFTSMALLFINGERFRONT"],action[2]) + Finger_Front.LEFTSMALLFINGERFRONT(armature_obj,action[1],action[3]) + State["LEFTSMALLFINGERFRONT"] = action[1] + print "Left Small Finger Front",State["LEFTSMALLFINGERFRONT"] + + elif action[0] == "RIGHTTHUMBFRONT": + Finger_Front.RIGHTTHUMBFRONT(armature_obj,State["RIGHTTHUMBFRONT"],action[2]) + Finger_Front.RIGHTTHUMBFRONT(armature_obj,action[1],action[3]) + State["RIGHTTHUMBFRONT"] = action[1] + print "Right Thumb Front",State["RIGHTTHUMBFRONT"] + + elif action[0] == "RIGHTINDEXFINGERFRONT": + Finger_Front.RIGHTMIDDLEFINGERFRONT(armature_obj,State["RIGHTINDEXFINGERFRONT"],action[2]) + Finger_Front.RIGHTMIDDLEFINGERFRONT(armature_obj,action[1],action[3]) + State["RIGHTINDEXFINGERFRONT"] = action[1] + print "Right Middle Finger Front",State["RIGHTINDEXFINGERFRONT"] + + elif action[0] == "RIGHTMIDDLEFINGERFRONT": + Finger_Front.RIGHTMIDDLEFINGERFRONT(armature_obj,State["RIGHTMIDDLEFINGERFRONT"],action[2]) + Finger_Front.RIGHTMIDDLEFINGERFRONT(armature_obj,action[1],action[3]) + State["RIGHTMIDDLEFINGERFRONT"] = action[1] + print "Right Middle Finger Front",State["RIGHTMIDDLEFINGERFRONT"] + + elif action[0] == "RIGHTSMALLFINGERFRONT": + Finger_Front.RIGHTSMALLFINGERFRONT(armature_obj,State["RIGHTSMALLFINGERFRONT"],action[2]) + Finger_Front.RIGHTSMALLFINGERFRONT(armature_obj,action[1],action[3]) + State["RIGHTSMALLFINGERFRONT"] = action[1] + print "Right Small Finger Front",State["RIGHTSMALLFINGERFRONT"] + + elif action[0] == "LEFTFEET": + Feet.LEFTFEET(armature_obj,State["LEFTFEET"],action[2]) + Feet.LEFTFEET(armature_obj,action[1],action[3]) + State["LEFTFEET"] = action[1] + print "Left Feet",State["LEFTFEET"] + + elif action[0] == "RIGHTFEET": + Feet.RIGHTFEET(armature_obj,State["RIGHTFEET"],action[2]) + Feet.RIGHTFEET(armature_obj,action[1],action[3]) + State["RIGHTFEET"] = action[1] + print "Right Feet",State["RIGHTFEET"] + + elif action[0] == "LEFTELBOW": + Elbow.LEFTELBOW(armature_obj,State["LEFTELBOW"],action[2]) + Elbow.LEFTELBOW(armature_obj,action[1],action[3]) + State["LEFTELBOW"] = action[1] + print "Left Elbow",State["LEFTELBOW"] + + elif action[0] == "RIGHTELBOW": + Elbow.RIGHTELBOW(armature_obj,State["RIGHTELBOW"],action[2]) + Elbow.RIGHTELBOW(armature_obj,action[1],action[3]) + State["RIGHTELBOW"] = action[1] + print "Right Elbow",State["RIGHTELBOW"] + + elif action[0] == "BODY": + Body.BODY(armature_obj,State["BODY"],action[2]) + Body.BODY(armature_obj,action[1],action[3]) + State["BODY"] = action[1] + print "Body",State["BODY"] + + elif action[0] == "LEFTARM": + Arm.LEFTARM(armature_obj,State["LEFTARM"],action[2]) + Arm.LEFTARM(armature_obj,action[1],action[3]) + State["LEFTARM"] = action[1] + print "Left Arm",State["LEFTARM"] + + elif action[0] == "RIGHTARM": + Arm.RIGHTARM(armature_obj,State["RIGHTARM"],action[2]) + Arm.RIGHTARM(armature_obj,action[1],action[3]) + State["RIGHTARM"] = action[1] + print "Right Arm",State["RIGHTARM"] + + elif action[0] == "LEFTWRIST": + Wrist.LEFTWRIST(armature_obj,State["LEFTWRIST"],action[2]) + Wrist.LEFTWRIST(armature_obj,action[1],action[3]) + State["LEFTWRIST"] = action[1] + print "Left Arm",State["LEFTWRIST"] + + elif action[0] == "RIGHTWRIST": + Wrist.RIGHTWRIST(armature_obj,State["RIGHTWRIST"],action[2]) + Wrist.RIGHTWRIST(armature_obj,action[1],action[3]) + State["RIGHTWRIST"] = action[1] + print "Right Wrist",State["RIGHTWRIST"] + + elif action[0] == "WAIST": + Waist.WAIST(armature_obj,State["WAIST"],action[2]) + Waist.WAIST(armature_obj,action[1],action[3]) + State["WAIST"] = action[1] + print "Waist",State["WAIST"] + + elif action[0] == "LEFTTOE": + Toes.LEFTTOE(armature_obj,State["LEFTTOE"],action[2]) + Toes.LEFTTOE(armature_obj,action[1],action[3]) + State["LEFTTOE"] = action[1] + print "Left Toe",State["LEFTTOE"] + + elif action[0] == "RIGHTTOE": + Toes.RIGHTTOE(armature_obj,State["RIGHTTOE"],action[2]) + Toes.RIGHTTOE(armature_obj,action[1],action[3]) + State["RIGHTTOE"] = action[1] + print "Right Toe",State["RIGHTTOE"] + + elif action[0] == "LEFTTHIGH": + Thighs.LEFTTHIGH(armature_obj,State["LEFTTHIGH"],action[2]) + Thighs.LEFTTHIGH(armature_obj,action[1],action[3]) + State["LEFTTHIGH"] = action[1] + print "Left Thigh",State["LEFTTHIGH"] + + elif action[0] == "RIGHTTHIGH": + Thighs.RIGHTTHIGH(armature_obj,State["RIGHTTHIGH"],action[2]) + Thighs.RIGHTTHIGH(armature_obj,action[1],action[3]) + State["RIGHTTHIGH"] = action[1] + print "Right Thigh",State["RIGHTTHIGH"] + + elif action[0] == "LEFTSHOULDER": + Shoulder.LEFTSHOULDER(armature_obj,State["LEFTSHOULDER"],action[2]) + Shoulder.LEFTSHOULDER(armature_obj,action[1],action[3]) + State["LEFTSHOULDER"] = action[1] + print "Left Shoulder",State["LEFTSHOULDER"] + + elif action[0] == "RIGHTSHOULDER": + Shoulder.RIGHTSHOULDER(armature_obj,State["RIGHTSHOULDER"],action[2]) + Shoulder.RIGHTSHOULDER(armature_obj,action[1],action[3]) + State["RIGHTSHOULDER"] = action[1] + print "Right Shoulder",State["RIGHTSHOULDER"] + + elif action[0] == "LEFTKNEE": + Knees.LEFTKNEE(armature_obj,State["LEFTKNEE"],action[2]) + Knees.LEFTKNEE(armature_obj,action[1],action[3]) + State["LEFTKNEE"] = action[1] + print "Left Knee",State["LEFTKNEE"] + + elif action[0] == "RIGHTKNEE": + Knees.RIGHTKNEE(armature_obj,State["RIGHTKNEE"],action[2]) + Knees.RIGHTKNEE(armature_obj,action[1],action[3]) + State["RIGHTKNEE"] = action[1] + print "Right Knee",State["RIGHTKNEE"] diff --git a/engine/functions.py b/engine/functions.py new file mode 100644 index 0000000..3572d28 --- /dev/null +++ b/engine/functions.py @@ -0,0 +1,40 @@ +import re; +import random; + +def removeExtraApostropheS(movie_title,tokenized_list): + '''Function removes extra 's' appearing as word in the tokenized list''' + + original_words = len(movie_title.split()); # original words in the movie title - space separated + tokenized_words = len(tokenized_list); # get the total words in the tokenized list + + if (original_words < tokenized_words): + # the tokenized list contains extra words - lets check for 's words + apos_s_pattern = re.compile("'s"); # regular expression for finding the 's in the movie title + apos_s_words = len(apos_s_pattern.findall(movie_title)); # find all the occurrences of 's in the movie title + + + if (apos_s_words > 0): + for i in range(0,apos_s_words): + tokenized_list.remove("s"); + + return tokenized_list; + +def debugger(msg): + '''debugger prints the given debug msg on screen/in debug file log''' + debugger_output = "con" + if debugger_output == "con":#console + print ("--> %s <--") % (msg) + else: + df = open(debugger_output,"a"); + df.write(str(msg)); + df.close(); + +#just a placeholder func +def findinDatabase(word): + '''finds a word in the database and returns True/False, action_seq_id and length of action_seq''' + return (random.choice([True,False]),random.choice(range(0,10)),random.choice(range(9,15))) #simulate existence of a word in database +#function ends here + +def error_logger(req,error): + req.write("Error occured :"+ error); + return True; diff --git a/engine/getimage analysis b/engine/getimage analysis new file mode 100644 index 0000000..5319c4c --- /dev/null +++ b/engine/getimage analysis @@ -0,0 +1,39 @@ +#this gets all the data inside the tag +a=re.compile('src="(.*)').findall(data) +####################OUTPUT######################### +# ['images/1.jpg" style="height:120px;width:150px;', 'images/2.jpg" style="height:120px;width:150px;', +# 'images/3.jpg" style="height:120px;width:150px;', 'images/4.jpg "style="height:120px;width:150px;', +# 'images/6.jpg" style="height:120px;width:150px;'] +##################################################### + + + +#this gets the data inside the src attribute of tag - but there is a problem with it +#it also takes ending double quotes(") +for item in a: + print "Got-->", re.compile('.*?"').findall(item)[0] + +####################OUTPUT######################### +# Got--> images/1.jpg" +# Got--> images/2.jpg" +# Got--> images/3.jpg" +# Got--> images/4.jpg" +# Got--> images/6.jpg" +##################################################### + + +# here is what i have done +image = [] +for item in a: + image.append('') + +####################OUTPUT######################### +# '' +# '' +# '' +# '' +# '' +##################################################### + + + diff --git a/engine/getimage.py b/engine/getimage.py new file mode 100644 index 0000000..bfe7db1 --- /dev/null +++ b/engine/getimage.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +import urllib +import urllib2 +import re + +########################################################## +# Preparing to get the html data from the Google Image +########################################################## +word = 'night' +response = None +url = 'http://images.google.com/images?q='+word +user_agent = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3' +header = {'User-Agent' : user_agent} + +####################################################################### +# Creating a request to the server and open the url to get the data +####################################################################### + +req = urllib2.Request(url) +req = urllib2.Request(url,None,header) +response = urllib2.urlopen(req) + +####################################################################### +# HTML response has been received. Use it to get the images from it +# +# result = re.compile('dyn.setResults\((.*)\);').findall(data) +# +# p = result[0].split('],[') +# +# for item in p: +# print '\nhttp://tbn0.google.com/images?q=tbn:'+item.split(",")[2][1:-1] +# +# +# +# +####################################################################### +image = [] +html_data = response.read() +response.close() + +####################################################################### +# This section of code has been removed. It will find img tags in normal web pages, but +# not in google. Google first gets all the image information in a javascript object and then +# uses it to generate the page dynamically. So we had to extract the data from the +# javascript object +# +# img_data=re.compile('src="(.*)').findall(html_data) +# +# for item in img_data: +# #image.append('') +# image.append(url+re.compile('.*?"').findall(item)[0][:-1]) +# +# BELOW IS THE NEWER VERSION THAT WORKS FOR GOOGLE IMAGE SEARCH +####################################################################### + +image = [] + +img_data = re.compile('dyn.setResults\((.*)\);').findall(html_data) +img_data = img_data[0].split("],[") +for item in img_data: + image.append('http://tbn0.google.com/images?q=tbn:'+item.split(',')[2][1:-1]) + +####################################################################### +# All the image tags have been extracted. Format for xml file +####################################################################### +xml_file_data = '' +xml_file_data += '\n' +xml_file_data += '\n\t'+word+'' +xml_file_data += '\n\t' + +counter = 0 +for item in image: + counter = counter + 1 + xml_file_data += '\n\t\t' + +xml_file_data += '\n\t' +xml_file_data += '\n' + +####################################################################### +# Write the xml data into the xml_file +####################################################################### + +xml_file = open("./word_image_test.xml","w") +xml_file.write(xml_file_data) +xml_file.close() + diff --git a/engine/getimages.py b/engine/getimages.py new file mode 100644 index 0000000..ebcc4c6 --- /dev/null +++ b/engine/getimages.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +#import urllib # I don't think this is being used anywhere anymore... +import urllib2 +import re + +def getImages(word=None): + ########################################################## + # Preparing to get the html data from the Google Image + ########################################################## + if word is None: word = raw_input("What word to get images for ?"); + response = None + url = 'http://images.google.com/images?q='+word + user_agent = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3' + header = {'User-Agent' : user_agent} + + ####################################################################### + # Creating a request to the server and open the url to get the data + ####################################################################### + + req = urllib2.Request(url) + req = urllib2.Request(url,None,header) + response = urllib2.urlopen(req) + + ####################################################################### + # HTML response has been received. Use it to get the images from it + # + # result = re.compile('dyn.setResults\((.*)\);').findall(data) + # + # p = result[0].split('],[') + # + # for item in p: + # print '\nhttp://tbn0.google.com/images?q=tbn:'+item.split(",")[2][1:-1] + # + # + # + # + ####################################################################### + image = [] + html_data = response.read() + response.close() + + ####################################################################### + # This section of code has been removed. It will find img tags in normal web pages, but + # not in google. Google first gets all the image information in a javascript object and then + # uses it to generate the page dynamically. So we had to extract the data from the + # javascript object + # + # img_data=re.compile('src="(.*)').findall(html_data) + # + # for item in img_data: + # #image.append('') + # image.append(url+re.compile('.*?"').findall(item)[0][:-1]) + # + # BELOW IS THE NEWER VERSION THAT WORKS FOR GOOGLE IMAGE SEARCH + ####################################################################### + + image = [] + + img_data = re.compile('dyn.setResults\((.*)\);').findall(html_data) + img_data = img_data[0].split("],[") + for item in img_data: + image.append('http://tbn0.google.com/images?q=tbn:'+item.split(',')[2][1:-1]) + + ####################################################################### + # All the image tags have been extracted. Send to the xml file + ####################################################################### + xml_file_data = '' + xml_file_data += '\n' + xml_file_data += '\n\t'+word+'' + xml_file_data += '\n\t' + + counter = 0 + for item in image: + counter = counter + 1 + xml_file_data += '\n\t\t' + + xml_file_data += '\n\t' + xml_file_data += '\n' + + ####################################################################### + # Write the xml data into the xml_file + ####################################################################### + + xml_file = open("./word_image_test.xml","w") + xml_file.write(xml_file_data) + xml_file.close() diff --git a/engine/manywords.py b/engine/manywords.py new file mode 100644 index 0000000..5d88c18 --- /dev/null +++ b/engine/manywords.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# +# manywords.py +# +# Copyright 2009 Live session user +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +from functions import debugger; +import nltk + +#the movie title 'slumdog' millionaire inspired us to do this. +debugging = False; + + +def breakinWords(word = "slumdog"): + '''breaks/decomposes a word in meaningful constituent words which can be performed''' + global debugging; + debugger('''trying to break down the words'''); + split_word_list = [] + + #Deepak - single words ki bhi ahmiyat hoti hai + + i = 0 # i - traverses from begining to end + k = 0 # k - used to extract all characters k characters from ith position ahead + j = len(word) # j - used for termination condition + + + while (i<=j): + k = i+1 + while (k<=j): + word_part = word[i:k] + if debugging: print word_part," ==> ",len(nltk.corpus.wordnet.synsets(word_part)) + if (len(nltk.corpus.wordnet.synsets(word_part)) > 0): + split_word_list.append(word_part) + k = k+1 + + i = i+1 + + i=0 + total = len(split_word_list) #total number of words + + while (i %s " % str(new_split_word_list)); + + return new_split_word_list; diff --git a/engine/orderDeterminer.py b/engine/orderDeterminer.py new file mode 100644 index 0000000..ec66c2a --- /dev/null +++ b/engine/orderDeterminer.py @@ -0,0 +1,128 @@ +###TO DO ---> +''' 1. Write a wrapper for wrapping the list of tuple(word,complete_plan,priority_points) and returning this list of tuples + back to the actuator/AppY + 2. Write determineImages properly so that images can be actually used by AppY -- take in consideration the + nature of the web and better save the images in a temporary table. + 3. Write the statistical and probability calc part to determine the right actionSEQ in determineActionSeq + -- a question, how important is it actually in the current scenario where there seems to be only one actionSeq? + -- we shouldn't postpone writing it(being the best of our creations), but we should accomodate todays situation. + 4. Integrate the chkSyn.txt in here. + -- if we use a synonym, lets record it. + 5. It would be better if we save the action plan for any word AFTER its completely and successfully performed --> this + is for the sensor...but I want to write it down, lest I forget. + 6. Write good database code -- integrate Gayatri's DBConnector(with Deepak) in here. + 7. Better rename this file to orderDeterminerAndPlanner or something like that because we PLAN all the things to do here. + 8. TEST!TEST!TEST! + + IMP--> 9. Please have a LOGIC-CHECK On this. +''' + +from manywords import breakinWords; #for the word decomposer and recognizer +from getimages import getImages +from functions import debugger +complete_plan = [] #a list of ActionSequence,IMage,WordInfo to be used for this word. +action_sequence = image_sequence = word_info = []; #will store the relevant things in it. +mini_words = [] #for letting everyone access the constituent words inside the Word + +def determineOrder(word_list): + '''determines the order in which the words in a movie title are to be performed''' + ''' we assign weights to words so that we know how 'easy' or 'difficult' they are to perform. + the heavier a word, the easier it is to perform. + -1 means very difficult. + ''' + + debugger('Determining order of performance of the words') + #IDEA --> this needs to be converted into a try-catch-except chain + for w in word_list: + #first check whether the word exists in the KB + complete_plan = checkWord(w); + if complete_plan == None: #this is a NEW word! + debugger('''%s is a NEW word''' % (w)) + #okay, whether we can determine an action sequence for this word using NLP ? + action_sequence = determineActionSeq(w); + if action_sequence == None: #we can't determine an action sequence for this word using NLP + #the word doesn't have an action sequence directly...maybe we need a better idea -- break into two words and perform + action_sequence = breakinWordsandDetermine(w); + if action_sequence == None:#we can't determine an action sequence even after breaking it + print ("I give up! I can't enact %s :(" % w) + #we can't act, so lets try to get Pictures to display and make the user guess + image_sequence = determineImages(w) + if image_sequence == None: + print ("Can't show any photo for this word"); + word_info = getWordInfo(); + if word_info == None: + print ("Can't DO ANYTHING FOR THIS word!"); + debugger("How the hell do I perform %s ?" % w); + points = -1; + else:#we found word info for this word + debugger("Using word info..."); + complete_plan = word_info; + points = 2; + else:#we found images for this word + debugger("Using images..."); + complete_plan = image_sequence; + points = 3; + else:#we determined action sequence by breaking into constituent words. + debugger("Using decomposed-words action-sequences..."); + complete_plan = action_sequence + points = 4; + else: + #we got an action sequence directly for this word using synonyms and tags + debugger("Using direct(synonym and tags) action sequence..."); + complete_plan = action_sequence; + points = 5; + else:#we KNOW this word! + points = 6; + return complete_plan; + #can we make an action sequence based on meanings ? --- the AI THINGY! + #else if canLearnANewSequence(w): + #if yes +4 points gained. + + +def checkWord(w): + '''check whether we know this word already and if yes, how do we perform it ?''' + '''will return the total plan for the word''' + debugger('''checking for the word in Knowledge Base'''); + + action_plan = queryKB("select word from words where word like '%s'" % (w)) + if action_plan: + return action_plan; + else: + return None; + +'''**********the probability and statistics wala part goes here**********''' +def determineActionSeq(passedWord): + '''checks whether the action sequence for a particular word exists in the KB and if yes which one is the best''' + debugger("Trying to determine an action sequence for %s " (passedWord)) + #import accessDb + #openConnection + strTags = executeQuery("Select tags from words where word like passedWord") + lstTags = strTags.split(',') + for i in range(len(lstTags)): + query="Select action_sequence from action_sequence where tags like 'lstTags[i]'" + strActionSeq = executeQuery(query) + if( strActionSeq != ""): + return None; + else: + return strActionSeq + +def breakinWordsandDetermine(w): + '''break the word in constituents words which may possibly have an action sequence.''' + '''if we can determine the action sequence of only one of the words, we will still perform it.''' + + mini_words = breakinWords(w);#uses the function from manywords module + mini_words_action_sequences = []; #stores the action sequence + i = 0; + for w in mini_words: + mini_words_action_sequences = [determineActionSeq(w)]; #will either return the 'right' and 'best' action sequence or return None; + #if we don't determine an action sequence for this word, don't fill None for it. + if mini_words_action_sequences[i] == None: + del(mini_words_action_sequences[i]) #remvoe the None element + i = i + 1; + + return mini_words_action_sequences + +def determineImages(w): + '''determine the right images(courtesy: Google Image Search) to be displayed for the word''' + debugger("determining the right images to be displayed for %s" % w) + getImages(w); diff --git a/engine/sensors.py b/engine/sensors.py new file mode 100644 index 0000000..541cfca --- /dev/null +++ b/engine/sensors.py @@ -0,0 +1,96 @@ +'''sensor -- senses user response, determines the 'right' thing to do, does it and RECORDS the action taken. + + TO DO : How actually will these sensors be fired ? -- what technically will make these sensors fire ? + SUGGESTION: we have a central AJAX-CGI file which interacts to user events WHILE the game is ON. + Find something better than AJAX-CGI...mod-python ? --- IMPLEMENTED + + can we just show a green halo for the words rightly guessed, red for wrong and orange for nearly ? + + CONVENTION: + all the sensors will take dataString and respond back with dict{actuator_name:{},responseString:{},responseType:'ok/nok'} + + written by samar - 060321011 and gayatri - 060321032 + + This file is under Apache License. +''' +from orderDeterminer.py import * +from nltk import *; +from nltk.corpus import wordnet as wn ; +from accessDb.py import *; + +def userEnteredWordSensor(user_input): + #what stage are we currently in ? -- whether AS,IM or WI ? + #what response did user enter ? + if exactly_right: + #save our total action plan. + cursor.executeQuery("insert into path values('',session['uid'],session['wordid']") + pathid=cursor.executeQuery("select pathid from path where wordid = session['wordid']") + cursor.executeQuery("insert into waypoint values('',pathid,session['type'],session['waypoint_info'])") + #LOG the path + #procede to the next word. + perform() + pass; + elif nearly_right: + #nearly right means --> + #one of the tags + wid=cursor.executeQuery("Select wordid from words where word like 'session['word']'") + tags=cursor.executeQuery("Select tags from words where wordid=wid") + for tag in tags: + if ( tag == word ) + #perform action sequence for NEXT + break; + #its synonym + for s in wn.synsets('session['word']'): + if( s == user_input ) + #perform action sequence for NEXT + break; + else: + #tags's synonym...? + for s in wn.synsets('tag'): + if( s == user_input ) + #perform action sequence for NEXT + break; + + + #do the 'next' action. + + #update the waypoints information --- how much NEXTS did an action/image/wi require ? + #give control to the client + pass; + elif not_at_all_right: + ac_seq_flag1=1; + while(ctr0 ) + #store waypoint(ctr-1) + img_seq = executeQuery(""); + else + + #perform ac_seq + #so, what stage are we currently in ? + #if AS, procede to IM + #if IM, procede to WI. + #if WI, procede to next word. + #LOG the action, update the waypoints information. + print 'Hey dude, you dont seem to guess this word...Lets go to the next one'; + elif time_up: + + +def userIdleForLongTimeSensor(): + #how long is long ? 2 minutes was the norm + #reset the game thing + pass; + +def userEnteredNonPerformedWordSensor(nonperformed_word): + #user entered a word which is yet to be performed + #what stage are we currently in ? -- is the current word action complete? + '''can we just show a green halo for the right words ?''' + userEnteredWordSensor(unperformed_word); + +def userGuessedtheMovieTitle(): + #applause!...? + pass; diff --git a/engine/sensors.pyc b/engine/sensors.pyc new file mode 100644 index 0000000..e7ffc8f Binary files /dev/null and b/engine/sensors.pyc differ diff --git a/kb/words.sql b/kb/words.sql new file mode 100644 index 0000000..1e97343 --- /dev/null +++ b/kb/words.sql @@ -0,0 +1,138 @@ +-- phpMyAdmin SQL Dump +-- version 2.11.6 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Apr 08, 2009 at 06:29 AM +-- Server version: 5.0.51 +-- PHP Version: 5.2.6 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `mysql` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `words` +-- + +CREATE TABLE `words` ( + `wordid` int(10) NOT NULL auto_increment, + `word` varchar(100) NOT NULL, + `category` varchar(50) NOT NULL, + `tags` varchar(500) NOT NULL, + PRIMARY KEY (`wordid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=103 ; + +-- +-- Dumping data for table `words` +-- + +INSERT INTO `words` (`wordid`, `word`, `category`, `tags`) VALUES +(1, 'I', 'Person, Pronoun,', 'Boy, Girl, Human, Man, Men,Women,Child,Children,Ladies,Gentlemen,Woman, Gentleman, Lady, Me, Mine, My'), +(2, 'We', 'Person, Pronoun, Group', 'People, Us, Our, Victory,Success'), +(3, 'You', 'Person, Pronoun', 'Yours, Your, U'), +(4, 'Walk', 'Action, Movement', 'stroll '), +(5, 'Run', 'Action, Movement', 'Sprint, Jog, Jogger, Fled, '), +(6, 'Sleep', 'Position, Rest', 'Rest, Yawn, Dream, Bored'), +(7, 'Eat', 'Action', 'Hog, Swallow, Chew, Churn, Cud, Hungry, Famished, Eatable, Edible, Food, Snacks, Bakery, Restaurant, Gourmet, Glut, Cook, Recipie, Nutrients,'), +(8, 'Drink', 'Action', 'Water, Milk, Pub, Bar, Juice, Liquid, Fluid, Thirsty'), +(9, 'Find', 'Action', 'Search, Clue, Clueless, Crime, Police,'), +(10, 'Jump', 'Action, Movement', 'Elated, Happy, Joy, Hop, Gallop, Yell, Shout, Scream'), +(11, 'Smile', 'Gesture', 'Happy, Joy, Chuckle, Grin, Dimple'), +(12, 'Cry', 'Action', 'Sad, Weep, Mourn, Lament,Pain,Painful'), +(13, 'Giggle', 'Action', 'Laughter, Happiness, Happy, Laugh,Joker,Clown,Mockery,Mock,Joke'), +(15, 'Angry', 'Action', 'Dislike, Hate, Destroy,Terminate,Hulk,Terminator,Destructor,Rude, Mad, Frustrated, Irritated, Disturbed, Tensed, Moody'), +(16, 'Mad', 'Action', 'Idiot, Crazy, Stupid, Lunatic, Asylum, Maniac, Mental, Nuts'), +(17, 'Bend', 'Action, Movement, Greeting', 'Excerise, Pick, Greeting, Respect, Wish'), +(18, 'Exercise', 'Action', 'Lift, Muscles, Workout, Gym, Dumbells, Health, Fitness'), +(19, 'Study', 'Action', 'Academics,Result,School,Exam,Test,College,Education,Books,Read'), +(20, 'Kick', 'Action', 'Kickboxing,Fight.Quarrel,Karate,Marshal,Taekwondo,Boxing'), +(21, 'Punch', 'Action', 'Fight,Quarrel,Beat,Hit,Hurt,Wound,Bruise,Rocky'), +(22, 'Strong', 'Adjective', 'Physique,Muscular,Healthy'), +(23, 'Tired', 'Adjective', 'Fatigue,Weak'), +(24, 'Fly', 'Action', 'Bird,Flight,Float,Wings,'), +(25, 'Punish', 'Action', 'Punishment,Sorry,Forgive,Apologise,Confession,Confess'), +(26, 'Love', 'Gesture', 'Heart,Like,Affection,Cardiac'), +(27, 'Think', 'Action', 'Ponder,Thought,Thinking,Idea,Eureka,Analyze'), +(28, 'Intelligent', 'Adjective', 'Smart,Talented,Einstein,Thomas,Edison,Alber,Isaac,Newton,Bulb,Bright'), +(29, 'Hand', 'Body', 'Arm,Wrist,Palm,Hands,Forearm,Hand,Biceps,Triceps'), +(30, 'Shoulder', 'Body', 'Shoulders'), +(31, 'Torso', 'Body', 'Body,Physique,Figure'), +(32, 'Back', 'Body', 'Spine,Spinal,Cord,'), +(33, 'Elbow', 'Body', 'Elbow'), +(34, 'Fingers', 'Body', 'Thumb,Index,Middle,Pinky,Knuckles,Tickle'), +(38, 'Stomach', 'Body', 'Hungry,Famished,Hog,Eat,Fat,Weight,Obese,Obesity,Foodie'), +(39, 'Thigh', 'Body', 'Thigh,Squats'), +(40, 'Legs', 'Body', 'Calves,Leg,Calf,Knees,Knee,Kick'), +(41, 'Feet', 'Body', 'Feet,Shoes,Shoe,Boot,Boots'), +(42, 'Toes', 'Body', 'Toe,Tips'), +(43, 'Face', 'Body', 'Expression,'), +(44, 'Lips', 'Body', 'Mouth,Teeth,Tooth'), +(45, 'Kiss', 'Verb,Action', 'Flying,French'), +(46, 'Eyes', 'Body', 'Eye,Wink,Blink,Cataract,Conjunctivitis'), +(47, 'Ears', 'Body', 'Ear,Eardrum,Listen,Hear,Sound,Noise'), +(48, 'Nose', 'Body', 'Smell,Stink,Fragrance,Snout'), +(49, 'Cheeks', 'Body', 'Chubby'), +(50, 'Skin', 'Body', 'Skinny'), +(51, 'Pull', 'Verb,Action', 'Drag'), +(52, 'Push', 'Body', 'Force,Forceful,'), +(53, 'Talk', 'Verb,Action', 'Converse,Conversation'), +(54, 'Move', 'Verb,Action', 'Movement,Act,Action,Enact'), +(55, 'Still', 'Adjective', 'Stationary,Fixed,'), +(56, 'Yawn', 'Verb,Action', 'Bored,Sleepy,Boredom'), +(57, 'Turn', 'Verb,Action', 'Twist,Twisted'), +(58, 'Shrug', 'Verb,Action', 'Shrug'), +(59, 'Neck', 'Body', 'Throat,Voice'), +(60, 'Sigh', 'Verb,Action', 'Relief'), +(61, 'Dance', 'Verb,Action', 'Entertainment,Entertain,Holiday,Enjoy,Celebrate,Pleasure,Party'), +(62, 'Yes', 'Gesture,Verb,Action', 'Agree,Agreement,Nod,Noddy'), +(63, 'No', 'Gesture,Verb,Action', 'Disagree,Disagreement,Shake,Shook'), +(64, 'Sing', 'Verb,Action', 'Song,Maestro,Musician,Music,LyricsMelody,Melodious,Tune,Rhythm,Rhythmic,Guitar,Casio,Piano,Mike,Stage,Singer'), +(65, 'Scared', 'Verb,Action', 'Fear,Scary,Scare,Afraid,Scardy,Frightened,Ghost,Spirit,Exhorcist,Exhorcism,'), +(66, 'Play', 'Verb,Action', 'Game,Sports,Volleyball,Ball,Football,Cricket,Soccer,Rugby,Kabaddi,Carrom,Skating,Hockey,Cards'), +(67, 'Hide', 'Verb,Action', 'Seek,'), +(68, 'Yoga', 'Verb,Action', 'Exercise,Relaxation,Relax'), +(69, 'Cross', 'Adjective,Noun', 'Angry,Church,Jesus,Christ,Mary,Holy,Grail,Bible,Joseph'), +(70, 'Hi', 'Greeting,Gesture', 'Bye,Hello,Good,Morning,Afternoon,Evening,Night,Saiyonara,Adios,Chao'), +(71, 'Magic', 'Noun', 'Magical,Enchanted,Fairytale'), +(72, '1', 'Digit', 'One,Single,Singular,Once,First'), +(73, '2', 'Digit', 'Two,Double,Plural,Twice,Second'), +(74, '0', 'Digit', 'None,Null,Zero,Zinch,Nothing,Zeroth'), +(75, '3', 'Digit', 'Three,Triple,Thrice,Third,Tri'), +(76, '4', 'Digit', 'Four,Quadruple,Quad,Quadrant,Quarter,Fourth,Quarterly'), +(77, '5', 'Digit', 'Five,Fifth,Pent'), +(78, '6', 'Digit', 'Six,Sixth,Sixer,Hex'), +(79, '7', 'Digit', 'Seven,Seventh,Hept'), +(80, '8', 'Digit', 'Eight,Eighth,Oct'), +(81, '9', 'Digit', 'Nine,Ninth,Nano,Nona'), +(82, 'Big', 'Adjective', 'Large,Huge,Oversized,Great,Macro,Magnify,Mega,Kilo,Tera,Giga,Bigger,Biggest,Larger,Largest,Gigantic,Giant,Abominable,Snowman'), +(83, 'Small', 'Adjective', 'Micro,Milli,Less,Least,Smaller,Smallest,Some,Few'), +(84, 'Type', 'Verb,Action', 'Computer,Type,Typewriter,PC,Laptop,Job,Work,Do,Done,Doing'), +(85, 'Open', 'Verb,Action', 'Opened'), +(86, 'Close', 'Verb,Action', 'Closed'), +(87, 'Tease', 'Verb,action', 'Irritate,Annoy'), +(88, 'Stop', 'Verb,Action', 'Stopped,Traffic,Signal,Wait'), +(89, 'Next', 'Verb,Action', 'More,Close'), +(90, 'A', 'Article', 'And,An'), +(91, 'The', 'Article', 'The'), +(92, 'In', 'Proposition', 'Inside,Indoor'), +(93, 'Of', 'Proposition', 'Of'), +(94, '', '', ''), +(95, 'See', 'Verb,Action', 'Sight,View,Visible,Visibility,Clear,Clarify,Look'), +(96, 'Animal', 'Noun', 'Bird,Insect,Reptile'), +(97, 'Lift', 'Noun', 'Pickup,Road'), +(98, 'Clap', 'Verb,Action', 'Applaud,Applause,Appreciate,Praise,Encourage,Encouragement'), +(99, 'Pride', 'Adjective', 'Anthem,Proud,Boast,Loyal,Honour'), +(100, 'Salute', 'Gesture,Verb,Action', 'Respect,Honour'), +(101, 'Quiet', 'Adjective', 'Silence,Silent,Sh,Shhh,Sshh,Still'), +(102, 'Rain', 'Noun', 'Monsoon,Shower,Showers,Drizzle,Drizzling'); diff --git a/points.txt b/points.txt new file mode 100644 index 0000000..24e9009 --- /dev/null +++ b/points.txt @@ -0,0 +1,7 @@ +1.. all word processing and NLP must be case-insensitive. +2.. How do we relate happiness and happy ? -- they aren't synonyms + + +Future enhancements: + 1.Design an interface to create XML action sequence files for character animation. + 2.