Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-viewer-corba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
gepetto-viewer-corba
Commits
97c4387b
Commit
97c4387b
authored
8 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add plugin to export datas to blender.
parent
21fe9bc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyplugins/gepetto/gui/blenderexport.py
+98
-0
98 additions, 0 deletions
pyplugins/gepetto/gui/blenderexport.py
with
98 additions
and
0 deletions
pyplugins/gepetto/gui/blenderexport.py
0 → 100644
+
98
−
0
View file @
97c4387b
from
PythonQt
import
QtGui
,
Qt
from
gepetto.corbaserver
import
Client
def
separator
():
line
=
QtGui
.
QFrame
()
line
.
frameShape
=
QtGui
.
QFrame
.
HLine
line
.
frameShadow
=
QtGui
.
QFrame
.
Sunken
return
line
### This class represents one special tab of the new QDockWidget
class
_Widget
(
QtGui
.
QWidget
):
def
__init__
(
self
,
parent
,
plugin
):
super
(
_Widget
,
self
).
__init__
(
parent
)
self
.
plugin
=
plugin
self
.
bodies
=
[]
self
.
makeWidget
()
def
makeWidget
(
self
):
box
=
QtGui
.
QVBoxLayout
(
self
)
box
.
addWidget
(
self
.
bindFunctionToButton
(
"
Get selected bodies
"
,
self
.
updateBodyList
))
box
.
addWidget
(
QtGui
.
QLabel
(
"
Current selected bodies:
"
))
self
.
bodyList
=
QtGui
.
QListWidget
()
self
.
bodyList
box
.
addWidget
(
self
.
bodyList
)
box
.
addWidget
(
separator
())
box
.
addWidget
(
self
.
bindFunctionToButton
(
"
Export model
"
,
self
.
exportModel
))
box
.
addWidget
(
separator
())
self
.
transformFrame
=
QtGui
.
QLabel
(
"
output.yaml
"
)
box
.
addWidget
(
self
.
addWidgetsInHBox
(
[
self
.
transformFrame
,
self
.
bindFunctionToButton
(
"
Select transform file
"
,
self
.
changeTransformFile
)
]))
box
.
addWidget
(
separator
())
onRefresh
=
self
.
bindFunctionToButton
(
"
Automatic export
"
,
self
.
setOnRefresh
)
onRefresh
.
checkable
=
True
box
.
addWidget
(
onRefresh
)
box
.
addWidget
(
self
.
bindFunctionToButton
(
"
Write current frame
"
,
self
.
writeCurrentFrame
))
def
updateBodyList
(
self
):
self
.
bodies
=
[
str
(
b
.
text
())
for
b
in
self
.
plugin
.
main
.
bodyTree
().
selectedBodies
()
]
self
.
bodyList
.
clear
()
for
b
in
self
.
bodies
:
self
.
bodyList
.
addItem
(
b
)
def
exportModel
(
self
):
fn
=
QtGui
.
QFileDialog
.
getSaveFileName
()
self
.
plugin
.
gui
.
writeBlenderScript
(
str
(
fn
),
self
.
bodies
)
def
changeTransformFile
(
self
):
fn
=
QtGui
.
QFileDialog
.
getSaveFileName
()
self
.
transformFrame
.
text
=
fn
self
.
plugin
.
gui
.
setCaptureTransform
(
str
(
fn
),
self
.
bodies
)
def
writeCurrentFrame
(
self
):
self
.
plugin
.
gui
.
captureTransform
()
def
setOnRefresh
(
self
,
checked
):
self
.
plugin
.
gui
.
captureTransformOnRefresh
(
checked
)
def
addWidgetsInHBox
(
self
,
widgets
):
nameParentW
=
QtGui
.
QWidget
(
self
)
hboxName
=
QtGui
.
QHBoxLayout
(
nameParentW
)
for
w
in
widgets
:
hboxName
.
addWidget
(
w
)
return
nameParentW
def
bindFunctionToButton
(
self
,
buttonLabel
,
func
):
button
=
QtGui
.
QPushButton
(
self
)
button
.
text
=
buttonLabel
button
.
connect
(
'
clicked(bool)
'
,
func
)
return
button
class
Plugin
(
QtGui
.
QDockWidget
):
"""
Blender export helper plugin
"""
def
__init__
(
self
,
mainWindow
,
flags
=
None
):
if
flags
is
None
:
super
(
Plugin
,
self
).
__init__
(
"
Blender export plugin
"
,
mainWindow
)
else
:
super
(
Plugin
,
self
).
__init__
(
"
Blender export plugin
"
,
mainWindow
,
flags
)
self
.
resetConnection
()
# Initialize the widget
mainWidget
=
_Widget
(
self
,
self
)
self
.
setWidget
(
mainWidget
)
self
.
main
=
mainWindow
def
resetConnection
(
self
):
self
.
client
=
Client
()
self
.
gui
=
self
.
client
.
gui
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment