Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
Plugin-TextureControl
Commits
d49f3439
Commit
d49f3439
authored
Jun 05, 2018
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added functions to add textures without file backing
parent
1ee8789a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
12 deletions
+43
-12
TextureControl.cc
TextureControl.cc
+30
-9
TextureControl.hh
TextureControl.hh
+10
-3
TextureData.hh
TextureData.hh
+3
-0
No files found.
TextureControl.cc
View file @
d49f3439
...
...
@@ -69,7 +69,7 @@ contextMenu_(0)
}
void
TextureControlPlugin
::
slotTextureAdded
(
QString
_textureName
,
QString
_file
n
ame
,
uint
_dimension
,
int
_id
)
void
TextureControlPlugin
::
slotTextureAdded
(
QString
_textureName
,
QString
_file
N
ame
,
QImage
_image
,
uint
_dimension
,
int
_id
)
{
// Get the new object
BaseObjectData
*
obj
;
...
...
@@ -95,7 +95,11 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
// ================================================================================
// Add Image to the image store and set the index in the texture description
int
newId
=
imageStore
().
addImageFile
(
_filename
);
int
newId
;
if
(
_fileName
.
isEmpty
())
newId
=
imageStore
().
addImage
(
_image
);
else
newId
=
imageStore
().
addImageFile
(
_fileName
);
if
(
newId
==
-
1
)
{
emit
log
(
LOGERR
,
imageStore
().
error
());
...
...
@@ -137,7 +141,10 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
return
;
}
texData
->
addTexture
(
_textureName
,
_filename
,
_dimension
,
glName
);
if
(
_fileName
.
isEmpty
())
texData
->
addTexture
(
_textureName
,
_dimension
,
glName
);
else
texData
->
addTexture
(
_textureName
,
_fileName
,
_dimension
,
glName
);
// Remember id in texture descriptor
texData
->
setImage
(
_textureName
,
newId
);
...
...
@@ -145,14 +152,21 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
texData
->
texture
(
_textureName
).
disable
();
}
void
TextureControlPlugin
::
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
)
void
TextureControlPlugin
::
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
QImage
_image
,
uint
_dimension
)
{
// Add this texture to the list of global textures
if
(
!
globalTextures_
.
textureExists
(
_textureName
)
)
{
globalTextures_
.
addTexture
(
_textureName
,
_filename
,
_dimension
,
0
);
if
(
_filename
.
isEmpty
())
globalTextures_
.
addTexture
(
_textureName
,
_dimension
,
0
);
else
globalTextures_
.
addTexture
(
_textureName
,
_filename
,
_dimension
,
0
);
globalTextures_
.
texture
(
_textureName
).
disable
();
int
newImageId
=
imageStore
().
addImageFile
(
_filename
);
int
newImageId
;
if
(
_filename
.
isEmpty
())
newImageId
=
imageStore
().
addImage
(
_image
);
else
newImageId
=
imageStore
().
addImageFile
(
_filename
);
if
(
newImageId
==
-
1
)
{
emit
log
(
LOGERR
,
imageStore
().
error
());
...
...
@@ -177,7 +191,7 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
}
void
TextureControlPlugin
::
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QString
_filename
,
int
_id
,
int
&
_textureId
)
{
void
TextureControlPlugin
::
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QString
_filename
,
QImage
_image
,
int
_id
,
int
&
_textureId
)
{
// Get the new object
BaseObjectData
*
obj
;
if
(
!
PluginFunctions
::
getObject
(
_id
,
obj
)
)
{
...
...
@@ -201,7 +215,10 @@ void TextureControlPlugin::slotMultiTextureAdded( QString _textureGroup , QStrin
texData
->
addMultiTexture
(
_textureGroup
);
// Add the texture
slotTextureAdded
(
_name
,
_filename
,
2
,
_id
);
if
(
_filename
.
isEmpty
())
slotTextureAdded
(
_name
,
_image
,
2
,
_id
);
else
slotTextureAdded
(
_name
,
_filename
,
2
,
_id
);
// Get the id of the new texture
_textureId
=
texData
->
texture
(
_name
).
id
();
...
...
@@ -210,7 +227,11 @@ void TextureControlPlugin::slotMultiTextureAdded( QString _textureGroup , QStrin
texData
->
texture
(
_name
).
hidden
(
true
);
// Add to image store
int
newImageId
=
imageStore
().
addImageFile
(
_filename
);
int
newImageId
;
if
(
_filename
.
isEmpty
())
newImageId
=
imageStore
().
addImage
(
_image
);
else
newImageId
=
imageStore
().
addImageFile
(
_filename
);
if
(
newImageId
==
-
1
)
{
emit
log
(
LOGERR
,
imageStore
().
error
());
...
...
TextureControl.hh
View file @
d49f3439
...
...
@@ -128,9 +128,12 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
// TextureInterface
void
slotUpdateAllTextures
(
);
void
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
,
int
_id
);
void
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
);
void
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QString
_filename
,
int
_id
,
int
&
_textureId
);
void
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
,
int
_id
){
slotTextureAdded
(
_textureName
,
_filename
,
QImage
()
,
_dimension
,
_id
);}
void
slotTextureAdded
(
QString
_textureName
,
QImage
_image
,
uint
_dimension
,
int
_id
){
slotTextureAdded
(
_textureName
,
QString
()
,
_image
,
_dimension
,
_id
);}
void
slotTextureAdded
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
){
slotTextureAdded
(
_textureName
,
_filename
,
QImage
()
,
_dimension
);}
void
slotTextureAdded
(
QString
_textureName
,
QImage
_image
,
uint
_dimension
){
slotTextureAdded
(
_textureName
,
QString
()
,
_image
,
_dimension
);}
void
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QString
_filename
,
int
_id
,
int
&
_textureId
){
slotMultiTextureAdded
(
_textureGroup
,
_name
,
_filename
,
QImage
()
,
_id
,
_textureId
);}
void
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QImage
_image
,
int
_id
,
int
&
_textureId
){
slotMultiTextureAdded
(
_textureGroup
,
_name
,
QString
()
,
_image
,
_id
,
_textureId
);}
void
slotTextureUpdated
(
QString
_textureName
,
int
_identifier
);
void
slotSetTextureMode
(
QString
_textureName
,
QString
_mode
,
int
_id
);
void
slotSetTextureMode
(
QString
_textureName
,
QString
_mode
);
...
...
@@ -177,6 +180,10 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
private
:
void
slotTextureAdded
(
QString
_textureName
,
QString
_fileName
,
QImage
_image
,
uint
_dimension
,
int
_id
);
void
slotTextureAdded
(
QString
_textureName
,
QString
_fileName
,
QImage
_image
,
uint
_dimension
);
void
slotMultiTextureAdded
(
QString
_textureGroup
,
QString
_name
,
QString
_fileName
,
QImage
_image
,
int
_id
,
int
&
_textureId
);
bool
StringToBool
(
QString
_value
);
/// Checks for a correct drawmode and changes if necessary
...
...
TextureData.hh
View file @
d49f3439
...
...
@@ -226,6 +226,9 @@ class TextureData : public PerObjectData
/// Disable a given texture
void
disableTexture
(
QString
_textureName
);
/// Add a Texture without file backing
int
addTexture
(
QString
_textureName
,
uint
_dimension
,
GLuint
_glName
){
return
addTexture
(
_textureName
,
QString
(
"Invalid"
)
,
_dimension
,
_glName
);}
/// Add a Texture
int
addTexture
(
QString
_textureName
,
QString
_filename
,
uint
_dimension
,
GLuint
_glName
);
...
...
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