diff --git a/.cvsignore b/.cvsignore index ce675ee..298bf8b 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -blender-2.31a.tar.bz2 +blender-2.34.tar.bz2 diff --git a/blender.applications b/blender.applications new file mode 100644 index 0000000..0f6acbb --- /dev/null +++ b/blender.applications @@ -0,0 +1,7 @@ +blender + command=blender + name=Blender 3D modeling + can_open_multiple_files=true + expects_uris=false + requires_terminal=false + mime_types=application/x-blender diff --git a/blender.desktop b/blender.desktop index c1e6e9e..6997a7a 100644 --- a/blender.desktop +++ b/blender.desktop @@ -7,3 +7,4 @@ Icon=blender.png Terminal=false Type=Application Categories=Graphics;Application; +MimeType=application/x-blender diff --git a/blender.keys b/blender.keys new file mode 100644 index 0000000..85bce39 --- /dev/null +++ b/blender.keys @@ -0,0 +1,4 @@ +application/x-blender + short_list_application_ids_for_novice_user_level=blender + short_list_application_ids_for_intermediate_user_level=blender + short_list_application_ids_for_advanced_user_level=blender diff --git a/blender.mime b/blender.mime new file mode 100644 index 0000000..ba1dad0 --- /dev/null +++ b/blender.mime @@ -0,0 +1,2 @@ +application/x-blender + ext: blend diff --git a/blender.spec b/blender.spec index 36ff0d8..bb8d4a8 100644 --- a/blender.spec +++ b/blender.spec @@ -1,16 +1,24 @@ Name: blender -Version: 2.31 -Release: 0.fdr.3.a.1 +Version: 2.34 +Release: 0.fdr.2.2 Epoch: 0 Summary: 3D modeling, animation, rendering and post-production. -Group: Applications/Multimedia +Group: Applications/Multimedia License: GPL URL: http://www.blender.org -Source0: http://download.blender.org/source/blender-2.31a.tar.bz2 -Source1: blender.png -Source2: blender.desktop -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source0: http://download.blender.org/source/blender-2.34.tar.bz2 +Source1: http://bane.servebeer.com/programming/blender/import-3ds-0.7.py +Source2: http://bane.servebeer.com/programming/blender/export-3ds-0.71.py +Source3: blender.png +Source4: blender.desktop +Source5: blender.mime +Source6: blender.keys +Source7: gnome-mime-application-x-blender.png +Source8: x-blender.desktop +Source9: blender.applications +Source10: blender.xml +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: zlib-devel BuildRequires: libjpeg-devel @@ -24,9 +32,12 @@ BuildRequires: libvorbis-devel BuildRequires: libogg-devel BuildRequires: esound-devel BuildRequires: openal-devel +BuildRequires: scons BuildRequires: libtool BuildRequires: gettext BuildRequires: desktop-file-utils +Requires(post): shared-mime-info +Requires(postun): shared-mime-info %description Blender is the essential software solution you need for 3D, from modeling, @@ -38,50 +49,85 @@ secure, multi-platform content to the web, CD-ROMs, and other media. %prep -%setup -q -n blender-2.31a +%setup -q %build -aclocal -autoheader -automake --gnu --add-missing --foreign -autoconf - -%configure \ ---disable-shared \ ---enable-openal \ ---disable-rpath -make %{?_smp_mflags} +sed -i "s/use_openal =.*/use_openal = 'true'/g;" SConstruct +scons %install rm -rf ${RPM_BUILD_ROOT} -make install DESTDIR=${RPM_BUILD_ROOT} - +install -D -m0755 blender ${RPM_BUILD_ROOT}/%{_bindir}/blender +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/blender/scripts/ +install -p -D -m0644 release/scripts/*.py ${RPM_BUILD_ROOT}%{_datadir}/blender/scripts/ +install -p -D -m0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_datadir}/blender/scripts/import-3ds-0.7.py +install -p -D -m0644 %{SOURCE2} ${RPM_BUILD_ROOT}%{_datadir}/blender/scripts/export-3ds-0.71.py install -p -D -m0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/blender.png +install -p -D -m0644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_datadir}/mime-info/blender.mime +install -p -D -m0644 %{SOURCE6} ${RPM_BUILD_ROOT}%{_datadir}/mime-info/blender.keys +install -p -D -m0644 %{SOURCE7} ${RPM_BUILD_ROOT}%{_datadir}/pixmaps/gnome-mime-application-x-blender.png +install -p -D -m0644 %{SOURCE8} ${RPM_BUILD_ROOT}%{_datadir}/mimelnk/application/x-blender.desktop +install -p -D -m0644 %{SOURCE9} ${RPM_BUILD_ROOT}%{_datadir}/application-registry/blender.applications +install -p -D -m0644 %{SOURCE10} ${RPM_BUILD_ROOT}%{_datadir}/mime/packages/blender.xml desktop-file-install --vendor fedora \ --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \ --add-category X-Fedora \ - %{SOURCE2} + %{SOURCE4} %clean rm -rf ${RPM_BUILD_ROOT} +%post +update-mime-database %{_datadir}/mime > /dev/null 2>&1 || : + + +%postun +update-mime-database %{_datadir}/mime > /dev/null 2>&1 || : + %files %defattr(-,root,root,-) -%doc COPYING README release_* doc/python-dev-guide.txt doc/GPL-license.txt doc/bf-members.txt +%doc COPYING README doc/python-dev-guide.txt doc/GPL-license.txt doc/bf-members.txt %{_bindir}/* %{_datadir}/applications/fedora-blender.desktop -%{_datadir}/pixmaps/%{name}.png - +%{_datadir}/pixmaps/*.png +%{_datadir}/blender/ +%{_datadir}/mime-info/* +%{_datadir}/mimelnk/application/* +%{_datadir}/application-registry/blender.applications +%{_datadir}/mime/packages/blender.xml %changelog +* Thu Aug 05 2004 Phillip Compton 0:2.34-0.fdr.2 +- blender.applications file. +- blender.xml file. +- post/postun update-mime-database. + +* Thu Aug 05 2004 Phillip Compton 0:2.34-0.fdr.1 +- Updated to 2.34. + +* Thu Aug 05 2004 Phillip Compton 0:2.33-0.fdr.2.a +- Include 3ds import/export scripts. +- Added mime info. +- Added mime icon (from yattacier theme). + +* Wed Aug 04 2004 Phillip Compton 0:2.33-0.fdr.1.a +- 2.33a. +- Now building with scons. + +* Tue Feb 10 2004 Phillip Compton 0:2.32-0.fdr.2 +- Now including scripts. + +* Thu Feb 05 2004 Phillip Compton 0:2.32-0.fdr.1 +- Updated to 2.32. + * Sun Jan 11 2004 Phillip Compton 0:2.31-0.fdr.3.a - --enable-openal. - --disable-rpath. diff --git a/blender.xml b/blender.xml new file mode 100644 index 0000000..7cee114 --- /dev/null +++ b/blender.xml @@ -0,0 +1,7 @@ + + + + Blender Scene + + + diff --git a/export-3ds-0.71.py b/export-3ds-0.71.py new file mode 100644 index 0000000..221e4c0 --- /dev/null +++ b/export-3ds-0.71.py @@ -0,0 +1,744 @@ +#!BPY + +""" +Name: '3D Studio' +Blender: 233 +Group: 'Export' +Tip: 'Export to 3DS file format. (.3ds)' +""" + + + +###################################################### +# 3ds Importer +# By: Bob Holcomb and Richard L�rk�ng +# Date: 22 APR 04 +# Ver: 0.7 +###################################################### +# This script imports a 3ds file and the materials +# into blender for editing. Hopefully +# this will make it into a future version as an import +# feature of the menu. Loader is based on 3ds loader +# from www.gametutorials.com(Thanks DigiBen). +###################################################### + +###################################################### +# Importing modules +###################################################### + +import Blender +from Blender import NMesh, Scene, Object, Material +from Blender.BGL import * +from Blender.Draw import * +from Blender.Window import * +from Blender.Image import * +from Blender.Material import * + +import sys, struct, string, types, math +from types import * + +import os +from os import path + + +###################################################### +# Data Structures +###################################################### + +#Some of the chunks that we will see +#----- Primary Chunk, at the beginning of each file +PRIMARY=19789 #0x4D4D + +#------ Main Chunks +OBJECTINFO=15677 #0x3D3D // This gives the version of the mesh and is found right before the material and object information +VERSION=2 #0x0002 // This gives the version of the .3ds file +EDITKEYFRAME=45056 #0xB000 // This is the header for all of the key frame info + +#------ sub defines of OBJECTINFO +MATERIAL=45055 #0xAFFF // This stored the texture info +OBJECT=16384 #0x4000 // This stores the faces, vertices, etc... + +#------ sub defines of MATERIAL +MATNAME=40960 #0xA000 // This holds the material name +MATAMBIENT=40976 #0xA010 +MATDIFFUSE=40992 #0xA020 // This holds the color of the object/material +MATSPECULAR=41008 #0xA030 +MATMAP=41472 #0xA200 // This is a header for a new material +MATMAPFILE=41728 #0xA300 // This holds the file name of the texture + +RGB1=17 #0x0011 +RGB2=18 #0x0012 + +OBJECT_MESH=16640 #0x4100 // This lets us know that we are reading a new object + +#------ sub defines of OBJECT_MESH +OBJECT_VERTICES=16656 #0x4110 // The objects vertices +OBJECT_FACES=16672 #0x4120 // The objects faces +OBJECT_MATERIAL=16688 #0x4130 // This is found if the object has a material, either texture map or color +OBJECT_UV=16704 #0x4140 // The UV texture coordinates +OBJECT_TRANS_MATRIX=16736 #0x4160 // The translation matrix of the object 54 bytes + +def point_by_matrix(p, m): + return [p[0] * m[0][0] + p[1] * m[1][0] + p[2] * m[2][0] + m[3][0], + p[0] * m[0][1] + p[1] * m[1][1] + p[2] * m[2][1] + m[3][1], + p[0] * m[0][2] + p[1] * m[1][2] + p[2] * m[2][2] + m[3][2]] + +#the chunk class +class chunk: + ID=0 + size=0 + + def __init__(self): + self.ID=0 + self.size=0 + + def get_size(self): + self.size=6 + + def write(self, file): + binary_format="=15): + result=Blender.Draw.PupMenu("Cannot assign more than 16 materials to a mesh: Continue?%t|OK") + break; + else: + mesh.addMaterial(mat) + material_found=1 + print "found material: ",mat.name + + #figure out what material index this is for the mesh + for mat_counter in range(0,len(mesh.materials)): + if mesh.materials[mat_counter].name==material_name: + mat_index=mat_counter + print "material index: ",mat_index + + #break out of this for loop so we don't accidentally set material_found back to 0 + break + else: + material_found=0 + #print "Not matching: ", mat.name, " and ", material_name + + if(material_found==1): + #read the number of faces using this material + temp_data=file.read(struct.calcsize("H")) + data=struct.unpack("H", temp_data) + new_chunk.bytes_read+=2 + num_faces_using_mat=data[0] + print "number of faces using this material: ", num_faces_using_mat + + #list of faces using mat + for face_counter in range(0,num_faces_using_mat): + temp_data=file.read(struct.calcsize("H")) + new_chunk.bytes_read+=2 + data=struct.unpack("H", temp_data) + #print "face #: ", data[0] + mesh.faces[data[0]].materialIndex=mat_index + + else: + #read past the information about the material you couldn't find + print "Couldn't find material. Reading past face material info" + buffer_size=new_chunk.length-new_chunk.bytes_read + binary_format=str(buffer_size)+"c" + temp_data=file.read(struct.calcsize(binary_format)) + new_chunk.bytes_read+=buffer_size + + print "object mat: bytes read: ", new_chunk.bytes_read + + elif (new_chunk.ID==OBJECT_UV): + print "Found an OBJECT_UV chunk" + print "object uv: lenght: ", new_chunk.length + temp_data=file.read(struct.calcsize("H")) + data=struct.unpack("H", temp_data) + new_chunk.bytes_read+=2 + num_uv=data[0] + print "number of UV: ", num_uv + + for counter in range(0,num_uv): + temp_data=file.read(struct.calcsize("2f")) + new_chunk.bytes_read+=8 #2 float x 4 bytes each + data=struct.unpack("2f", temp_data) + #insert the insert the UV coords in the vertex data + mesh.verts[counter].uvco[0]=data[0] + mesh.verts[counter].uvco[1]=data[1] + #turn on the sticky UV coords for this mesh + mesh.hasVertexUV(1) + print "object uv: bytes read: ", new_chunk.bytes_read + + else: + print "Found some other Object chunk: ",hex(new_chunk.ID) + print "object faces: length: ", new_chunk.length + buffer_size=new_chunk.length-new_chunk.bytes_read + binary_format=str(buffer_size)+"c" + temp_data=file.read(struct.calcsize(binary_format)) + new_chunk.bytes_read+=buffer_size + print "object other: bytes read: ", new_chunk.bytes_read + + previous_chunk.bytes_read+=new_chunk.bytes_read + print "Bytes left in this Object chunk: ", previous_chunk.length-previous_chunk.bytes_read + +def process_next_material_chunk(file, previous_chunk, mat): + new_chunk=chunk() + temp_chunk=chunk() + + while (previous_chunk.bytes_read3): + print "Non-Fatal Error: Version greater than 3, may not load correctly: ", version + + #is it an object info chunk? + elif (new_chunk.ID==OBJECTINFO): + print "found an OBJECTINFO chunk" + print "object info: lenght: ", new_chunk.length + #recursively go through the rest of the file + process_next_chunk(file, new_chunk) + + #keep track of how much we read in the main chunk + new_chunk.bytes_read+=temp_chunk.bytes_read + + #is it an object chunk? + elif (new_chunk.ID==OBJECT): + print "found an OBJECT chunk" + print "object length: ", new_chunk.length + #make a mesh + mesh=NMesh.New() + mesh.name=str(read_string(file)) + print "mesh name: ", mesh.name + #plus one for the null character that gets removed + new_chunk.bytes_read+=(len(mesh.name)+1) + + process_next_object_chunk(file, new_chunk, mesh) + + #put the object into blender at the cursor location + mesh_obj=NMesh.PutRaw(mesh) + cursor_pos=Blender.Window.GetCursorPos() + mesh_obj.setLocation(float(cursor_pos[0]),float(cursor_pos[1]),float(cursor_pos[2])) + + #is it a material chunk? + elif (new_chunk.ID==MATERIAL): + print "found a MATERIAL chunk" + + material=Material.New() + process_next_material_chunk(file, new_chunk, material) + + else: #(new_chunk.ID!=VERSION or new_chunk.ID!=OBJECTINFO or new_chunk.ID!=OBJECT or new_chunk.ID!=MATERIAL): + print "skipping to end of this chunk" + buffer_size=new_chunk.length-new_chunk.bytes_read + binary_format=str(buffer_size)+"c" + temp_data=file.read(struct.calcsize(binary_format)) + new_chunk.bytes_read+=buffer_size + + + #update the previous chunk bytes read + previous_chunk.bytes_read+=new_chunk.bytes_read + print "Bytes left in this chunk: ", previous_chunk.length-previous_chunk.bytes_read + + +def load_3ds (filename): + + current_chunk=chunk() + + file=open(filename,"rb") + + #here we go! + print "reading the first chunk" + read_chunk(file, current_chunk) + if (current_chunk.ID!=PRIMARY): + print "Fatal Error: Not a valid 3ds file: ", filename + Exit() + + process_next_chunk(file, current_chunk) + + file.close() + + +#*********************************************** +# MAIN +#*********************************************** + + +def my_callback(filename): + load_3ds(filename) + +Blender.Window.FileSelector(my_callback, "Import 3DS") diff --git a/sources b/sources index b73a7cc..7277bd3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -834d9236b233951d854b02f7cd3721fb blender-2.31a.tar.bz2 +dad5ac3d415abefad9c52f7b814339d8 blender-2.34.tar.bz2 diff --git a/x-blender.desktop b/x-blender.desktop new file mode 100644 index 0000000..d750c54 --- /dev/null +++ b/x-blender.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Icon=gnome-mime-application-x-blender.png +Type=MimeType +MimeType=application/x-blender +Patterns=*.blend; +Comment=Blender Scene