← Back to team overview

linux-traipu team mailing list archive

[Bug 1790203] Re: Title 3d picture_frames_4.xml broken to open files images

 

I think is the last patch :-)

I test all cases :

	<param name="project_files1" type="picture" title="Picture 1 Path" description="">
        <values>
            <value name="" num=""/>
        </values>
        <default>/good_path/filegood.png</default>
    </param>
	
    <param name="project_files2" type="picture" title="Picture 2 Path" description="">
        <values>
            <value name="" num=""/>
        </values>
        <default>/good_path/badfile.png</default>
	</param>
	
    <param name="project_files3" type="picture" title="Picture 3 Path" description="">
        <values>
            <value name="/good_path/bidon.png" num="0"/>
            <value name="bad_relative_path/filegood.png" num="1"/>
            <value name="filegood.png" num="2"/>
            <value name="/good_path/filegood.png" num="3"/>
            <value name="/good_path/badfile.png" num="4"/>
        </values>
        <default></default>
	</param>
	
    <param name="project_files4" type="picture" title="Picture 4 Path" description="">
        <values>
            <value name="/good_path/badfile.png" num="0"/>
            <value name="bad_relative_path/filegood.png" num="1"/>
            <value name="filegood.png" num="2"/>
            <value name="/filegood.png" num="3"/>
            <value name="/good_path/badfile.png" num="4"/>
        </values>
        <default></default>
    </param>
    
    <param name="project_files5" type="picture" title="Picture 5 Path" description="">
        <values>
            <value name="good_relative_path/filegood.png" num="0"/>
        </values>
        <default>/good_path/badfile.png</default>
    </param>
    
    <param name="project_files6" type="picture" title="Picture 6 Path" description="">
        <values>
            <value name="good_relative_path/badfile.png" num="0"/>
        </values>
        <default>/good_path/badfile.png</default>
    </param>
    
    <param name="project_files7" type="picture" title="Picture 7 Path" description="">
        <values>
            <value name="" num=""/>
        </values>
        <default></default>
    </param>
    


** Patch added: "Patch for file for blender_listview.py"
   https://bugs.launchpad.net/openshot/+bug/1790203/+attachment/5183406/+files/blender_listview.patch

** Patch removed: "Patch for file for blender_listview.py"
   https://bugs.launchpad.net/openshot/+bug/1790203/+attachment/5183149/+files/blender_listview.patch

-- 
You received this bug notification because you are a member of UBUNTU -
AL - BR, which is subscribed to OpenShot Video Editor.
https://bugs.launchpad.net/bugs/1790203

Title:
  Title 3d picture_frames_4.xml broken to open files images

Status in OpenShot Video Editor:
  New

