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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2009-01-11 19:13:00 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2009-01-11 19:13:00 +0300
commit278d6758ea3dc30a54b3f5ee437becca6003667b (patch)
treef45e8ddbea3efcae6e34cba0ea655c2f7d6d9dfb /release/scripts
parentfc12ec23171833d6b8a12f54c5e6148819c3e3b5 (diff)
== Scripts ==
- Scripts Help Browser: Brendon Murphy requested and Kevin Morgan implemented a "run script" button. - AC3D importer: option to store emis color from .ac file in mirror color in Blender (the exporter has the option to export mirror color as emis). Patch by Francesco Brisa. Thanks for the contributions.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/ac3d_import.py30
-rw-r--r--release/scripts/help_browser.py22
2 files changed, 38 insertions, 14 deletions
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py
index 6a2b290e010..2f5512e7150 100644
--- a/release/scripts/ac3d_import.py
+++ b/release/scripts/ac3d_import.py
@@ -10,7 +10,7 @@ Tip: 'Import an AC3D (.ac) file.'
__author__ = "Willian P. Germano"
__url__ = ("blender", "blenderartists.org", "AC3D's homepage, http://www.ac3d.org",
"PLib 3d gaming lib, http://plib.sf.net")
-__version__ = "2.43.1 2007-02-21"
+__version__ = "2.48.1 2009-01-11"
__bpydoc__ = """\
This script imports AC3D models into Blender.
@@ -31,6 +31,7 @@ Known issues:<br>
Config Options:<br>
- display transp (toggle): if "on", objects that have materials with alpha < 1.0 are shown with translucency (transparency) in the 3D View.<br>
- subdiv (toggle): if "on", ac3d objects meant to be subdivided receive a SUBSURF modifier in Blender.<br>
+ - emis as mircol: store the emissive rgb color from AC3D as mirror color in Blender -- this is a hack to preserve the values and be able to export them using the equivalent option in the exporter.<br>
- textures dir (string): if non blank, when imported texture paths are
wrong in the .ac file, Blender will also look for them at this dir.
@@ -50,11 +51,12 @@ users can configure (see config options above).
# --------------------------------------------------------------------------
# Thanks: Melchior Franz for extensive bug testing and reporting, making this
# version cope much better with old or bad .ac files, among other improvements;
-# Stewart Andreason for reporting a serious crash.
+# Stewart Andreason for reporting a serious crash; Francesco Brisa for the
+# emis as mircol functionality (w/ patch).
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
-# Copyright (C) 2004-2007: Willian P. Germano, wgermano _at_ ig.com.br
+# Copyright (C) 2004-2009: Willian P. Germano, wgermano _at_ ig.com.br
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -89,15 +91,19 @@ DISPLAY_TRANSP = True
SUBDIV = True
+EMIS_AS_MIRCOL = False
+
+
tooltips = {
'DISPLAY_TRANSP': 'Turn transparency on in the 3d View for objects using materials with alpha < 1.0.',
'SUBDIV': 'Apply a SUBSURF modifier to objects meant to appear subdivided.',
- 'TEXTURES_DIR': 'Additional folder to look for missing textures.'
+ 'TEXTURES_DIR': 'Additional folder to look for missing textures.',
+ 'EMIS_AS_MIRCOL': 'Store emis color as mirror color in Blender.'
}
def update_registry():
- global TEXTURES_DIR, DISPLAY_TRANSP
- rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV)])
+ global TEXTURES_DIR, DISPLAY_TRANSP, EMIS_AS_MIRCOL
+ rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV), ('EMIS_AS_MIRCOL', EMIS_AS_MIRCOL)])
Registry.SetKey('ac3d_import', rd, True)
rd = Registry.GetKey('ac3d_import', True)
@@ -109,6 +115,7 @@ if rd:
TEXTURES_DIR = rd['TEXTURES_DIR']
DISPLAY_TRANSP = rd['DISPLAY_TRANSP']
SUBDIV = rd['SUBDIV']
+ EMIS_AS_MIRCOL = rd['EMIS_AS_MIRCOL']
except:
update_registry()
else: update_registry()
@@ -299,7 +306,7 @@ class AC3DImport:
lines = self.lines
line = lines[i].split()
mat_name = ''
- mat_col = mat_amb = mat_emit = mat_spec_col = [0,0,0]
+ mat_col = mat_amb = mat_emit = mat_spec_col = mat_mir_col = [0,0,0]
mat_alpha = 1
mat_spec = 1.0
@@ -310,11 +317,15 @@ class AC3DImport:
mat_amb = (v[0]+v[1]+v[2]) / 3.0
v = map(float,[line[11],line[12],line[13]])
mat_emit = (v[0]+v[1]+v[2]) / 3.0
+ if EMIS_AS_MIRCOL:
+ mat_emit = 0
+ mat_mir_col = map(float,[line[11],line[12],line[13]])
+
mat_spec_col = map(float,[line[15],line[16],line[17]])
mat_spec = float(line[19]) / 64.0
mat_alpha = float(line[-1])
mat_alpha = 1 - mat_alpha
- self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_alpha])
+ self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_mir_col, mat_alpha])
i += 1
line = lines[i].split()
@@ -590,7 +601,8 @@ class AC3DImport:
m.emit = mat[3]
m.specCol = (mat[4][0], mat[4][1], mat[4][2])
m.spec = mat[5]
- m.alpha = mat[6]
+ m.mirCol = (mat[6][0], mat[6][1], mat[6][2])
+ m.alpha = mat[7]
if m.alpha < 1.0:
m.mode |= MAT_MODE_ZTRANSP
has_transp_mats = True
diff --git a/release/scripts/help_browser.py b/release/scripts/help_browser.py
index b27e266f368..b5d747ee9c4 100644
--- a/release/scripts/help_browser.py
+++ b/release/scripts/help_browser.py
@@ -8,7 +8,7 @@ Tooltip: 'Show help information about a chosen installed script.'
"""
__author__ = "Willian P. Germano"
-__version__ = "0.1 11/02/04"
+__version__ = "0.2 01/11/09"
__email__ = ('scripts', 'Author, wgermano:ig*com*br')
__url__ = ('blender', 'blenderartists.org')
@@ -47,8 +47,6 @@ Hotkeys:<br>
# $Id$
#
# --------------------------------------------------------------------------
-# sysinfo.py version 0.1 Jun 09, 2004
-# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
@@ -69,6 +67,8 @@ Hotkeys:<br>
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
+# Thanks: Brendon Murphy (suggestion) and Kevin Morgan (implementation)
+# for the "run" button.
import Blender
from Blender import sys as bsys, Draw, Window, Registry
@@ -543,6 +543,7 @@ BEVT_GMENU = range(100, len_gmenus + 100)
BEVT_VIEWSOURCE = 1
BEVT_EXIT = 2
BEVT_BACK = 3
+BEVT_EXEC = 4 # Executes Script
# gui callbacks:
@@ -551,7 +552,7 @@ def gui(): # drawing the screen
global SCREEN, START_SCREEN, SCRIPT_SCREEN
global SCRIPT_INFO, AllGroups, GROUP_MENUS
global BEVT_EMAIL, BEVT_LINK
- global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU
+ global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE
theme = Theme.Get()[0]
@@ -674,8 +675,11 @@ def gui(): # drawing the screen
'View this script\'s source code in the Text Editor (hotkey: S)')
Draw.PushButton('exit', BEVT_EXIT, x + 45, 17, 45, bh,
'Exit from Scripts Help Browser (hotkey: Q)')
- if not FMODE: Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
+ if not FMODE:
+ Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
'Back to scripts selection screen (hotkey: ESC)')
+ Draw.PushButton('run script', BEVT_EXEC, x + 3*45, 17, 60, bh, 'Run this script')
+
BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
BGL.glRasterPos2i(x, 5)
Draw.Text('use the arrow keys or the mouse wheel to scroll text', 'small')
@@ -766,6 +770,14 @@ def button_event(evt): # gui button events
SCRIPT_INFO = None
SCROLL_DOWN = 0
Draw.Redraw()
+ elif evt == BEVT_EXEC: # Execute script
+ exec_line = ''
+ if SCRIPT_INFO.script.userdir:
+ exec_line = bsys.join(Blender.Get('uscriptsdir'), SCRIPT_INFO.script.fname)
+ else:
+ exec_line = bsys.join(Blender.Get('scriptsdir'), SCRIPT_INFO.script.fname)
+
+ Blender.Run(exec_line)
keepon = True
FMODE = False # called by Blender.ShowHelp(name) API function ?