Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
a76fbe55
Commit
a76fbe55
authored
Apr 08, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save cameras/splitter/windows in py recording
parent
fcf9f256
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
158 additions
and
9 deletions
+158
-9
SCHNApps/Plugins/surface_radiance/include/edgeSelectorRadiance.hpp
...Plugins/surface_radiance/include/edgeSelectorRadiance.hpp
+1
-1
SCHNApps/Plugins/surface_radiance/include/halfEdgeSelectorRadiance.hpp
...ins/surface_radiance/include/halfEdgeSelectorRadiance.hpp
+1
-1
SCHNApps/include/camera.h
SCHNApps/include/camera.h
+3
-0
SCHNApps/include/schnapps.h
SCHNApps/include/schnapps.h
+7
-1
SCHNApps/src/camera.cpp
SCHNApps/src/camera.cpp
+29
-0
SCHNApps/src/schnapps.cpp
SCHNApps/src/schnapps.cpp
+115
-6
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+2
-0
No files found.
SCHNApps/Plugins/surface_radiance/include/edgeSelectorRadiance.hpp
View file @
a76fbe55
...
...
@@ -206,7 +206,7 @@ void EdgeSelector_Radiance<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
const
REAL
rad
=
computeRadianceError
(
d
,
newPos
,
newN
,
newRad
);
const
REAL
t
=
0.01
;
const
REAL
t
=
0.01
f
;
const
REAL
err
=
t
*
geom
+
(
1
-
t
)
*
rad
;
// Check if errated values appear
...
...
SCHNApps/Plugins/surface_radiance/include/halfEdgeSelectorRadiance.hpp
View file @
a76fbe55
...
...
@@ -267,7 +267,7 @@ void HalfEdgeSelector_Radiance<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeInfo& h
const
REAL
rad
=
computeRadianceError
(
d
);
const
REAL
t
=
0.01
;
const
REAL
t
=
0.01
f
;
const
REAL
err
=
t
*
geom
+
(
1
-
t
)
*
rad
;
// Check if errated values appear
...
...
SCHNApps/include/camera.h
View file @
a76fbe55
...
...
@@ -50,6 +50,9 @@ public slots:
void
enableViewsBoundingBoxFitting
()
{
b_fitToViewsBoundingBox
=
true
;
}
void
disableViewsBoundingBoxFitting
()
{
b_fitToViewsBoundingBox
=
false
;
}
QString
toString
();
void
fromString
(
QString
cam
);
private:
void
linkView
(
View
*
view
);
void
unlinkView
(
View
*
view
);
...
...
SCHNApps/include/schnapps.h
View file @
a76fbe55
...
...
@@ -56,6 +56,7 @@ public slots:
public:
void
redrawAllViews
();
public
slots
:
View
*
addView
(
const
QString
&
name
);
View
*
addView
();
...
...
@@ -69,6 +70,10 @@ public slots:
void
splitView
(
const
QString
&
name
,
Qt
::
Orientation
orientation
);
QString
saveSplitViewPositions
();
void
restoreSplitViewPositions
(
QString
stringStates
);
/*********************************************************
* MANAGE PLUGINS
*********************************************************/
...
...
@@ -148,6 +153,7 @@ public slots:
QString
saveFileDialog
(
const
QString
&
title
,
const
QString
&
dir
=
QString
(),
const
QString
&
filter
=
QString
());
void
setWindowSize
(
int
w
,
int
h
)
{
this
->
setFixedSize
(
w
,
h
);
}
private
slots
:
void
loadPythonScriptFromFileDialog
();
...
...
@@ -163,7 +169,7 @@ protected:
QString
m_pyBuffer
;
private
slots
:
void
beginP
yRecording
();
void
p
yRecording
();
void
appendPyRecording
();
//void endPyRecording();
...
...
SCHNApps/src/camera.cpp
View file @
a76fbe55
...
...
@@ -121,6 +121,35 @@ void Camera::fitToViewsBoundingBox()
}
}
QString
Camera
::
toString
()
{
QString
res
;
QTextStream
str
(
&
res
);
qglviewer
::
Vec
pos
=
this
->
position
();
qglviewer
::
Quaternion
ori
=
this
->
orientation
();
str
<<
pos
[
0
]
<<
" "
<<
pos
[
1
]
<<
" "
<<
pos
[
2
]
<<
" "
;
str
<<
ori
[
0
]
<<
" "
<<
ori
[
1
]
<<
" "
<<
ori
[
2
]
<<
" "
<<
ori
[
3
];
return
res
;
}
void
Camera
::
fromString
(
QString
cam
)
{
QTextStream
str
(
&
cam
);
qglviewer
::
Vec
pos
=
this
->
position
();
qglviewer
::
Quaternion
ori
=
this
->
orientation
();
str
>>
pos
[
0
];
str
>>
pos
[
1
];
str
>>
pos
[
2
];
str
>>
ori
[
0
];
str
>>
ori
[
1
];
str
>>
ori
[
2
];
str
>>
ori
[
3
];
this
->
setPosition
(
pos
);
this
->
setOrientation
(
ori
);
}
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/src/schnapps.cpp
View file @
a76fbe55
...
...
@@ -11,7 +11,7 @@
#include <QMouseEvent>
#include <QWheelEvent>
#include <QFile>
#include <QByteArray>
#include "mapHandler.h"
#include "schnapps.h"
...
...
@@ -107,7 +107,7 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
connect
(
action_ShowHidePythonDock
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showHidePythonDock
()));
connect
(
action_LoadPythonScript
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadPythonScriptFromFileDialog
()));
connect
(
action_Python_Recording
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
beginP
yRecording
()));
connect
(
action_Python_Recording
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
p
yRecording
()));
connect
(
action_Append_Python_Recording
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
appendPyRecording
()));
action_Python_Recording
->
setShortcut
(
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_P
));
...
...
@@ -320,8 +320,18 @@ void SCHNApps::splitView(const QString& name, Qt::Orientation orientation)
m_rootSplitter
->
setOrientation
(
orientation
);
b_rootSplitterInitialized
=
true
;
}
if
(
parent
->
orientation
()
==
orientation
)
parent
->
insertWidget
(
parent
->
indexOf
(
view
)
+
1
,
newView
);
if
(
parent
->
orientation
()
==
orientation
)
{
parent
->
insertWidget
(
parent
->
indexOf
(
view
)
+
1
,
newView
);
QList
<
int
>
sz
=
parent
->
sizes
();
int
tot
=
0
;
for
(
int
i
=
0
;
i
<
parent
->
count
();
++
i
)
tot
+=
sz
[
i
];
sz
[
0
]
=
tot
/
parent
->
count
()
+
tot
%
parent
->
count
();
for
(
int
i
=
1
;
i
<
parent
->
count
();
++
i
)
sz
[
i
]
=
tot
/
parent
->
count
();
parent
->
setSizes
(
sz
);
}
else
{
int
idx
=
parent
->
indexOf
(
view
);
...
...
@@ -330,10 +340,82 @@ void SCHNApps::splitView(const QString& name, Qt::Orientation orientation)
spl
->
addWidget
(
view
);
spl
->
addWidget
(
newView
);
parent
->
insertWidget
(
idx
,
spl
);
QList
<
int
>
sz
=
spl
->
sizes
();
int
tot
=
sz
[
0
]
+
sz
[
1
];
sz
[
0
]
=
tot
/
2
;
sz
[
1
]
=
tot
-
sz
[
0
];
spl
->
setSizes
(
sz
);
}
}
QString
SCHNApps
::
saveSplitViewPositions
()
{
QList
<
QSplitter
*>
liste
;
liste
.
push_back
(
m_rootSplitter
);
QString
result
;
QTextStream
qts
(
&
result
);
while
(
!
liste
.
empty
())
{
QSplitter
*
spl
=
liste
.
first
();
for
(
int
i
=
0
;
i
<
spl
->
count
();
++
i
)
{
QWidget
*
w
=
spl
->
widget
(
i
);
QSplitter
*
qw
=
dynamic_cast
<
QSplitter
*>
(
w
);
if
(
qw
!=
NULL
)
liste
.
push_back
(
qw
);
}
QByteArray
ba
=
spl
->
saveState
();
qts
<<
ba
.
count
()
<<
" "
;
for
(
int
j
=
0
;
j
<
ba
.
count
();
++
j
)
qts
<<
int
(
ba
[
j
])
<<
" "
;
//qts << endl;
liste
.
pop_front
();
}
return
result
;
}
void
SCHNApps
::
restoreSplitViewPositions
(
QString
stringStates
)
{
QList
<
QSplitter
*>
liste
;
liste
.
push_back
(
m_rootSplitter
);
QTextStream
qts
(
&
stringStates
);
while
(
!
liste
.
empty
())
{
QSplitter
*
spl
=
liste
.
first
();
for
(
int
i
=
0
;
i
<
spl
->
count
();
++
i
)
{
QWidget
*
w
=
spl
->
widget
(
i
);
QSplitter
*
qw
=
dynamic_cast
<
QSplitter
*>
(
w
);
if
(
qw
!=
NULL
)
liste
.
push_back
(
qw
);
}
if
(
qts
.
atEnd
())
{
std
::
cerr
<<
"Problem restoring view split configuration"
<<
std
::
endl
;
return
;
}
int
nb
;
qts
>>
nb
;
QByteArray
ba
(
nb
+
1
,
0
);
for
(
int
j
=
0
;
j
<
nb
;
++
j
)
{
int
v
;
qts
>>
v
;
ba
[
j
]
=
char
(
v
);
}
spl
->
restoreState
(
ba
);
liste
.
pop_front
();
}
}
/*********************************************************
* MANAGE PLUGINS
*********************************************************/
...
...
@@ -920,7 +1002,7 @@ void SCHNApps::loadPythonScriptFromFileDialog()
}
void
SCHNApps
::
beginP
yRecording
()
void
SCHNApps
::
p
yRecording
()
{
if
(
m_pyRecording
!=
NULL
)
// WRITE & CLOSE
{
...
...
@@ -929,7 +1011,21 @@ void SCHNApps::beginPyRecording()
{
m_pyBuffer
.
replace
(
"
\"
"
+
var
+
"
\"
"
,
var
+
".getName()"
);
}
out
<<
m_pyBuffer
<<
endl
;
// split view positions
out
<<
"schnapps.restoreSplitViewPositions(
\"
"
<<
saveSplitViewPositions
()
<<
"
\"
)"
<<
endl
;
// cameras
foreach
(
Camera
*
cam
,
m_cameras
)
{
out
<<
"schnapps.getCamera(
\"
"
<<
cam
->
getName
()
<<
"
\"
).fromString(
\"
"
<<
cam
->
toString
()
<<
"
\"
)"
<<
endl
;
}
//windows
out
<<
"schnapps.setWindowSize("
<<
this
->
width
()
<<
", "
<<
this
->
height
()
<<
")"
<<
endl
;
m_pyRecFile
->
close
();
delete
m_pyRecording
;
...
...
@@ -981,6 +1077,19 @@ void SCHNApps::appendPyRecording()
m_pyBuffer
.
replace
(
"
\"
"
+
var
+
"
\"
"
,
var
+
".getName()"
);
}
out
<<
m_pyBuffer
<<
endl
;
// split view positions
out
<<
"schnapps.restoreSplitViewPositions(
\"
"
<<
saveSplitViewPositions
()
<<
"
\"
)"
<<
endl
;
// cameras
foreach
(
Camera
*
cam
,
m_cameras
)
{
out
<<
"schnapps.getCamera(
\"
"
<<
cam
->
getName
()
<<
"
\"
).fromString(
\"
"
<<
cam
->
toString
()
<<
"
\"
)"
<<
endl
;
}
//windows
out
<<
"schnapps.setWindowSize("
<<
this
->
width
()
<<
", "
<<
this
->
height
()
<<
")"
<<
endl
;
m_pyRecFile
->
close
();
delete
m_pyRecording
;
...
...
SCHNApps/src/view.cpp
View file @
a76fbe55
...
...
@@ -168,6 +168,8 @@ bool View::usesCamera(const QString& name) const
return
usesCamera
(
c
);
}
void
View
::
linkPlugin
(
PluginInteraction
*
plugin
)
{
// RECORDING
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment