Blender > Другое
Blender, трояны и другие скрипты
sungreen:
... паранойя, но оно посещает регулярно - ведь питон дает достаточно возможности навставлять всякого такого, а вот когда появятся вирусы под блендер? ...
... конечно, обычно мыж не запускаем скрипты из инета, это опасно, но качаем всякие тулзы и сборки блендера и запускаем их, а кто-то даже от рута ...
... Друзья, или это не так и под блендер невозможно существование ни каких вирусов ибо блендер он белый и пушистый? ...
ps навеяно вот этим, как всегда начинается с малого
http://www.kaspersky.ru/news?id=207733291
http://www.kaspersky.ru/news?id=207733309
nort:
тоже есть параноя.но я думаю блендеру ще далеко до этого.тем более мне это не гразит,я качаю с оф сайта.
Юрий Пет:
А у меня нет никакой паранойи, даже не думаю об этом, зачем голову забивать
А вообще ставьте антивирусы
sungreen:
... вот попробовал накинуть скрипт для blender 2.6 для экспорта в engrid ...
io_export_engrid.py
--- Код: python ---# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Export Engrid (.begc)",
"author": "test",
"version": (0, 1),
"blender": (2, 6, 0),
"api": 36079,
"location": "File > Export > Engrid (.begc)",
"description": "Export mesh Engrid data (.begc)",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Import-Export"}
'''
Usage Notes:
'''
import bpy
from bpy.props import *
import mathutils, math, struct
from os import remove
import time
from bpy_extras.io_utils import ExportHelper
def do_export(context, props, filepath):
out = open(filepath, "w")
out.write('%d\n' % len(bpy.data.meshes))
node_offset = 0
for mesh in bpy.data.meshes:
out.write(mesh.name)
out.write('\n')
for mesh in bpy.data.meshes:
faces = mesh.faces
nodes = mesh.vertices
out.write('%d' % len(nodes))
out.write(' %d\n' % len(faces))
for n in nodes:
out.write("%e " % n.co[0])
out.write("%e " % n.co[1])
out.write("%e\n" % n.co[2])
for f in faces:
out.write("%d" % len(f.vertices))
for v in f.vertices:
out.write(' %d' % (v + node_offset))
out.write('\n')
node_offset = node_offset + len(nodes)
out.flush()
out.close()
return True
###### EXPORT OPERATOR #######
class Export_engrid(bpy.types.Operator, ExportHelper):
bl_idname = "export_shape.engrid"
bl_label = "Export Engrid (.begc)"
filename_ext = ".begc"
@classmethod
def poll(cls, context):
return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}
def execute(self, context):
start_time = time.time()
print('\n_____START_____')
props = self.properties
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
exported = do_export(context, props, filepath)
if exported:
print('finished export in %s seconds' %((time.time() - start_time)))
print(filepath)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
if True:
# File selector
wm.fileselect_add(self) # will run self.execute()
return {'RUNNING_MODAL'}
elif True:
# search the enum
wm.invoke_search_popup(self)
return {'RUNNING_MODAL'}
elif False:
# Redo popup
return wm.invoke_props_popup(self, event)
elif False:
return self.execute(context)
### REGISTER ###
def menu_func(self, context):
self.layout.operator(Export_engrid.bl_idname, text="Engrid (.begc)")
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
register()
--- Конец кода ---
[вложение удалено Администратором]
sungreen:
... Oliver поправил скрипт и теперь его модификация лежит по ссылке ...
http://db.tt/HUJynYkQ
... Само обсуждение можно посмотреть ...
http://engits.eu/vanilla/index.php?p=/discussion/96/installing-the-importexport-scripts-for-blender/#Item_14
--- Код: python ---# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "Export to enGrid (.begc)",
"author": "Unknown Author",
"version": (0, 1),
"blender": (2, 5, 9),
"api": 36079,
"location": "File > Export > enGrid (.begc)",
"description": "Export objects as boundaries to enGrid's Blender exchange format (*.begc)",
"warning": "",
"wiki_url": "http://engits.eu/wiki",
"tracker_url": "http://sourceforge.net/apps/mantisbt/engrid",
"category": "Import-Export"}
'''
Usage Notes:
'''
import bpy
from bpy.props import *
import mathutils, math, struct
from os import remove
import time
from bpy_extras.io_utils import ExportHelper
def do_export(context, props, filepath):
out = open(filepath, "w")
out.write('%d\n' % len(bpy.data.meshes))
node_offset = 0
for obj in bpy.data.objects:
if obj.type == 'MESH':
out.write(obj.name)
out.write('\n')
for obj in bpy.data.objects:
if obj.type == 'MESH':
mesh = obj.data
mesh.transform(obj.matrix_world)
faces = mesh.faces
nodes = mesh.vertices
out.write('%d' % len(nodes))
out.write(' %d\n' % len(faces))
for n in nodes:
out.write("%e " % n.co[0])
out.write("%e " % n.co[1])
out.write("%e\n" % n.co[2])
for f in faces:
out.write("%d" % len(f.vertices))
for v in f.vertices:
out.write(' %d' % (v + node_offset))
out.write('\n')
node_offset = node_offset + len(nodes)
out.flush()
out.close()
return True
###### EXPORT OPERATOR #######
class Export_engrid(bpy.types.Operator, ExportHelper):
bl_idname = "export_shape.engrid"
bl_label = "Export enGrid (.begc)"
filename_ext = ".begc"
@classmethod
def poll(cls, context):
return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}
def execute(self, context):
start_time = time.time()
print('\n_____START_____')
props = self.properties
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
exported = do_export(context, props, filepath)
if exported:
print('finished export in %s seconds' %((time.time() - start_time)))
print(filepath)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
if True:
# File selector
wm.fileselect_add(self) # will run self.execute()
return {'RUNNING_MODAL'}
elif True:
# search the enum
wm.invoke_search_popup(self)
return {'RUNNING_MODAL'}
elif False:
# Redo popup
return wm.invoke_props_popup(self, event)
elif False:
return self.execute(context)
### REGISTER ###
def menu_func(self, context):
self.layout.operator(Export_engrid.bl_idname, text="enGrid (.begc)")
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_file_export.append(menu_func)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_file_export.remove(menu_func)
if __name__ == "__main__":
register()
--- Конец кода ---
Навигация
Перейти к полной версии