Arch: Added pref options for window transparency and collada export scaling - fixes #1379
This commit is contained in:
parent
dfe1c84796
commit
5d5ed949c6
|
@ -53,6 +53,8 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name=translate("Ar
|
|||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
_Window(obj)
|
||||
_ViewProviderWindow(obj.ViewObject)
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
obj.ViewObject.Transparency=p.GetInt("WindowTransparency",85)
|
||||
if width:
|
||||
obj.Width = width
|
||||
if height:
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -560,6 +560,26 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Transparency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefSpinBox" name="spinBox">
|
||||
<property name="value">
|
||||
<number>85</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WindowTransparency</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Arch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
|
@ -636,6 +656,11 @@
|
|||
<extends>QPushButton</extends>
|
||||
<header>Gui/Widgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefColorButton</class>
|
||||
<extends>Gui::ColorButton</extends>
|
||||
|
|
|
@ -289,6 +289,45 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Collada export</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Scaling factor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="doubleSpinBox">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.989999999990687</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ColladaScalingFactor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Arch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -84,6 +84,9 @@ def decode(name):
|
|||
def read(filename):
|
||||
global col
|
||||
col = collada.Collada(filename, ignore=[collada.DaeUnsupportedError])
|
||||
# Read the unitmeter info from dae file and compute unit to convert to mm
|
||||
unitmeter = col.assetInfo.unitmeter or 1
|
||||
unit = unitmeter / 0.001
|
||||
for geom in col.scene.objects('geometry'):
|
||||
#for geom in col.geometries:
|
||||
for prim in geom.primitives():
|
||||
|
@ -97,6 +100,7 @@ def read(filename):
|
|||
for tri in tset:
|
||||
face = []
|
||||
for v in tri.vertices:
|
||||
v = [x * unit for x in v]
|
||||
face.append([v[0],v[1],v[2]])
|
||||
meshdata.append(face)
|
||||
#print meshdata
|
||||
|
@ -108,6 +112,8 @@ def read(filename):
|
|||
def export(exportList,filename):
|
||||
"called when freecad exports a file"
|
||||
if not checkCollada(): return
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
scale = p.GetFloat("ColladaScalingFactor",1.0)
|
||||
colmesh = collada.Collada()
|
||||
colmesh.assetInfo.upaxis = collada.asset.UP_AXIS.Z_UP
|
||||
effect = collada.material.Effect("effect0", [], "phong", diffuse=(.7,.7,.7), specular=(1,1,1))
|
||||
|
@ -125,7 +131,7 @@ def export(exportList,filename):
|
|||
findex = []
|
||||
# vertex indices
|
||||
for v in m[0]:
|
||||
vindex.extend([v.x,v.y,v.z])
|
||||
vindex.extend([v.x*scale,v.y*scale,v.z*scale])
|
||||
# normals
|
||||
for f in obj.Shape.Faces:
|
||||
n = f.normalAt(0,0)
|
||||
|
@ -143,7 +149,7 @@ def export(exportList,filename):
|
|||
findex = []
|
||||
# vertex indices
|
||||
for v in m.Topology[0]:
|
||||
vindex.extend([v.x,v.y,v.z])
|
||||
vindex.extend([v.x*scale,v.y*scale,v.z*scale])
|
||||
# normals
|
||||
for f in m.Facets:
|
||||
n = f.Normal
|
||||
|
|
Loading…
Reference in New Issue
Block a user