Bug description:
  Architecture : x86_64
  model name : Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
  Operating System & version: Linux 4.17.17-1-MANJARO #1 SMP PREEMPT Sat Aug 18 14:38:10 UTC 2018 GNU/Linux
  Installation Method : pacman/yaourt
  Version of Openshot installed : 2.4.2
  MLT/melt version : 6.10.0
  FFmpeg (i.e.libavcodec) version : n4.0.2
  built with gcc 8.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil 56. 14.100 / 56. 14.100
  libavcodec 58. 18.100 / 58. 18.100
  libavformat 58. 12.100 / 58. 12.100
  libavdevice 58. 3.100 / 58. 3.100
  libavfilter 7. 16.100 / 7. 16.100
  libavresample 4. 0. 0 / 4. 0. 0
  libswscale 5. 1.100 / 5. 1.100
  libswresample 3. 1.100 / 3. 1.100
  libpostproc 55. 1.100 / 55. 1.100
  Blender version : 2.79 (sub 0)

  When i whant use title 3d blender_listview_new.py for generate slide
  of pictures i can't load pictures.

  I revolve problem with changing code from openshot interface file
  openshot_qt/windows/views/blender_listview_new.py.

  I had function xml picture for use like this :
  file picture_frames_4.xml ->

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <!DOCTYPE openshot-effect>
  <effect>
  	<title translatable="True">Picture Frames (4 pictures)</title>
  	<description translatable="True">Picture Frames (4 pictures)</description>
  	<icon>picture_frames_4.png</icon>
  	<category>Video</category>
  	<service>picture_frames_4.blend</service>
  	
  	<param name="file_name" type="text" title="File Name" description="">
  		<default>TitleFileName</default>
  	</param>
  	
  	<param name="project_files1" type="picture" title="Picture 1 Path" description="">
  		<values>
              <value name="/Bad_Path_File/goodpicture.png" num="0"/>
              <value name="/Good_Path_File/badpicture.png" num="1"/>
              <value name="goodpicture.png" num="2"/>
              <value name="/Good_Path_File/goodpicture.png" num="3"/>
              <value name="/Good_Path_File/badpicture.png" num="4"/>
          </values>
          <default></default>
  	</param>
  	
      <param name="project_files2" type="picture" title="Picture 2 Path" description="">
  		<values>
  			<value name="" num=""/>
  		</values>
          <default>/Good_Path_File/goodpicture.png</default>
  	</param>
  	
      <param name="project_files3" type="picture" title="Picture 3 Path" description="">
  		<values>
  			<value name="" num=""/>
  		</values>
  		<default></default>
  	</param>
  	
      <param name="project_files4" type="picture" title="Picture 4 Path" description="">
  		<values>
  			<value name="" num=""/>
  		</values>
  		<default></default>
  	</param>
  	
  	<param name="start_frame" type="spinner" title="Start Frame" description="">
  		<min>1</min>
  		<max>1</max>
  		<default>1</default>
  	</param>
  	
  	<param name="end_frame" type="spinner" title="End Frame" description="">
  		<min>230</min>
  		<max>230</max>
  		<default>230</default>
  	</param>

  	<!-- SPEED -->
  	<param name="animation_speed" type="dropdown" title="Animation Length" description="">
  		<values>
  			<value name="Default" num="1"/>
  			<value name="2X" num="2"/>
  			<value name="3X" num="3"/>
  			<value name="4X" num="4"/>
  			<value name="5X" num="5"/>
  		</values>
  		<default>1</default>
  	</param>
  </effect>

  file picture_frames_4.py
  #	OpenShot Video Editor is a program that creates, modifies, and edits video files.
  #   Copyright (C) 2009  Jonathan Thomas
  #
  #	This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
  #
  #	OpenShot Video Editor is free software: you can redistribute it and/or modify
  #	it under the terms of the GNU General Public License as published by
  #	the Free Software Foundation, either version 3 of the License, or
  #	(at your option) any later version.
  #
  #	OpenShot Video Editor is distributed in the hope that it will be useful,
  #	but WITHOUT ANY WARRANTY; without even the implied warranty of
  #	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #	GNU General Public License for more details.
  #
  #	You should have received a copy of the GNU General Public License
  #	along with OpenShot Video Editor.  If not, see <http://www.gnu.org/licenses/>.

  
  # Import Blender's python API.  This only works when the script is being
  # run from the context of Blender.  Blender contains it's own version of Python
  # with this library pre-installed.
  import bpy, os, sys
  directory = os.path.dirname(bpy.data.filepath)[:-5] + 'scripts/openshot'
  if not directory in sys.path:
      sys.path.append(directory)
  from debug import print_error
  from math import pi, radians
  from PIL import Image

  # Debug Info:
  # ./blender -b test.blend -P demo.py
  # -b = background mode
  # -P = run a Python script within the context of the project file

  # Init all of the variables needed by this script.  Because Blender executes
  # this script, OpenShot will inject a dictionary of the required parameters
  # before this script is executed.
  params = {		
              'title' : 'Oh Yeah! OpenShot!',
              'extrude' : 0.1,
              'bevel_depth' : 0.02,
              'spacemode' : 'CENTER',
              'text_size' : 1.5,
              'width' : 1.0,
              'fontname' : 'Bfont',
              
              'color' : [0.8,0.8,0.8],
              'alpha' : 1.0,
              
              'output_path' : '/tmp/',
              'fps' : 24,
              'quality' : 90,
              'file_format' : 'PNG',
              'color_mode' : 'RGBA',
              'horizon_color' : [0.57, 0.57, 0.57],
              'resolution_x' : 1920,
              'resolution_y' : 1080,
              'resolution_percentage' : 100,
              'start_frame' : 20,
              'end_frame' : 25,
              'animation' : True,
          }

  def get_scale_values(filepath):
      """ Calculate the correct scale parameters to display an image with the 
      correct height / width ratio in Blender. """
      try :
          img = Image.open(filepath)
      except Exception as E:
          raise ValueError(E)
      img_width, img_height = img.size
      height_ratio = 1.0
      width_ratio = float(img_width) / float(img_height)
      return (height_ratio, width_ratio)

  
  #INJECT_PARAMS_HERE

  # The remainder of this script will modify the current Blender .blend project
  # file, and adjust the settings.  The .blend file is specified in the XML file
  # that defines this template in OpenShot.
  #----------------------------------------------------------------------------

  try:
      # debug
      #print(str(params), file=open("debug.txt", "a"))
      # Split the picture information
      picture1 = params["project_files1"]
      if len(picture1) > 1:
          picture1_scale = get_scale_values(picture1)
      
      picture2 = params["project_files2"]
      if len(picture2) > 1:
          picture2_scale = get_scale_values(picture1)
      
      picture3 = params["project_files3"]
      if len(picture3) > 1:
          picture3_scale = get_scale_values(picture1)
      
      picture4 = params["project_files4"]
      if len(picture4) > 1:
          picture4_scale = get_scale_values(picture1)
      # Modify picture paths
      if len(picture1) > 1:
          bpy.data.objects["Plane.001"].scale.y = picture1_scale[0]
          bpy.data.objects["Plane.001"].scale.x = picture1_scale[1]
          
          if picture1[3] == "image":
              bpy.data.textures["Texture.002"].image.source = 'FILE'
              bpy.data.textures["Texture.002"].image.filepath = picture1
          else:
              bpy.data.textures["Texture.002"].image.source = 'MOVIE'
              bpy.data.textures["Texture.002"].image.filepath = picture1
              bpy.data.textures["Texture.002"].image_user.use_cyclic = True
              bpy.data.textures["Texture.002"].image_user.frame_duration = 230.0
      
      if len(picture2) > 1:
          bpy.data.objects["Plane.002"].scale.y = picture2_scale[0]
          bpy.data.objects["Plane.002"].scale.x = picture2_scale[1]
          
          if picture2[3] == "image":
              bpy.data.textures["Texture.003"].image.source = 'FILE'
              bpy.data.textures["Texture.003"].image.filepath = picture2
          else:
              bpy.data.textures["Texture.003"].image.source = 'MOVIE'
              bpy.data.textures["Texture.003"].image.filepath = picture2
              bpy.data.textures["Texture.003"].image_user.use_cyclic = True
              bpy.data.textures["Texture.003"].image_user.frame_duration = 230.0
      
      
      if len(picture3) > 1:
          bpy.data.objects["Plane.003"].scale.y = picture3_scale[0]
          bpy.data.objects["Plane.003"].scale.x = picture3_scale[1]
          
          if picture3[3] == "image":
              bpy.data.textures["Texture.004"].image.source = 'FILE'
              bpy.data.textures["Texture.004"].image.filepath = picture3
          else:
              bpy.data.textures["Texture.004"].image.source = 'MOVIE'
              bpy.data.textures["Texture.004"].image.filepath = picture3
              bpy.data.textures["Texture.004"].image_user.use_cyclic = True
              bpy.data.textures["Texture.004"].image_user.frame_duration = 230.0
      
      if len(picture4) > 1:
          bpy.data.objects["Plane.004"].scale.y = picture4_scale[0]
          bpy.data.objects["Plane.004"].scale.x = picture4_scale[1]
          
          if picture4[3] == "image":
              bpy.data.textures["Texture.005"].image.source = 'FILE'
              bpy.data.textures["Texture.005"].image.filepath = picture4
          else:
              bpy.data.textures["Texture.005"].image.source = 'MOVIE'
              bpy.data.textures["Texture.005"].image.filepath = picture4
              bpy.data.textures["Texture.005"].image_user.use_cyclic = True
              bpy.data.textures["Texture.005"].image_user.frame_duration = 230.0

  except Exception as E:
      print_error(sys.exc_info(), str(E))
      print(str(params), file=open("debug.txt", "a"))
  else:
      # Set the render options.  It is important that these are set
      # to the same values as the current OpenShot project.  These
      # params are automatically set by OpenShot
      bpy.context.scene.render.filepath = params["output_path"]
      bpy.context.scene.render.fps = params["fps"]
      #bpy.context.scene.render.quality = params["quality"]
      try:
          bpy.context.scene.render.file_format = params["file_format"]
          bpy.context.scene.render.color_mode = params["color_mode"]
      except:
          bpy.context.scene.render.image_settings.file_format = params["file_format"]
          bpy.context.scene.render.image_settings.color_mode = params["color_mode"]
      bpy.context.scene.render.alpha_mode = params["alpha_mode"]
      bpy.data.worlds[0].horizon_color = params["horizon_color"]
      bpy.context.scene.render.resolution_x = params["resolution_x"]
      bpy.context.scene.render.resolution_y = params["resolution_y"]
      bpy.context.scene.render.resolution_percentage = params["resolution_percentage"]
      bpy.context.scene.frame_start = params["start_frame"]
      bpy.context.scene.frame_end = params["end_frame"]
      
      # Animation Speed (use Blender's time remapping to slow or speed up animation)
      animation_speed = int(params["animation_speed"])	# time remapping multiplier
      new_length = int(params["end_frame"]) * animation_speed	# new length (in frames)
      bpy.context.scene.frame_end = new_length
      bpy.context.scene.render.frame_map_old = 1
      bpy.context.scene.render.frame_map_new = animation_speed
      if params["start_frame"] == params["end_frame"]:
          bpy.context.scene.frame_start = params["end_frame"]
          bpy.context.scene.frame_end = params["end_frame"]    
  finally:
      # Render the current animation to the params["output_path"] folder
      bpy.ops.render.render(animation=params["animation"])

To manage notifications about this bug go to:
https://bugs.launchpad.net/openshot/+bug/1790203/+subscriptions


References