Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Raybaud <mauriceraybaud@hotmail.fr>2017-01-29 23:28:41 +0300
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2017-01-29 23:28:41 +0300
commit6f40579d5bd29e235b8aa372297de5eabf23aab7 (patch)
treeaf9e95de45d0feb630600712e111ef8e2a9351fc /render_povray/primitives.py
parentbafb8d353d64aa62be4dfeb1892aab4e2625053d (diff)
Added Basic Nodes support by Lanuhum
Diffstat (limited to 'render_povray/primitives.py')
-rw-r--r--render_povray/primitives.py84
1 files changed, 35 insertions, 49 deletions
diff --git a/render_povray/primitives.py b/render_povray/primitives.py
index c7fd6999..f053f29f 100644
--- a/render_povray/primitives.py
+++ b/render_povray/primitives.py
@@ -1,6 +1,27 @@
+# ##### 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 #####
+
+# <pep8 compliant>
+
############ To get POV-Ray specific objects In and Out of Blender ###########
import bpy
+import os.path
from bpy_extras.io_utils import ImportHelper
from bpy_extras import object_utils
from math import atan, pi, degrees, sqrt, cos, sin
@@ -1505,36 +1526,8 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
#filepov = bpy.path.abspath(self.filepath) #was used for single files
def mat_search(cache):
- r = g = b = 0.5
- f = t = 0
- color = None
-
- for item, value in enumerate(cache):
-
- if value == 'texture':
- pass
-
- if value == 'pigment':
-
- if cache[item+2] in {'rgb','srgb'}:
- pass
-
- elif cache[item+2] in {'rgbf','srgbf'}:
- pass
-
- elif cache[item+2] in {'rgbt','srgbt'}:
- try:
- r,g,b,t = float(cache[item+3]),float(cache[item+4]),float(cache[item+5]),float(cache[item+6])
- except:
- r = g = b = t = float(cache[item+2])
- color = (r,g,b,t)
-
- elif cache[item+2] in {'rgbft','srgbft'}:
- pass
-
- else:
- pass
-
+ r,g,b,t = float(cache[-5]),float(cache[-4]),float(cache[-3]),float(cache[-2])
+ color = (r,g,b,t)
if colors == [] or (colors != [] and color not in colors):
colors.append(color)
name = ob.name+"_mat"
@@ -1542,11 +1535,13 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
mat = bpy.data.materials.new(name)
mat.diffuse_color = (r,g,b)
mat.alpha = 1-t
+ if mat.alpha != 1:
+ mat.use_transparency=True
ob.data.materials.append(mat)
-
+ print (colors)
else:
- for i, value in enumerate(colors):
- if color == value:
+ for i in range(len(colors)):
+ if color == colors[i]:
ob.data.materials.append(bpy.data.materials[matNames[i]])
for file in self.files:
print ("Importing file: "+ file.name)
@@ -1693,36 +1688,27 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
pass
cache = []
cylinder_search = False
-
-
-
-
if word == 'sphere':
sphere_search = True
name_search = False
if sphere_search:
cache.append(word)
if cache[-1] == '}':
- x = y = z = r = 0
try:
x = float(cache[2])
y = float(cache[3])
z = float(cache[4])
r = float(cache[5])
+ bpy.ops.pov.addsphere(R=r, imported_loc=(x, y, z))
+ ob = context.object
+ ob.location = (x,y,z)
+ #ob.scale = (r,r,r)
+ mat_search(cache)
except (ValueError):
pass
- except:
- x = y = z = float(cache[2])
- r = float(cache[3])
- bpy.ops.pov.addsphere(R=r, imported_loc=(x, y, z))
- ob = context.object
- ob.location = (x,y,z)
- ob.scale = (r,r,r)
- mat_search(cache)
cache = []
- sphere_search = False
-
-##################End Primitives Import##################
+ sphere_search = False
+ ##################End Primitives Import##################
if word == '#declare':
name_search = True
if name_search: