Difference between revisions of "Script"
Jump to navigation
Jump to search
m |
m |
||
| Line 5: | Line 5: | ||
| − | + | ===blender script that does ?=== | |
<pre> | <pre> | ||
#!BPY | #!BPY | ||
Revision as of 08:49, 10 February 2012
windows for - do - done script, goes through every line and issues command for each
FOR /F %%i IN (hapi.txt) DO echo print|nsradmin -p390113 -i - -s %%i
blender script that does ?
#!BPY
#"""
#Name: 'script name here 3'
#Blender: 245
#Group: 'Wizards'
#Toltip: 'your toltip here'
#"""
__author__ = 'Your Name Here'
__version__ = 'script version here 3'
__url__ = ['your site her, http://you.site.here', 'blender', 'elysiun']
__bpydoc__ = """\
The documentation her please
Make it if you want to release this script on the internet"""
import Blender #import the blender module so tha we can use Blender.*
GUI = True #Toggle Gui
FILE = "c:/numba.txt" #path to the file (must exists)
OBJECT = 'Cube' #the object to chance scale on
def ReadFile():
try:
f = open(FILE, "r") #first we try to open the file
except: #if the file did not open
print "Open file failed"
raise #raise the error again to stop the script
else:
try: #then we try to load the data
x = float(f.readline())
y = float(f.readline())
z = float(f.readline())
except: #If tha data in the file did not follow the strict syntax
print 'Data corrupt'
raise #stopping the script
finally:
f.close() #always remember to close the file when done
return x, y, z
def update():
obj = Blender.Object.Get(OBJECT) #get our object so that we can edit them
x, y, z = ReadFile() #get the size from the file
#set our object scale
obj.SizeX = x
obj.SizeY = y
obj.SizeZ = z
Blender.Redraw()
def main():
time = Blender.sys.time()
update() #So that we can know if any newly implented
print 'script tok:', Blender.sys.time() - time, 'seconds' #features are speedbumps
def button_event(evt): #button event
if evt == 1:
main()
def event(evt, val): #key event
if evt == Blender.Draw.ESCKEY:
Blender.Draw.Exit()
def gui(): #drfawing of buttons
button = Blender.Draw.PushButton('update',1, 10, 10, 200, 50, 'update Object')
if __name__ == "__main__":
if GUI == True:
while True:
gui() # to avoid the Draw, error, redraw, error loop
Blender.Draw.Register(gui, event, button_event) #registring gui, event, and button event
sleep(1)
else:
main()