[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita/ui/tool
From:       Lukáš Tvrdý <lukast.dev () gmail ! com>
Date:       2009-08-21 22:45:07
Message-ID: 1250894707.403929.22187.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1014220 by lukast:

Fixing the 3D brush: Notify freehand that the brush model has to be changed.

 M  +20 -5     kis_tool_freehand.cc  
 M  +1 -1      kis_tool_freehand.h  


--- trunk/koffice/krita/ui/tool/kis_tool_freehand.cc #1014219:1014220
@@ -130,6 +130,7 @@
         }
     }
 
+
     if (e->button() == Qt::LeftButton) {
         initPaint(e);
         m_previousPaintInformation = \
KisPaintInformation(convertToPixelCoord(adjustPosition(e->point)), @@ -504,6 +505,13 \
@@  sx /= currentImage()->xRes();
             sy /= currentImage()->yRes();
 
+            // check if the paintop has been changed
+            // TODO: maybe find a better way -- signal from paintop to ui/freehand \
that paintop has been changed +            if ( \
m_brushModelName.compare(currentPaintOpPreset()->settings()->modelName()) != 0){ +    \
glDeleteLists( m_displayList,1 ); +                m_displayList = 0;
+            }
+            
             if (glIsList( m_displayList )){
                 kDebug() << "I have list to draw!";
                 QPointF pos = converter.documentToView( mousePos );
@@ -563,13 +571,20 @@
             m_prevyTilt = m_yTilt;
             
             }else{
-                kDebug() << "_No_ list to draw!";
-                QString fileName = currentPaintOpPreset()->settings()->modelName();
+                kDebug() << "Default model will be used";
+                Kis3DObjectModel * model;
+                m_brushModelName = currentPaintOpPreset()->settings()->modelName();
 
                 // here is the default 3d model filename for brushes
-                if ( fileName.isEmpty() ) fileName = "3d-deform-brush";
-                Kis3DObjectModel model(fileName + ".obj" ,fileName + ".mtl");
-                m_displayList = model.displayList();
+                if ( m_brushModelName.isEmpty() ) {
+                    model = new Kis3DObjectModel("3d-deform-brush.obj" \
,"3d-deform-brush.mtl"); +                    kDebug() << "isEmpty()";
+                }else{
+                    model = new Kis3DObjectModel(m_brushModelName + ".obj" \
,m_brushModelName + ".mtl"); +                }
+                m_displayList = model->displayList();
+                delete model;
+                
             }
         }
     }
--- trunk/koffice/krita/ui/tool/kis_tool_freehand.h #1014219:1014220
@@ -127,7 +127,7 @@
     qreal m_prevyTilt;
 
     GLuint m_displayList;
-    
+    QString m_brushModelName;
 #endif
 
     QPointF mousePos;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic