Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
3836746b
Commit
3836746b
authored
13 years ago
by
Jesse Kaukonen
Browse files
Options
Downloads
Patches
Plain Diff
Fixing a bug with an assertation failing due to file being saved in inaccessable directory
parent
bf97ac20
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
render_renderfarmfi.py
+28
-6
28 additions, 6 deletions
render_renderfarmfi.py
with
28 additions
and
6 deletions
render_renderfarmfi.py
+
28
−
6
View file @
3836746b
...
@@ -21,7 +21,7 @@ DEV = False
...
@@ -21,7 +21,7 @@ DEV = False
bl_info
=
{
bl_info
=
{
"
name
"
:
"
Renderfarm.fi
"
,
"
name
"
:
"
Renderfarm.fi
"
,
"
author
"
:
"
Nathan Letwory <nathan@letworyinteractive.com>, Jesse Kaukonen <jesse.kaukonen@gmail.com>
"
,
"
author
"
:
"
Nathan Letwory <nathan@letworyinteractive.com>, Jesse Kaukonen <jesse.kaukonen@gmail.com>
"
,
"
version
"
:
(
19
,),
"
version
"
:
(
20
,),
"
blender
"
:
(
2
,
6
,
2
),
"
blender
"
:
(
2
,
6
,
2
),
"
location
"
:
"
Render > Engine > Renderfarm.fi
"
,
"
location
"
:
"
Render > Engine > Renderfarm.fi
"
,
"
description
"
:
"
Send .blend as session to http://www.renderfarm.fi to render
"
,
"
description
"
:
"
Send .blend as session to http://www.renderfarm.fi to render
"
,
...
@@ -43,6 +43,7 @@ import http.client
...
@@ -43,6 +43,7 @@ import http.client
import
xmlrpc.client
import
xmlrpc.client
import
math
import
math
from
os.path
import
isabs
,
isfile
from
os.path
import
isabs
,
isfile
import
os
import
time
import
time
from
bpy.props
import
PointerProperty
,
StringProperty
,
BoolProperty
,
EnumProperty
,
IntProperty
,
CollectionProperty
from
bpy.props
import
PointerProperty
,
StringProperty
,
BoolProperty
,
EnumProperty
,
IntProperty
,
CollectionProperty
...
@@ -81,7 +82,7 @@ bpy.cancelError = False
...
@@ -81,7 +82,7 @@ bpy.cancelError = False
bpy
.
texturePackError
=
False
bpy
.
texturePackError
=
False
bpy
.
linkedFileError
=
False
bpy
.
linkedFileError
=
False
bpy
.
uploadInProgress
=
False
bpy
.
uploadInProgress
=
False
bpy
.
originalFileName
=
bpy
.
path
.
display_name_from_filepath
(
bpy
.
data
.
filepath
)
bpy
.
originalFileName
=
bpy
.
data
.
filepath
bpy
.
particleBakeWarning
=
False
bpy
.
particleBakeWarning
=
False
bpy
.
childParticleWarning
=
False
bpy
.
childParticleWarning
=
False
bpy
.
simulationWarning
=
False
bpy
.
simulationWarning
=
False
...
@@ -324,14 +325,29 @@ def prepareScene():
...
@@ -324,14 +325,29 @@ def prepareScene():
# Save with a different name
# Save with a different name
print
(
"
Saving into a new file...
"
)
print
(
"
Saving into a new file...
"
)
bpy
.
originalFileName
=
bpy
.
data
.
filepath
print
(
"
Original path is
"
+
bpy
.
originalFileName
)
try
:
try
:
# If the filename is empty, we'll make one from the path of the
Blender installation
# If the filename is empty, we'll make one from the path of the
user's resource folder
if
(
len
(
bpy
.
originalFileName
)
==
0
):
if
(
len
(
bpy
.
originalFileName
)
==
0
):
bpy
.
originalFileName
=
bpy
.
utils
.
resource_path
(
type
=
'
LOCAL
'
)
+
"
renderfarm.blend
"
print
(
"
No existing file path found, saving to autosave directory
"
)
bpy
.
ops
.
wm
.
save_mainfile
(
filepath
=
bpy
.
originalFileName
)
savePath
=
bpy
.
utils
.
user_resource
(
"
AUTOSAVE
"
)
try
:
os
.
mkdir
(
savePath
)
except
Exception
as
ex
:
print
(
ex
)
try
:
savePath
=
savePath
+
"
_renderfarm
"
except
Exception
as
ex
:
print
(
ex
)
try
:
bpy
.
ops
.
wm
.
save_mainfile
(
filepath
=
savePath
)
except
Exception
as
ex
:
print
(
ex
)
else
:
else
:
print
(
"
Saving to current .blend directory
"
)
savePath
=
bpy
.
originalFileName
savePath
=
bpy
.
originalFileName
savePath
=
savePath
+
"
_renderfarm
"
savePath
=
savePath
+
"
_renderfarm
.blend
"
bpy
.
ops
.
wm
.
save_mainfile
(
filepath
=
savePath
)
bpy
.
ops
.
wm
.
save_mainfile
(
filepath
=
savePath
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
...
@@ -691,9 +707,13 @@ def encode_multipart_data(data, files):
...
@@ -691,9 +707,13 @@ def encode_multipart_data(data, files):
return
body
,
headers
return
body
,
headers
def
send_post
(
data
,
files
):
def
send_post
(
data
,
files
):
print
(
"
Forming connection for post
"
)
connection
=
http
.
client
.
HTTPConnection
(
rffi_xmlrpc_upload
)
connection
=
http
.
client
.
HTTPConnection
(
rffi_xmlrpc_upload
)
print
(
"
Requesting
"
)
connection
.
request
(
'
POST
'
,
'
/burp/storage
'
,
*
encode_multipart_data
(
data
,
files
))
# was /file
connection
.
request
(
'
POST
'
,
'
/burp/storage
'
,
*
encode_multipart_data
(
data
,
files
))
# was /file
print
(
"
Getting response
"
)
response
=
connection
.
getresponse
()
response
=
connection
.
getresponse
()
print
(
"
Reading response
"
)
res
=
response
.
read
()
res
=
response
.
read
()
return
res
return
res
...
@@ -709,7 +729,9 @@ def md5_for_file(filepath):
...
@@ -709,7 +729,9 @@ def md5_for_file(filepath):
return
md5hash
.
hexdigest
()
return
md5hash
.
hexdigest
()
def
upload_file
(
key
,
userid
,
sessionid
,
path
):
def
upload_file
(
key
,
userid
,
sessionid
,
path
):
print
(
"
Asserting absolute path
"
)
assert
isabs
(
path
)
assert
isabs
(
path
)
print
(
"
Asserting path is a file
"
)
assert
isfile
(
path
)
assert
isfile
(
path
)
data
=
{
data
=
{
'
userId
'
:
str
(
userid
),
'
userId
'
:
str
(
userid
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment